---
title: CLI
description: "madeui init, add, and list — plus shadcn CLI compatibility."
sidebar:
  order: 4
---

The `madeui` CLI sets up the StyleX build and copies components into your
project. The registry is also shadcn-compatible, so `npx shadcn@latest add
@madeui/<name>` works for installs once your build is set up.

## init

```bash
npx @madeui/cli init
```

Sets up the current app:

- Detects the framework (Next.js or Vite) and wires the StyleX build —
  Babel + PostCSS plugin on Next.js, `@stylexjs/unplugin` on Vite. Config
  files it doesn't fully understand are never rewritten; it prints the exact
  snippet to apply instead.
- Installs `@stylexjs/stylex` and `@base-ui/react`.
- Ensures the global CSS has the `@stylex` marker with a `base` reset layer
  declared before it (unlayered CSS would outrank StyleX).
- Copies the design tokens (`lib/tokens.stylex.ts`, `lib/constants.stylex.ts`,
  `lib/themes.ts`) and utilities (`lib/stylex-utils.ts`).
- Appends a component-conventions section to `AGENTS.md` so coding agents
  follow the house rules (tokens over literals, variants over escapes,
  `[data-*]` condition keys for Base UI state).
- Writes `madeui.json` with your paths and registry.

| Option | Description |
| --- | --- |
| `--registry <url\|dir>` | Registry to use (hosted URL or a local directory). |
| `--no-install` | Print dependency installs instead of running them. |

## add

```bash
npx @madeui/cli add button dialog select
```

Copies components into `components/ui/`, resolving registry dependencies
(e.g. `pagination` pulls in `button`; every component pulls the tokens) and
installing missing npm packages.

| Option | Description |
| --- | --- |
| `--diff` | Show what would change without writing anything. |
| `--overwrite` | Replace files that have local changes without asking. |
| `--registry <url\|dir>` | Registry to use. |
| `--no-install` | Print dependency installs instead of running them. |

Because you own the files, `add` never silently overwrites local edits — it
asks (or use `--diff` first).

## list

```bash
npx @madeui/cli list
```

Lists every item in the configured registry with its description.

## Using the shadcn CLI

Every component page shows the equivalent install:

```bash
npx shadcn@latest add @madeui/button
```

The shadcn CLI handles the copy + npm dependencies; it does not set up the
StyleX build — run `madeui init` (or the [manual setup](/docs/installation)) once
first.
