CLI
Initialize a project and add components with the axiom CLI.
Not published yet
npx axiom doesn’t work yet: the CLI isn’t on npm. This page is the
specification it is being built against, so commands and options may still
change.
The CLI copies source files into your project. It is the only thing Axiom publishes, and it never becomes a runtime dependency of your app: once the files are copied, your app doesn’t need it.
init
npx axiom initpnpm dlx axiom inityarn dlx axiom initbun x axiom initSets up a project for Axiom:
- Asks for the styling tool:
stylesheet,unistyles,nativewindoruniwind. - Copies the foundations (theme, tokens,
light/dark) and the core primitives. - Installs the styling dependency, if any.
- Writes
axiom.json, with the copied foundations and core primitives listed initems.
add
npx axiom add bottom-sheetpnpm dlx axiom add bottom-sheetyarn dlx axiom add bottom-sheetbun x axiom add bottom-sheetAdds a component to your project. The CLI:
- copies the variant that matches your configured styling;
- copies missing internal dependencies (
portal,overlay,tappable…); - installs third-party packages such as Reanimated or Gesture Handler;
- never overwrites an existing file without asking (see Existing files);
- registers the component’s tokens in the theme, if it has any (see Component tokens);
- adds the component and every internal dependency it copied to
itemsinaxiom.json.
Internal dependencies are resolved as a graph. Adding bottom-sheet also brings in what it relies on, and skips anything already in your project:
bottom-sheet
│
┌────┴────┐
↓ ↓
portal overlayNames are plain component names, the same as the file you get:
npx axiom add button # → components/ui/button.tsxpnpm dlx axiom add button # → components/ui/button.tsxyarn dlx axiom add button # → components/ui/button.tsxbun x axiom add button # → components/ui/button.tsxExisting files
Copied files belong to your project, so add protects your changes. A file identical to the registry is skipped silently. When a file differs:
| File | What happens |
|---|---|
| A file of the component you named | The CLI asks: [y]es, [n]o, [a]ll for every remaining file, [N]one to keep all of them. |
| A file of an internal dependency already in your project | Kept. add button never touches your tappable.tsx. Name the dependency to update it: add tappable. |
| A file your project owns once created, like the icon registry | Kept, always. |
npx axiom add button --overwritepnpm dlx axiom add button --overwriteyarn dlx axiom add button --overwritebun x axiom add button --overwrite--overwrite replaces the files of the components you named without asking. Dependencies and owned files are still kept.
Icons
The first item that needs icons asks where they come from (expo-symbols or custom) and saves the answer as icons. Pass --icons <source> to answer without a prompt. When a component draws icons your registry doesn’t have, add lists them. See Icon.
Navigation
The first item that depends on the navigation library, like use-overlay-back-handler, detects it from package.json (expo-router, react-navigation or react-native without one) and saves it as navigation. Pass --navigation <library> to override the detection.
Without a terminal (CI, a script), nobody can answer: differing files are kept and the CLI lists them.
fetch
npx axiom fetchpnpm dlx axiom fetchyarn dlx axiom fetchbun x axiom fetchCopies every item listed in items in axiom.json. Use it to set up a project with the same items as another one, or to restore files that were deleted.
For each item, fetch runs the same steps as add: it copies the variant for your styling, resolves internal dependencies, and installs missing npm packages. Files already in your project are skipped, so your changes are kept.
fetch isn’t an update command. To get a newer version of a component, run add again and confirm the overwrite.
Configuration
The CLI reads and writes axiom.json at the root of your project: styling variant, aliases, and the list of copied items. See Configuration.