For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
FrakmentFrakment

Installation

How to install Frakment components in a React Native project via Expo.

Frakment native components are built for React Native apps that run on iOS and Android via Expo. There are two paths: use the CLI with --expo to fetch components from the registry, or copy the source files manually.

What you'll get from this guide:

  • A working components.json with platform: "expo" and registries.expo
  • lib/utils.ts and lib/theme.ts
  • Three dependencies installed via npx expo install: clsx, tailwind-merge, class-variance-authority
  • Your first native component installed and rendering

Prerequisites

  • Node.js 22.18.0 or newer when using the Frakment CLI
  • Expo SDK 58 or newer
  • React Native 0.88
  • NativeWind 5.0.0-rc or newer
  • Tailwind CSS v4
  • TypeScript (recommended)
  • A stylesheet that imports nativewind/theme, such as global.css or app/global.css

Components target Expo SDK 58 and React Native 0.88. Older versions may need manual adjustments.

Additional peer packages

Some components need extra peers. Install them with the component:

  • react-native-reanimated 4.7 or newer
  • react-native-safe-area-context 5.10 or newer
  • react-native-svg 15.16 or newer
  • react-native-gesture-handler 3.3 or newer
  • react-native-worklets
  • lucide-react-native

Use the CLI

For all commands, flags, and registry format, see the CLI Reference.

Run init

$ npx frakment@latest init --expo

Verifies the required dependencies, detects your NativeWind stylesheet, writes components.json with platform: "expo" and registries.expo, copies lib/utils.ts and lib/theme.ts, and installs 3 dependencies via npx expo install: class-variance-authority, clsx, tailwind-merge.

Add components

$ npx frakment@latest add button --expo

Fetches button.json from the Expo registry, resolves registry dependencies recursively, resolves npm dependencies, writes source into components/ui/.

Import and use

app/index.tsx
import { Button } from "@/components/ui/button";
 
export default function Screen() {
  return <Button>Save changes</Button>;
}

What you get

After frakment init --expo, your project will have:

components.json
utils.ts
theme.ts
  • components.json - platform, registries, aliases, and tailwind.css. Read by the CLI on every add.
  • lib/utils.ts - cn() helper for merging NativeWind classes.
  • lib/theme.ts - useThemeColors() hook and the ThemeColors type used by every native component.

Dependencies

frakment init --expo checks your package.json and installs any missing package via npx expo install:

  • clsx
  • tailwind-merge
  • class-variance-authority

Existing Project

Add Frakment to an Expo project you already created.

Configure NativeWind

Follow the NativeWind 5 setup guide. Wrap metro.config.js with withNativeWind and confirm global.css imports tailwindcss/theme.css, tailwindcss/utilities.css, and nativewind/theme.

Copy lib/utils.ts

lib/utils.ts
import type { ClassValue } from "clsx";
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";

export const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs));

Copy lib/theme.ts

lib/theme.ts
import { useColorScheme } from "react-native";

export interface ThemeColors {
  accent: string;
  accentForeground: string;
  background: string;
  border: string;
  destructive: string;
  destructiveForeground: string;
  destructiveHover: string;
  foreground: string;
  input: string;
  mutedForeground: string;
  primary: string;
  primaryForeground: string;
  primaryHover: string;
  secondary: string;
  secondaryForeground: string;
  secondaryHover: string;
}

const lightColors: ThemeColors = {
  accent: "rgba(245, 245, 245, 1)",
  accentForeground: "rgba(23, 23, 23, 1)",
  background: "rgba(255, 255, 255, 1)",
  border: "rgba(229, 229, 229, 1)",
  destructive: "rgba(239, 68, 68, 1)",
  destructiveForeground: "rgba(255, 255, 255, 1)",
  destructiveHover: "rgba(240, 86, 86, 1)",
  foreground: "rgba(10, 10, 10, 1)",
  input: "rgba(227, 227, 227, 1)",
  mutedForeground: "rgba(102, 102, 102, 1)",
  primary: "rgba(23, 23, 23, 1)",
  primaryForeground: "rgba(250, 250, 250, 1)",
  primaryHover: "rgba(46, 46, 46, 1)",
  secondary: "rgba(245, 245, 245, 1)",
  secondaryForeground: "rgba(23, 23, 23, 1)",
  secondaryHover: "rgba(247, 247, 247, 1)",
};

const darkColors: ThemeColors = {
  accent: "rgba(64, 64, 64, 1)",
  accentForeground: "rgba(250, 250, 250, 1)",
  background: "rgba(10, 10, 10, 1)",
  border: "rgba(255, 255, 255, 0.1)",
  destructive: "rgba(248, 113, 113, 1)",
  destructiveForeground: "rgba(255, 255, 255, 1)",
  destructiveHover: "rgba(224, 102, 102, 1)",
  foreground: "rgba(250, 250, 250, 1)",
  input: "rgba(255, 255, 255, 0.15)",
  mutedForeground: "rgba(163, 163, 163, 1)",
  primary: "rgba(229, 229, 229, 1)",
  primaryForeground: "rgba(23, 23, 23, 1)",
  primaryHover: "rgba(207, 207, 207, 1)",
  secondary: "rgba(38, 38, 38, 1)",
  secondaryForeground: "rgba(250, 250, 250, 1)",
  secondaryHover: "rgba(33, 33, 33, 1)",
};

export function useThemeColors(): ThemeColors {
  const scheme = useColorScheme();
  return scheme === "dark" ? darkColors : lightColors;
}

Create components.json

components.json
{
  "platform": "expo",
  "registry": "https://www.arrafi.dev/frakment/r",
  "registries": {
    "web": "https://www.arrafi.dev/frakment/r",
    "expo": "https://www.arrafi.dev/frakment/r/expo"
  },
  "aliases": {
    "components": "@/components",
    "ui": "@/components/ui",
    "utils": "@/lib/utils"
  },
  "tailwind": {
    "css": "global.css"
  }
}

Add a component

$ npx frakment@latest add button --expo

Import and use

app/index.tsx
import { Button } from "@/components/ui/button";
 
export default function Screen() {
  return <Button>Save changes</Button>;
}

Verify

Check the file exists

ls components/ui/button.tsx

Import and render it

app/index.tsx
import { Button } from "@/components/ui/button";
 
export default function Screen() {
  return <Button>Save changes</Button>;
}

Confirm no errors

If you see Cannot find module '@/lib/utils', run npx frakment@latest init --expo again.

Troubleshooting

init --expo requires expo, react-native, nativewind, and tailwindcss in your package.json. Install them first with npx expo install or npm install.

init --expo looks for global.css, app/global.css, src/global.css, src/app/global.css, or styles/global.css. Create one that imports tailwindcss/theme.css, tailwindcss/utilities.css, and nativewind/theme.

Native components use immediate state changes and do not expose the web motion prop.

Next