DocsGetting started
Expo app
Add SwipeUI to an Expo app with Expo Router or React Navigation.
You need Expo SDK 57 or 58 and Node 20.12 or later.
Set up the project
Run init in your app's folder:
npx @swipeui/cli initIt shows what it will change, then asks before writing anything:
- Uniwind and Tailwind: installs them, wraps
metro.config.jswithwithUniwindConfig(or creates the file), and importsglobal.cssfrom your root layout. - Theme: adds the SwipeUI tokens your
global.cssis missing, in light and dark. If you already use React Native Reusables or HeroUI Native tokens, it builds on them. See Using your existing theme. components.json: registers the SwipeUI registry.cn: adds the class-name helper every component uses..gitignore: ignores.env*.local, where a Pro licence key would go.
Restart Metro with a clear cache afterwards: npx expo start --clear.
Add components
npx @swipeui/cli add avatar button list-row segmented-control switch textFiles go to components/swipeui/ under your path alias (usually src/), and imports use that alias. Run npx @swipeui/cli list to see everything.
Use them
A settings screen built from the components above:
import { useState } from 'react';
import { ScrollView, View } from 'react-native';
import { Avatar } from '@/components/swipeui/ui/avatar';
import { Button } from '@/components/swipeui/ui/button';
import { ListRow } from '@/components/swipeui/ui/list-row';
import { SegmentedControl } from '@/components/swipeui/ui/segmented-control';
import { Switch } from '@/components/swipeui/ui/switch';
import { Text } from '@/components/swipeui/ui/text';
type Range = 'day' | 'week' | 'month';
export default function SettingsScreen() {
const [notifications, setNotifications] = useState(true);
const [range, setRange] = useState<Range>('week');
return (
<ScrollView className="flex-1 bg-background" contentContainerClassName="gap-6 p-4">
<View className="flex-row items-center gap-3">
<Avatar name="Ada Lovelace" size="lg" />
<View className="flex-1">
<Text variant="title-2">Ada Lovelace</Text>
<Text variant="subheadline" className="text-muted-foreground">
ada@example.com
</Text>
</View>
</View>
<SegmentedControl<Range>
accessibilityLabel="Summary range"
options={[
{ value: 'day', label: 'Day' },
{ value: 'week', label: 'Week' },
{ value: 'month', label: 'Month' },
]}
value={range}
onValueChange={setRange}
/>
<View className="rounded-card border border-border overflow-hidden">
<ListRow
title="Notifications"
trailing={
<Switch
accessibilityLabel="Notifications"
value={notifications}
onValueChange={setNotifications}
/>
}
/>
<ListRow title="Privacy" subtitle="Who can see your activity" onPress={() => {}} />
</View>
<Button onPress={() => {}}>Save changes</Button>
</ScrollView>
);
}Gotchas
- Development builds: the components use
expo-hapticsandreact-native-reanimated, which Expo Go already includes. If you use a development build and the CLI installs a new native package, rebuild it withnpx expo run:iosornpx expo run:android. The CLI tells you when. - Theme not applied: check that your root layout imports
global.cssand that Metro was restarted with--clear.npx @swipeui/cli doctorchecks both. - React Navigation without Expo Router: nothing changes. Import
global.cssinApp.tsxinstead of a layout file.