# Components

Browse a catalog of accessible UI components, try one in a live preview and install it into your project in a click.

Use the **Components** panel to add ready UI building blocks to your project, such as a dialog, tabs, a date picker or a data table. Install one and its source code is added to your project, where you and the AI can use it.

The Components panel with the category pills, a search field and component cards, one marked Installed.

## What you can do

- Browse components by category and search them by name.
- Try a component in a live preview, in light or dark, at desktop or mobile width.
- See how many packages a component needs.
- Install a component into your project, and undo the install.
- See which components are already installed, and insert one on the page.

## Install a component

1. ### Open Components

   Choose **Components** in the rail on the left of the editor.
2. ### Find one

   Pick a category (**All**, **Layout**, **Forms**, **Overlays**, **Feedback**, **Navigation**, **Data Display**, **Media** or **Utilities**), or type in **Search components...**. Each card shows the number of packages the component needs.
3. ### Install it

   Choose the component card. A confirmation, such as **Install Dialog?**, lists what it adds to your project: the **Files**, the **Packages** and the other components it also installs. Choose **Install**. A message says when it is installed, with **Undo** to take it out again. Installed components show an **Installed** badge.

Choose an installed card, or **Insert on page** in its menu, to add the component to the page.

The first install sets up the component collection in your project. A message shows while it runs.

## Try a component first

Open the preview of a card to try the component before you install it. The preview is interactive: click, type and open menus as in your app.

| Control                                     | What it does                                                                                                                                            |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Appearance**                              | Show the preview in **Light** or **Dark**.                                                                                                              |
| **Width**                                   | Show it at **Desktop** or **Mobile** width.                                                                                                             |
| Design system                               | Try the component with another design system. This is a preview only: your project keeps its design system until you choose **Use this design system**. |
| **Previous component** / **Next component** | Move through the components of the category.                                                                                                            |
| **Reset the preview**                       | Start the preview again.                                                                                                                                |
| **Add to project**                          | Install the component.                                                                                                                                  |

## Where the code goes

Each component is added to `src/components/ui/`, for example `src/components/ui/dialog.tsx`. The packages it needs are added to your `package.json`. Your project theme is applied again after the install, so the component matches your brand.

> [!NOTE]
>
> **Use it with the AI**
>
> Once a component is installed, ask the AI to use it, for example: "Show the sign-up form in a dialog". The AI works with the files in your project.

## FAQ

### The panel says Sandbox not ready

The project is still starting. Wait for the canvas to load, then try again.

### How is this different from blocks?

A component is a small reusable part you use in your code, like a button or a dialog. A block is a finished section placed on a page. See [Blocks](/features/design/blocks).

## Related

- [Blocks](/features/design/blocks): Add finished sections to a page.
- [Packages](/features/code/packages): Add any npm package.
- [Brand and design system](/features/design/brand-and-design-system): Theme every component at once.
