> ## Documentation Index
> Fetch the complete documentation index at: https://docs.linktr.ee/llms.txt
> Use this file to discover all available pages before exploring further.

# linkapp add

> Add components from the registry to your project

## Usage

```bash theme={"system"}
npx @linktr.ee/linkapp add <component> [options]
```

Adds a single UI component from the LinkApp registry into your project (powered by `npx shadcn@latest`).

## Options

| Flag               | Description                                                                         | Default          |
| ------------------ | ----------------------------------------------------------------------------------- | ---------------- |
| `--registry <url>` | Use a custom registry URL (defaults to LINKAPP\_REGISTRY\_URL or official registry) | default registry |
| `--yes, -y`        | Skip confirmation prompts                                                           | `false`          |
| `--overwrite`      | Overwrite existing components                                                       | `false`          |
| `-h, --help`       | Show help                                                                           | -                |

## Available components

The default registry ships:

* `button`
* `container`
* `embed`
* `skeleton`
* `switch`

## Prerequisites

* Run from your LinkApp project root.
* `components.json` must exist (created by create-linkapp).

## Examples

Install the button component:

```bash theme={"system"}
npx @linktr.ee/linkapp add button
```

Install from a custom registry with no prompts:

```bash theme={"system"}
npx @linktr.ee/linkapp add container --registry https://example.com/r --yes
```

## Overwriting components

If a component already exists:

```
Component "button" already exists. Overwrite? (y/N)
```

Use `--overwrite` to skip the prompt:

```bash theme={"system"}
npx @linktr.ee/linkapp add button --overwrite
```

## Custom registries

The CLI resolves the component URL from:

1. `--registry <url>` flag (if provided)
2. `LINKAPP_REGISTRY_URL` environment variable
3. Default registry: `https://create-linkapp-registry.vercel.app/r`

You can also pass a full URL as the component argument:

```
npx @linktr.ee/linkapp add https://example.com/r/card.json
```

## What happens

1. Validates you provided a component name and that `components.json` exists.
2. Resolves the component JSON from the registry.
3. Runs `npx shadcn@latest add <component-url>` with your flags.
4. Writes the component into `components/ui/` and prints an import hint.

After a successful install you can import:

```ts theme={"system"}
import { Button } from "@/components/ui/button";
```

If the install fails, rerun with `--overwrite` or check the registry URL.
