> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# Add and remove components

These [CLI](/dolan/cli/index.md) commands copy components into your app, show what they contain, and take them out again. Run them from your project folder, after [`init`](/dolan/cli/index.md#init).

## add

Copies components, and the components they need, into your app.

```bash
npx @blotch/dolan add [components...]
```

| Argument or option | Description                                                                  |
| ------------------ | ---------------------------------------------------------------------------- |
| `[components...]`  | Component names. An unknown name stops the command and lists the valid ones. |
| `-f, --force`      | Overwrite installed components without asking.                               |

Each component goes into `<components>/<name>/`. With no names, it shows a checklist. Without a terminal, there's no checklist, so name the components.

- **Dependencies come too.** Adding `button` also adds `spinner`, and the CLI prints what it added.
- **Imports are rewritten.** `cn()` and the animation helpers are imported from `@blotch/dolan/utils/cn` and `@blotch/dolan/utils/animate`.
- **Existing components are kept.** If a folder already exists, it asks before overwriting (default No), and skips it otherwise.
  - Without a terminal, it skips it, and says how to overwrite it.
  - `--force` overwrites without asking.
  - Overwriting also deletes the files an older version copied that the bundled source no longer has.
- **npm packages are installed.** If a component imports a package your `package.json` lacks, `add` installs it. It uses your package manager (npm, pnpm, yarn or bun, detected from the lockfile).
  - `class-variance-authority` for Alert, Badge, Button, Button Group, Toggle and Typography.
  - `@tanstack/charts`, `d3-shape` and `@types/d3-shape` for `chart` and the chart presets.

### Unit tests

- **They're copied only if you can run them.** A component's tests (`<name>.test.ts`, and one per other file it has) render it with `@blotch/angular-lynx-testing-library`. So `add` copies them only when your `package.json` lists the library.
- **Otherwise `add` leaves them out and says so.** Run `ng generate @blotch/angular-lynx:add-testing`, then `dolan update` adds them.
- **Their helpers come from `@blotch/dolan/testing/*`.**
- **They cover the code fully.** Under `ng test --coverage`, each component's own tests cover all of its files, with nothing left out. So you can keep the copies in your coverage report and its thresholds.

## info

Prints a component's files, the components it depends on, and the components that use it.

```bash
npx @blotch/dolan info <component>
```

| Argument or option | Description         |
| ------------------ | ------------------- |
| `<component>`      | The component name. |

It works without a `dolan.config.json`. With one, it also shows what's installed.

## remove

Deletes a component's folder and its lockfile entry.

```bash
npx @blotch/dolan remove <component>
```

| Argument or option | Description                                                                                 |
| ------------------ | ------------------------------------------------------------------------------------------- |
| `<component>`      | An installed component.                                                                     |
| `-f, --force`      | Skip both questions: remove it even if others depend on it, and remove unused dependencies. |

Alias: `rm`.

- **If other installed components depend on it**, it warns and asks first (default No). Without a terminal, it stops with exit code 1 instead.
- **It offers to remove dependencies that nothing else uses** (default Yes). Without a terminal, it removes them. It looks one level deep, so remove deeper dependencies yourself.
- **It doesn't uninstall npm packages.**

## eject

Stops dolan tracking a component, so the component is yours.

```bash
npx @blotch/dolan eject <component>
```

| Argument or option | Description                     |
| ------------------ | ------------------------------- |
| `<component>`      | An installed component.         |
| `-f, --force`      | Skip the confirmation question. |

It removes the component from `dolan.lock.json` and leaves its files alone. It asks first (default No). Without a terminal, it stops with exit code 1 unless you pass `--force`.

- **`update` doesn't touch it**, even with `--force`.
- **`diff` and `outdated` skip it.** `list` shows it as ejected.
- **A component folder that isn't in `dolan.lock.json` counts as ejected**, whatever put it there.
- **To track it again**, run `dolan add <component>`, which asks before overwriting it.

## Related

- [CLI](/dolan/cli/index.md): `init`, `theme`, `doctor`, and how dolan works without a terminal
- [Check and update components](/dolan/cli/updates.md): `list`, `diff`, `outdated` and `update`
- [UI Components](/dolan/index.md): install dolan and add your first component
- [Theming](/dolan/theming.md): the theme files `init` copies
- [Tailwind CSS](/guide/tailwindcss.md): required by every component
