Skip to content
ezybg7Public

About

Library for all Gratis Labs UI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

gratis-ui

React Native components that feel like a built-in iPhone app.

Extracted from Ambry, where they were built and shipped, and generalized so the next app doesn't rebuild them. Every component follows Apple's HIG rather than a house design language: iOS semantic colors, true-black dark mode, 44pt tap targets, VoiceOver labels that read as sentences, and layouts that survive accessibility text sizes.

The theme is the point. Two palettes of Apple semantic values, a strict split between colors that are legible as text and colors that are only legal as fills, and a test that fails the build if either palette drifts below WCAG AA.

Install

npm install github:ezybg7/gratis-ui#v0.1.0

Then the peers, so Expo picks versions that match your SDK:

npx expo install react-native-safe-area-context @expo/vector-icons \
  react-native-gesture-handler react-native-reanimated

# Optional — only OfflineBanner uses it, and it degrades to "assume online".
npx expo install expo-network

react-native-gesture-handler and react-native-reanimated are needed by SwipeRow; wrap your app in GestureHandlerRootView as those libraries document.

Use it

No setup. Import and render — the built-in palettes work out of the box and follow the device's appearance setting.

import { Button, Input, LargeTitle, useThemedStyles, type ThemeColors } from 'gratis-ui';
import { StyleSheet, View } from 'react-native';

export function SignIn({ onSubmit }: { onSubmit: () => void }) {
  const styles = useThemedStyles(makeStyles);
  return (
    <View style={styles.screen}>
      <LargeTitle title="Sign in" />
      <Input placeholder="Email" autoCapitalize="none" keyboardType="email-address" />
      <Button large title="Continue" onPress={onSubmit} />
    </View>
  );
}

// Module scope, not inside the component — see docs/REFERENCE.md.
const makeStyles = (t: ThemeColors) =>
  StyleSheet.create({
    screen: { flex: 1, backgroundColor: t.bg, padding: 16, gap: 12 },
  });

Make it yours

ThemeProvider is optional and exists only to re-tint the defaults. Override the tokens you care about — usually the accent family — and leave the rest.

import { ThemeProvider } from 'gratis-ui';

const overrides = {
  light: { accent: '#1D4ED8', accentFill: '#2563EB', accentTintBg: '#E4ECFD' },
  dark: { accent: '#7FA8FF', accentFill: '#3B82F6', accentTintBg: '#16294A' },
};

export default function App() {
  return <ThemeProvider overrides={overrides}>{/* … */}</ThemeProvider>;
}

Define overrides at module scope, and guard it with the exported contrast() helper — the built-in palettes are held to AA by a test, yours are not unless you write one. docs/REFERENCE.md has the snippet.

Tell your AI about this library

Add this line to your app's CLAUDE.md (or equivalent):

UI components come from gratis-ui — read node_modules/gratis-ui/docs/REFERENCE.md before writing UI.

docs/REFERENCE.md is the complete API: every component's props, defaults, a11y behavior, the tokens it uses, and when not to reach for it. llms.txt at the root is the 20-line version.

Updates

Versions are git tags. You are pinned to whatever tag you installed, so nothing changes under you.

# Move to a new version.
npm install github:ezybg7/gratis-ui#v0.2.0

# Or track the tip, if you want changes as they land.
npm install github:ezybg7/gratis-ui#main

No build step

The package ships TypeScript source and points main/types straight at src/index.ts. Expo's Metro compiles it out of node_modules like any other file in your app — nothing to build here, nothing stale to publish, and you can read (and step through) the actual source of anything you render.

Contributing

npm install
npm run typecheck
npm test

Both must be green. CLAUDE.md has the house rules.

MIT.

About

Library for all Gratis Labs UI

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages