DocsCLI
add
Add items, and the items they depend on, to your project.
npx @swipeui/cli add button switchNames can be written plainly (button) or namespaced (@swipeui/button).
┌ 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
- Resolves the items and every item they depend on.
- Writes their files under
components/swipeui/, keeping the// swipeui:<item>@<version>line at the top of each. - Rewrites imports between SwipeUI files: your path alias in Expo projects, relative paths in bare apps.
- Installs missing packages with
npx expo install(or your package manager without Expo). - 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 --overwriteOptions
| Option | Effect |
|---|---|
--overwrite | Replace files that differ from the registry |
--dry-run | Show the plan only |
--skip-install | Print the install command instead of running it |
Run npx @swipeui/cli init first: add needs components.json.