SwipeUI
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 init

It shows what it will change, then asks before writing anything:

  • Uniwind and Tailwind: installs them, wraps metro.config.js with withUniwindConfig (or creates the file), and imports global.css from your root layout.
  • Theme: adds the SwipeUI tokens your global.css is 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 text

Files 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-haptics and react-native-reanimated, which Expo Go already includes. If you use a development build and the CLI installs a new native package, rebuild it with npx expo run:ios or npx expo run:android. The CLI tells you when.
  • Theme not applied: check that your root layout imports global.css and that Metro was restarted with --clear. npx @swipeui/cli doctor checks both.
  • React Navigation without Expo Router: nothing changes. Import global.css in App.tsx instead of a layout file.

On this page