SwipeUI
DocsCLI

add

Add items, and the items they depend on, to your project.

npx @swipeui/cli add button switch

Names can be written plainly (button) or namespaced (@swipeui/button).

Terminal
┌  swipeui add
◇  button needs cn, text and use-haptics
│  + src/components/swipeui/ui/button.tsx      button@1.0.0
│  + src/components/swipeui/ui/text.tsx        text@1.0.0
│  + src/components/swipeui/hooks/use-haptics.ts  use-haptics@1.0.0
│  = src/components/swipeui/lib/cn.ts          up to date
│  ↓ class-variance-authority@^0.7.1 expo-haptics   (npx expo install)
└  Done.

What it does

  1. Resolves the items and every item they depend on.
  2. Writes their files under components/swipeui/, keeping the // swipeui:<item>@<version> line at the top of each.
  3. Rewrites imports between SwipeUI files: your path alias in Expo projects, relative paths in bare apps.
  4. Installs missing packages with npx expo install (or your package manager without Expo).
  5. Tells you when you need to rebuild: for new native packages, and for items that don't run in Expo Go.

Files you've edited

If a file differs from the registry version, add leaves it alone and says so. --overwrite replaces it:

npx @swipeui/cli add button --overwrite

Options

OptionEffect
--overwriteReplace files that differ from the registry
--dry-runShow the plan only
--skip-installPrint the install command instead of running it

Run npx @swipeui/cli init first: add needs components.json.

On this page