- Accordion
- Attachment
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Card
- Checkbox
- Code Block
- Collapsible
- Dialog
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Label
- Marker
- Message
- Number Flow
- Pagination
- Popover
- Progress
- Radio Group
- Select
- Slider
- Slot
- Sonner
- Spinner
- Switch
- Tooltip
- Separator
- Sheet
- Tabs
- Textarea
- Toggle
- Toggle Group
- Trace
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.jsonwithplatform: "expo"andregistries.expo lib/utils.tsandlib/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 asglobal.cssorapp/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-reanimated4.7 or newerreact-native-safe-area-context5.10 or newerreact-native-svg15.16 or newerreact-native-gesture-handler3.3 or newerreact-native-workletslucide-react-native
Use the CLI
For all commands, flags, and registry format, see the CLI Reference.
Run init
$ bunx --bun frakment@latest init --expo$ npx frakment@latest init --expo$ pnpm dlx frakment@latest init --expo$ yarn dlx 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
$ bunx --bun frakment@latest add button --expo$ npx frakment@latest add button --expo$ pnpm dlx frakment@latest add button --expo$ yarn dlx 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
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-platform,registries,aliases, andtailwind.css. Read by the CLI on everyadd.lib/utils.ts-cn()helper for merging NativeWind classes.lib/theme.ts-useThemeColors()hook and theThemeColorstype used by every native component.
Dependencies
frakment init --expo checks your package.json and installs any missing package via npx expo install:
clsxtailwind-mergeclass-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
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
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
{
"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
$ bunx --bun frakment@latest add button --expo$ npx frakment@latest add button --expo$ pnpm dlx frakment@latest add button --expo$ yarn dlx frakment@latest add button --expo
Import and use
import { Button } from "@/components/ui/button";
export default function Screen() {
return <Button>Save changes</Button>;
}Verify
Check the file exists
ls components/ui/button.tsxImport and render it
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
- Button - the first native component
- Theming - customize tokens
- CLI Reference - all commands and flags