# Solid UI: full documentation
> The text of every page listed in https://www.solid-ui.com/llms.txt, as Markdown.
Examples and component sources appear as `[Example: name]` and `[Source: path]`. The Markdown at each page's Source URL has their code.
# Introduction
Source: https://www.solid-ui.com/docs.md
> Accessible components for Solid 2.0, built with UI SDK and Tailwind CSS. Take the source and make it your own.
Solid UI is an unofficial Solid 2.0 port of [shadcn/ui](https://ui.shadcn.com/).
**Build your own component library with code you control.**
With a packaged component library, you install a dependency and import its components. As your design system grows, you may need to add wrappers, override styles, or mix components with different APIs. Solid UI gives you the component source so you can make those changes in your own codebase.
Solid UI is built around five principles.
- **Open Code.** Copy the component source into your project and edit it there.
- **Composition.** Combine explicit component parts to build the interface you need.
- **Distribution.** Find the source files and dependencies together in the component registry.
- **Beautiful Defaults.** Start with accessible components and styles that work together.
- **AI-Ready.** Give coding tools source files and examples they can inspect and edit.
## Open Code
Solid UI hands you the source for each component. You can see how it renders, use it as a starting point, and change its styling or behavior alongside the rest of your app. For a concrete example, try editing your local copy of [Button](/docs/components/button/).
Vite
a preset code from solid-ui.com/create
-y, --yes skip the prompts and use the defaults
-f, --force replace an existing components.json and solid-ui.css
--css the app stylesheet that imports Tailwind CSS
--alias the import alias for the components (default: ~)
-h, --help display help for command
```
## add
Use `add` to copy components into your project and install what they need. Without names, it lets you pick from the catalog.
```bash
npx solidui-cli@latest add [components...]
```
**Options**
```txt
Usage: solidui-cli add [options] [components...]
Options:
-c, --cwd the project directory (default: current directory)
-o, --overwrite replace files that differ
-y, --yes skip the prompts; keep files that differ
-a, --all add every component
-h, --help display help for command
```
## Examples
### Skip the prompts
In CI, scripts or coding agents, pass `--yes` together with the preset:
```bash
npx solidui-cli@latest init --preset --yes
```
Without `--preset` and `--alias`, `--yes` uses the Nova preset and the `~` alias. `--yes` never overwrites your files: `init` keeps a changed `lib/utils.ts` and `add` keeps components that differ from the registry. It does update packages the components can't work without, like an older Tailwind CSS minor or another UI SDK beta. Other packages outside the tested ranges stay as they are, with a warning.
### Switch the theme
Build a new preset on the [Create](/create) page and run `init` again with `--force`:
```bash
npx solidui-cli@latest init --preset --force
```
This replaces only `components.json` and `solid-ui.css` and installs the new fonts, so colors, fonts and radius change everywhere and your components stay untouched. If the new preset also changes the style, for example from Nova to Lyra, components you add from then on use the new style. Re-add the ones you already have with `--overwrite` to switch them too, which replaces your edits to those files.
### Update components
`add` never replaces a component you changed. It keeps your copy and tells you which files differ. To take the registry version:
```bash
npx solidui-cli@latest add button --overwrite
```
Commit your changes first, then compare the diff and merge back the edits you want to keep.
### Use your package manager
Run the CLI with the package manager your project uses, for example `pnpm dlx` or `bunx`. When nothing is installed yet, `init` installs the dependencies with that tool. The solid-v2 templates ship a `pnpm-lock.yaml`, so the lockfile can't tell which tool you chose. Once `node_modules` exists, the CLI keeps using the package manager that installed it, or the one in the `packageManager` field of `package.json`.
### Use another import alias
Components import each other through `~/` by default. If your project already uses another prefix such as `@/`, give it when `init` asks, or pass it:
```bash
npx solidui-cli@latest init --alias @
```
`init` saves the aliases in `components.json` and adds `@/*` to `tsconfig.json` unless it's there already. `add` rewrites the imports of every component to match, so `~/lib/utils` arrives as `@/lib/utils`. Running `init` again keeps the aliases from `components.json`.
### Choose the app stylesheet
`init` imports `solid-ui.css` into the stylesheet that imports Tailwind CSS. If more than one stylesheet does, name the one your app loads:
```bash
npx solidui-cli@latest init --css src/styles/app.css
```
### Fix unresolved imports
Components import each other through the `~/` alias. If Vite reports `Failed to resolve import "~/components/ui/..."`, it isn't reading the alias from `tsconfig.json`. `init` adds the option for you, but it leaves configs it can't edit safely alone, for example one built with `mergeConfig`. Add it yourself:
```ts title="vite.config.ts"
export default defineConfig({
resolve: { tsconfigPaths: true },
plugins: [solid(), tailwindcss()]
})
```
### Unsupported versions
`init` stops when `solid-js` or `tailwindcss` is newer than the [tested versions](/docs/installation/#built-for-solid-20). Newer versions ship with a CLI patch release once the components are tested with them, so run `solidui-cli@latest` again later. An older minor within the same major is fine: `init` offers to update it.
### Solid 1 projects
Solid UI 1.x needs Solid 2 and Tailwind CSS 4. Projects on Solid 1 and Tailwind CSS 3, or with a `ui.config.json`, keep using the previous registry through version 0.7.2 until they [migrate](/docs/migration/):
```bash
npx solidui-cli@0.7.2 add button
```
# Migration
Source: https://www.solid-ui.com/docs/migration.md
> Move a project from solidui-cli 0.7 on Solid 1 to Solid UI for Solid 2.
Projects on Solid 1 keep working with `solidui-cli@0.7.2`, which installs from
the previous registry. Migrate when your app moves to Solid 2.
## What changes
| Area | solidui-cli 0.7 | Solid UI for Solid 2 |
| ------------- | ------------------------------------------------ | -------------------------------------------- |
| Framework | Solid 1, SolidStart | Solid 2 with Vite and `@solidjs/vite-plugin` |
| Primitives | Kobalte, Corvu, Ark UI, cmdk-solid, solid-sonner | UI SDK, and solid-sonner 1 for Sonner |
| Tailwind CSS | 3, with `tailwind.config.cjs` | 4.3 or later, configured in CSS |
| Theme | HSL variables in your app stylesheet | Preset tokens in a generated `solid-ui.css` |
| Configuration | `ui.config.json` | `components.json` |
| Language | TypeScript or JavaScript | TypeScript |
| Dark mode | `.dark` or Kobalte's `[data-kb-theme="dark"]` | `.dark` on an ancestor |
Your imports keep working: both versions put components in `~/components/ui` and the `cn` helper in `~/lib/utils`.
## Migrate a project
### Upgrade to Solid 2
Follow Solid's [migration guide](https://github.com/solidjs/solid/blob/main/documentation/solid-2.0/MIGRATION.md). Solid UI needs a Vite app with `@solidjs/vite-plugin`; SolidStart projects aren't supported yet.
### Upgrade to Tailwind CSS 4
Run Tailwind's upgrade tool. It moves your `tailwind.config.cjs` into CSS and updates your classes:
```bash
npx @tailwindcss/upgrade
```
Then remove what Solid UI 0.7 added to your stylesheet and config: the `:root` and `.dark` blocks with HSL variables such as `--background: 0 0% 100%`, the color, radius and accordion entries that point to them, and `tailwindcss-animate`. The new `solid-ui.css` defines all of them, and the old variables would override it with values that no longer work. Keep your own styles.
See Tailwind's [upgrade guide](https://tailwindcss.com/docs/upgrade-guide) for the other changes.
### Run init
Delete `ui.config.json` and run `init`:
```bash
npx solidui-cli@latest init
```
Pick the preset closest to your old theme, or build one on the [Create](/create) page and pass its code with `--preset`. If you used Kobalte's color mode, toggle the `dark` class on `` instead of `data-kb-theme`.
### Re-add your components
Commit your work, then add the components you use again. `--overwrite` replaces the old Kobalte and Corvu versions:
```bash
npx solidui-cli@latest add button dialog select --overwrite
```
Compare the diff and merge back your own edits. Components that were renamed or removed are listed [below](#renamed-and-removed-components).
### Update your component usage
The components follow UI SDK's API now. Update the places that use the props in [API changes](#api-changes), then check each page in the [components](/docs/components/) docs for its parts.
### Remove the old packages
Uninstall the packages Solid UI 0.7 installed and nothing else uses:
```bash
npm uninstall @kobalte/core @corvu/drawer @corvu/otp-field @corvu/resizable @ark-ui/solid cmdk-solid solid-sonner embla-carousel-solid chart.js tailwindcss-animate
```
Keep `solid-sonner` if you add [Sonner](/docs/components/sonner/) again. It needs solid-sonner 1 for Solid 2, and `add sonner` offers to upgrade an older version.
## API changes
| Previous API | Current API |
| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `as={Button}` on primitive parts | `render={(partProps) => }` |
| `options`, `optionValue`, `optionLabel`, `itemComponent`, `sectionComponent` | Explicit items and groups, usually rendered with `For` |
| Collection `onChange` | Select and Combobox `onValueChange`, Command `onAction` |
| `onInputChange` | `onQueryChange` |
| Select-generated content and list | Your children inside `SelectContent` |
| Custom Combobox chip state and removal | `ComboboxValue`, `ComboboxChips`, `ComboboxChip` and `ComboboxChipRemove` |
| Root popup `placement` and `gutter` | Content `side`, `align` and `sideOffset` |
| Checkbox `indeterminate` boolean | `checked="indeterminate"` |
| Checkbox and Switch `onChange` | `onCheckedChange` |
Object values still work through `itemToValue` and `itemToLabel`.
## Renamed and removed components
| solidui-cli 0.7 | Now |
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
| `text-field` | [Input](/docs/components/input/), [Textarea](/docs/components/textarea/) and [Field](/docs/components/field/) |
| `otp-field` | [Input OTP](/docs/components/input-otp/) |
| `sonner` | [Sonner](/docs/components/sonner/) on solid-sonner 1, or [Toast](/docs/components/toast/) built from UI SDK |
| `date-picker` | [Date Picker](/docs/components/date-picker/), composed from Calendar and Popover |
| `callout` | [Alert](/docs/components/alert/) |
| `charts`, `number-field` | Not available yet |
| `badge-delta`, `bar-list`, `flex`, `grid`, `progress-circle`, `timeline` | Removed; use Tailwind CSS layouts or keep your copies |
# Components
Source: https://www.solid-ui.com/docs/components.md
> Browse all available Solid UI components.
- [Accordion](/docs/components/accordion/) — A vertically stacked set of interactive headings that each reveal a section of content.
- [Alert](/docs/components/alert/) — Displays a callout for user attention.
- [Alert Dialog](/docs/components/alert-dialog/) — A modal dialog that interrupts the user with important content and expects a response.
- [Aspect Ratio](/docs/components/aspect-ratio/) — Displays content within a desired ratio.
- [Attachment](/docs/components/attachment/) — Displays a file or image attachment with media, metadata, upload state, and actions.
- [Avatar](/docs/components/avatar/) — An image element with a fallback for representing the user.
- [Badge](/docs/components/badge/) — Displays a badge or a component that looks like a badge.
- [Breadcrumb](/docs/components/breadcrumb/) — Displays the path to the current resource using a hierarchy of links.
- [Bubble](/docs/components/bubble/) — Displays conversational content in a message bubble. Supports variants, alignment, grouping, reactions, and collapsible content.
- [Button](/docs/components/button/) — Displays a button or a component that looks like a button.
- [Button Group](/docs/components/button-group/) — A container that groups related buttons together with consistent styling.
- [Calendar](/docs/components/calendar/) — A calendar component that allows users to select a date or a range of dates.
- [Card](/docs/components/card/) — Displays a card with header, content, and footer.
- [Carousel](/docs/components/carousel/) — A carousel with motion, swipe, and keyboard paging.
- [Checkbox](/docs/components/checkbox/) — A control that allows the user to toggle between checked and not checked.
- [Code Block](/docs/components/code-block/) — Displays code, terminal output and diffs with an optional header, line numbers and a copy button.
- [Collapsible](/docs/components/collapsible/) — An interactive component which expands/collapses a panel.
- [Combobox](/docs/components/combobox/) — Autocomplete input with a list of suggestions.
- [Command](/docs/components/command/) — Command menu for search and quick actions.
- [Context Menu](/docs/components/context-menu/) — Displays a menu of actions triggered by a right click.
- [Date Picker](/docs/components/date-picker/) — A date picker component with range and presets.
- [Delta Bar](/docs/components/delta-bar/) — Bar to show negative or positive deviation from a particular threshold.
- [Dialog](/docs/components/dialog/) — A window overlaid on either the primary window or another dialog window, rendering the content underneath inert.
- [Direction](/docs/components/direction/) — A provider component that sets the text direction for your application.
- [Drawer](/docs/components/drawer/) — A panel that slides in from an edge of the screen, with dragging and snap points.
- [Dropdown Menu](/docs/components/dropdown-menu/) — Displays a menu to the user — such as a set of actions or functions — triggered by a button.
- [Empty](/docs/components/empty/) — Use the Empty component to display an empty state.
- [Field](/docs/components/field/) — Combine labels, controls, and help text to compose accessible form fields and grouped inputs.
- [Hover Card](/docs/components/hover-card/) — For sighted users to preview content available behind a link.
- [Input](/docs/components/input/) — A text input component for forms and user data entry with built-in styling and accessibility features.
- [Input Group](/docs/components/input-group/) — Add addons, buttons, and helper content to inputs.
- [Input OTP](/docs/components/input-otp/) — Accessible one-time password component with copy-paste functionality.
- [Item](/docs/components/item/) — A versatile component for displaying content with media, title, description, and actions.
- [Kbd](/docs/components/kbd/) — Used to display textual user input from keyboard.
- [Label](/docs/components/label/) — Renders an accessible label associated with controls.
- [Marker](/docs/components/marker/) — Displays an inline status, system note, bordered row, or labeled separator in a conversation.
- [Menubar](/docs/components/menubar/) — A visually persistent menu common in desktop applications that provides quick access to a consistent set of commands.
- [Message](/docs/components/message/) — Displays a message in a conversation, with optional avatar, header, footer, and alignment.
- [Message Scroller](/docs/components/message-scroller/) — A chat scroll container that anchors turns, opens saved transcripts, follows streamed responses, loads history without jumping, and jumps to any message.
- [Native Select](/docs/components/native-select/) — A styled native HTML select element with consistent design system integration.
- [Navigation Menu](/docs/components/navigation-menu/) — A collection of links for navigating websites.
- [Pagination](/docs/components/pagination/) — Pagination with page navigation, next and previous links.
- [Popover](/docs/components/popover/) — Displays rich content in a portal, triggered by a button.
- [Progress](/docs/components/progress/) — Displays an indicator showing the completion progress of a task, typically displayed as a progress bar.
- [Questionnaire](/docs/components/questionnaire/) — A multi-step questionnaire with single-choice, multiple-choice, freeform, and skippable questions.
- [Radio Group](/docs/components/radio-group/) — A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.
- [Resizable](/docs/components/resizable/) — Accessible resizable panel groups and layouts with keyboard support.
- [Scroll Area](/docs/components/scroll-area/) — Augments native scroll functionality for custom, cross-browser styling.
- [Select](/docs/components/select/) — Displays a list of options for the user to pick from—triggered by a button.
- [Separator](/docs/components/separator/) — Visually or semantically separates content.
- [Sheet](/docs/components/sheet/) — Extends the Dialog component to display content that complements the main content of the screen.
- [Sidebar](/docs/components/sidebar/) — A composable, themeable and customizable sidebar component.
- [Skeleton](/docs/components/skeleton/) — Use to show a placeholder while content is loading.
- [Slider](/docs/components/slider/) — An input where the user selects a value from within a given range.
- [Sonner](/docs/components/sonner/) — An opinionated toast component for Solid.
- [Spinner](/docs/components/spinner/) — An indicator that can be used to show a loading state.
- [Switch](/docs/components/switch/) — A control that allows the user to toggle between checked and not checked.
- [Table](/docs/components/table/) — A responsive table component.
- [Tabs](/docs/components/tabs/) — A set of layered sections of content—known as tab panels—that are displayed one at a time.
- [Textarea](/docs/components/textarea/) — Displays a form textarea or a component that looks like a textarea.
- [Toast](/docs/components/toast/) — Temporary notifications with optional descriptions and actions.
- [Toggle](/docs/components/toggle/) — A two-state button that can be either on or off.
- [Toggle Group](/docs/components/toggle-group/) — A set of two-state buttons that can be toggled on or off.
- [Tooltip](/docs/components/tooltip/) — A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.
- [Trace](/docs/components/trace/) — The building block for reasoning, tool calls, sources and more.
- [Typography](/docs/components/typography/) — Styles for headings, paragraphs, lists, etc.
# AI Elements
Source: https://www.solid-ui.com/docs/ai-elements.md
> Patterns for agentic interfaces, built from Solid UI components.
AI Elements are patterns for building agentic interfaces. Each one is a composition of Solid UI components that you copy into your project. There is no package to install. The code is yours.
A [Chat](/docs/ai-elements/chat/) is a list of [Message](/docs/ai-elements/message/) turns inside a [Message Scroller](/docs/components/message-scroller/). The steps an agent takes inside a turn, like [Reasoning](/docs/ai-elements/reasoning/), [Tool](/docs/ai-elements/tool/) and [Plan](/docs/ai-elements/plan/), are built on [Trace](/docs/components/trace/), so every step has the same shape.
**Building a chatbot?** Start from the [streaming chat example](/docs/components/message-scroller/#following-the-live-edge).
**Coming from [elements.ai-sdk.dev](https://elements.ai-sdk.dev)?** See [Migrating from AI SDK Elements](#migrating-from-ai-sdk-elements).
## Patterns
- [Chain of Thought](/docs/ai-elements/chain-of-thought/) — A summary that expands into the steps an agent took.
- [Chat](/docs/ai-elements/chat/) — The thread. Message Scroller keeps your place while the reply streams.
- [Checkpoint](/docs/ai-elements/checkpoint/) — A point in the conversation you can return to.
- [Confirmation](/docs/ai-elements/confirmation/) — A prompt to approve or deny a tool before it runs.
- [Context](/docs/ai-elements/context/) — How much of the context window the conversation has used.
- [File Tree](/docs/ai-elements/file-tree/) — The files the agent changed, as a folder tree.
- [Inline Citation](/docs/ai-elements/inline-citation/) — A source in the sentence that opens on hover.
- [Message](/docs/ai-elements/message/) — One turn. The person's message, and the agent's reply with its actions.
- [Model Selector](/docs/ai-elements/model-selector/) — Two menus. One picks the model the agent runs, the other picks how hard it thinks.
- [Plan](/docs/ai-elements/plan/) — The steps the agent plans to take, and how far it has got.
- [Prompt Input](/docs/ai-elements/prompt-input/) — A message field with attachments and a send button.
- [Queue](/docs/ai-elements/queue/) — The agent's todo list, split into what is left and what is done.
- [Reasoning](/docs/ai-elements/reasoning/) — The agent's thinking as it streams.
- [Sources](/docs/ai-elements/sources/) — The links the agent used for a reply.
- [Stack Trace](/docs/ai-elements/stack-trace/) — A failed tool call and its stack frames.
- [Subagent](/docs/ai-elements/subagent/) — A subagent run, with its tool calls and result.
- [Suggestion](/docs/ai-elements/suggestion/) — A short prompt you can send to the agent in one click.
- [Task](/docs/ai-elements/task/) — The steps the agent takes, as it takes them.
- [Terminal](/docs/ai-elements/terminal/) — A command the agent runs, with its output as it streams.
- [Test Results](/docs/ai-elements/test-results/) — A test run by the agent, with its suites and failures.
- [Tool](/docs/ai-elements/tool/) — A tool call the agent makes, from input to output.
## Migrating from AI SDK Elements
If you used AI SDK Elements from [elements.ai-sdk.dev](https://elements.ai-sdk.dev), here is what changes.
### Existing projects
You do not need to migrate. When you installed components from elements.ai-sdk.dev, the code was copied into your project. It is yours, and it keeps working as is.
### What replaces each element
| AI SDK Elements | Solid UI |
| ---------------------- | ------------------------------------------------------- |
| `agent.tsx` | [Subagent](/docs/ai-elements/subagent/) |
| `attachments.tsx` | [Attachment](/docs/components/attachment/) |
| `chain-of-thought.tsx` | [Chain of Thought](/docs/ai-elements/chain-of-thought/) |
| `checkpoint.tsx` | [Checkpoint](/docs/ai-elements/checkpoint/) |
| `code-block.tsx` | [Code Block](/docs/components/code-block/) |
| `commit.tsx` | [Trace](/docs/components/trace/#commit) |
| `confirmation.tsx` | [Confirmation](/docs/ai-elements/confirmation/) |
| `context.tsx` | [Context](/docs/ai-elements/context/) |
| `conversation.tsx` | [Chat](/docs/ai-elements/chat/) |
| `file-tree.tsx` | [File Tree](/docs/ai-elements/file-tree/) |
| `inline-citation.tsx` | [Inline Citation](/docs/ai-elements/inline-citation/) |
| `message.tsx` | [Message](/docs/ai-elements/message/) |
| `model-selector.tsx` | [Model Selector](/docs/ai-elements/model-selector/) |
| `plan.tsx` | [Plan](/docs/ai-elements/plan/) |
| `prompt-input.tsx` | [Prompt Input](/docs/ai-elements/prompt-input/) |
| `question.tsx` | [Questionnaire](/docs/components/questionnaire/) |
| `queue.tsx` | [Queue](/docs/ai-elements/queue/) |
| `reasoning.tsx` | [Reasoning](/docs/ai-elements/reasoning/) |
| `sources.tsx` | [Sources](/docs/ai-elements/sources/) |
| `stack-trace.tsx` | [Stack Trace](/docs/ai-elements/stack-trace/) |
| `suggestion.tsx` | [Suggestion](/docs/ai-elements/suggestion/) |
| `task.tsx` | [Task](/docs/ai-elements/task/) |
| `terminal.tsx` | [Terminal](/docs/ai-elements/terminal/) |
| `test-results.tsx` | [Test Results](/docs/ai-elements/test-results/) |
| `tool.tsx` | [Tool](/docs/ai-elements/tool/) |
# Vite
Source: https://www.solid-ui.com/docs/installation/vite.md
> Install and configure Solid UI for Vite.
Choose the setup that matches your starting point.
New Project
Create a Solid 2 app with Tailwind CSS and set up Solid UI.
Existing Project
Add Solid UI to a Solid 2 app you already created.
## New Project
### Create Project
Create a Solid 2 app with `create-solid`:
```bash
npm create solid@latest
```
Choose Solid 2.0, TypeScript and the `with-tailwindcss` template when it asks:
```txt
◇ What type of project would you like to create?
│ Solid 2.0
│
◇ Use Typescript?
│ Yes
│
◇ Which template would you like to use?
│ with-tailwindcss
```
### Run the CLI
Run `init` in the project folder. It installs the project's dependencies with the package manager you run it with, so you can skip the install step `create-solid` suggests.
```bash
npx solidui-cli@latest init
```
To start from a preset you built on the [Create](/create) page, pass its code with `--preset`.
### Add Components
Add the `Card` component to your project:
```bash
npx solidui-cli@latest add card
```
The command above adds the `Card` component to your project. You can then import it like this:
```tsx title="src/routes/index.tsx"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle
} from "~/components/ui/card"
export default function Home() {
return (
Project Overview
Track progress and recent activity for your Vite app.
Your design system is ready. Start building your next component.
)
}
```
## Existing Project
### Open Your Project
Open a terminal in the root of your Solid 2 app. Solid UI needs Vite with `@solidjs/vite-plugin` and TypeScript.
### Add Tailwind CSS
If your project already has Tailwind CSS configured, skip this step.
```bash
npm install tailwindcss @tailwindcss/vite
```
Add the Tailwind CSS plugin to `vite.config.ts`:
```ts title="vite.config.ts"
import solid from "@solidjs/vite-plugin"
import tailwindcss from "@tailwindcss/vite"
import { defineConfig } from "vite"
export default defineConfig({
plugins: [solid(), tailwindcss()]
})
```
Import Tailwind CSS at the top of your app stylesheet, for example `src/App.css`:
```css title="src/App.css"
@import "tailwindcss";
```
### Run the CLI
Run `init` to set up Solid UI in your project:
```bash
npx solidui-cli@latest init
```
It adds the `~/*` alias to `tsconfig.json` and `resolve.tsconfigPaths` to `vite.config.ts`, so Vite resolves the component imports. If Vite still can't, see [Fix unresolved imports](/docs/cli/#fix-unresolved-imports).
### Add Components
Add the `Card` component to your project:
```bash
npx solidui-cli@latest add card
```
The command above adds the `Card` component to your project. You can then import it like this:
```tsx title="src/App.tsx"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle
} from "~/components/ui/card"
export default function App() {
return (
Project Overview
Track progress and recent activity for your Vite app.
Your design system is ready. Start building your next component.
)
}
```
# Accordion
Source: https://www.solid-ui.com/docs/components/accordion.md
> A vertically stacked set of interactive headings that each reveal a section of content.
[Example: accordion-demo]
## Installation
Command
Manual
```bash
npx solidui-cli@latest add accordion
```
Install the following dependencies:
```bash
npm install @ui-sdk/solid @ui-sdk/core
```
Copy and paste the following code into your project.
[Source: components/ui/accordion.tsx]
Update the import paths to match your project setup.
## Usage
```tsx showLineNumbers
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger
} from "~/components/ui/accordion"
```
```tsx showLineNumbers
Is it accessible?
Yes. It adheres to the WAI-ARIA design pattern.
```
## Composition
Use the following composition to build an `Accordion`:
```text
Accordion
├── AccordionItem
│ ├── AccordionTrigger
│ └── AccordionContent
└── AccordionItem
├── AccordionTrigger
└── AccordionContent
```
## Basic
A basic accordion that shows one item at a time. The first item is open by default.
[Example: accordion-basic]
## Multiple
Use the `multiple` prop to allow multiple items to be open at the same time.
[Example: accordion-multiple]
## Disabled
Use the `disabled` prop on `AccordionItem` to disable individual items.
[Example: accordion-disabled]
## Borders
Add `border` to the `Accordion` and `border-b last:border-b-0` to the `AccordionItem` to add borders to the items.
[Example: accordion-borders]
## Card
Wrap the `Accordion` in a `Card` component.
[Example: accordion-card]
## API Reference
| Part | Description |
| ------------------ | ------------------------------------------------ |
| `Accordion` | Root container that manages expanded state. |
| `AccordionItem` | Individual collapsible section in the accordion. |
| `AccordionTrigger` | Interactive header button for an item. |
| `AccordionContent` | Expandable panel content for the active item. |
# Alert
Source: https://www.solid-ui.com/docs/components/alert.md
> Displays a callout for user attention.
[Example: alert-demo]
## Installation
Command
Manual
```bash
npx solidui-cli@latest add alert
```
Install the following dependencies:
```bash
npm install class-variance-authority
```
Copy and paste the following code into your project.
[Source: components/ui/alert.tsx]
Update the import paths to match your project setup.
## Usage
```tsx
import {
Alert,
AlertAction,
AlertDescription,
AlertTitle
} from "~/components/ui/alert"
```
```tsx showLineNumbers
Heads up!
You can add components and dependencies to your app using the cli.
```
## Composition
Use the following composition to build an `Alert`:
```text
Alert
├── Icon
├── AlertTitle
├── AlertDescription
└── AlertAction
```
## Basic
A basic alert with an icon, title and description.
[Example: alert-basic]
## Destructive
Use `variant="destructive"` to create a destructive alert.
[Example: alert-destructive]
## Action
Use `AlertAction` to add a button or other action element to the alert.
[Example: alert-action]
## Custom Colors
You can customize the alert colors by adding custom classes such as `bg-amber-50 dark:bg-amber-950` to the `Alert` component.
[Example: alert-colors]
## API Reference
### Alert
The `Alert` component displays a callout for user attention.
| Prop | Type | Default |
| --------- | ---------------------------- | ----------- |
| `variant` | `"default" \| "destructive"` | `"default"` |
### AlertTitle
The `AlertTitle` component displays the title of the alert.
| Prop | Type | Default |
| ------- | -------- | ------- |
| `class` | `string` | - |
### AlertDescription
The `AlertDescription` component displays the description or content of the alert.
| Prop | Type | Default |
| ------- | -------- | ------- |
| `class` | `string` | - |
### AlertAction
The `AlertAction` component displays an action element (like a button) positioned absolutely in the top-right corner of the alert.
| Prop | Type | Default |
| ------- | -------- | ------- |
| `class` | `string` | - |
# Alert Dialog
Source: https://www.solid-ui.com/docs/components/alert-dialog.md
> A modal dialog that interrupts the user with important content and expects a response.
[Example: alert-dialog-demo]
## Installation
Command
Manual
```bash
npx solidui-cli@latest add alert-dialog
```
Install the following dependencies:
```bash
npm install @ui-sdk/solid @ui-sdk/core
```
Install the required Solid UI dependencies:
```bash
npx solidui-cli@latest add button
```
Copy and paste the following code into your project.
[Source: components/ui/alert-dialog.tsx]
Update the import paths to match your project setup.
## Usage
```tsx showLineNumbers
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger
} from "~/components/ui/alert-dialog"
```
```tsx showLineNumbers
Show Dialog
Are you absolutely sure?
This action cannot be undone. This will permanently delete your account
from our servers.
Cancel
Continue
```
## Composition
Use the following composition to build an `AlertDialog`:
```text
AlertDialog
├── AlertDialogTrigger
└── AlertDialogContent
├── AlertDialogHeader
│ ├── AlertDialogMedia
│ ├── AlertDialogTitle
│ └── AlertDialogDescription
└── AlertDialogFooter
├── AlertDialogCancel
└── AlertDialogAction
```
## Basic
A basic alert dialog with a title, description, and cancel and continue buttons.
[Example: alert-dialog-basic]
## Small
Use the `size="sm"` prop to make the alert dialog smaller.
[Example: alert-dialog-small]
## Media
Use the `AlertDialogMedia` component to add a media element such as an icon or image to the alert dialog.
[Example: alert-dialog-media]
## Small with Media
Use the `size="sm"` prop to make the alert dialog smaller and the `AlertDialogMedia` component to add a media element such as an icon or image to the alert dialog.
[Example: alert-dialog-small-media]
## Destructive
Use the `AlertDialogAction` component to add a destructive action button to the alert dialog.
[Example: alert-dialog-destructive]
## API Reference
### size
Use the `size` props on the `AlertDialogContent` component to control the size of the alert dialog. It accepts the following values:
| Prop | Type | Default |
| ------ | ------------------- | ----------- |
| `size` | `"default" \| "sm"` | `"default"` |
See the [UI SDK](https://ui-sdk.dev/docs/solid/components/alert-dialog) documentation for more information.
# Aspect Ratio
Source: https://www.solid-ui.com/docs/components/aspect-ratio.md
> Displays content within a desired ratio.
[Example: aspect-ratio-demo]
## Installation
Command
Manual
```bash
npx solidui-cli@latest add aspect-ratio
```
Copy and paste the following code into your project.
[Source: components/ui/aspect-ratio.tsx]
Update the import paths to match your project setup.
## Usage
```tsx
import { AspectRatio } from "~/components/ui/aspect-ratio"
```
```tsx
```
## Square
A square aspect ratio component using the `ratio={1 / 1}` prop. This is useful for displaying images in a square format.
[Example: aspect-ratio-square]
## Portrait
A portrait aspect ratio component using the `ratio={9 / 16}` prop. This is useful for displaying images in a portrait format.
[Example: aspect-ratio-portrait]
## API Reference
### AspectRatio
The `AspectRatio` component displays content within a desired ratio.
| Prop | Type |
| ------- | -------- |
| `ratio` | `number` |
| `class` | `string` |
# Attachment
Source: https://www.solid-ui.com/docs/components/attachment.md
> Displays a file or image attachment with media, metadata, upload state, and actions.
[Example: attachment-demo]
The `Attachment` component displays a file or image attachment, its media, name, and metadata, with optional actions and upload state. Use it for files and images in chat composers, message threads, and upload lists.
## Installation
Command
Manual
```bash
npx solidui-cli@latest add attachment
```
Install the required Solid UI dependencies:
```bash
npx solidui-cli@latest add button
```
Copy and paste the following code into your project.
[Source: components/ui/attachment.tsx]
Update the import paths to match your project setup.
## Usage
```tsx
import {
Attachment,
AttachmentAction,
AttachmentActions,
AttachmentContent,
AttachmentDescription,
AttachmentMedia,
AttachmentTitle
} from "~/components/ui/attachment"
```
```tsx
sales-dashboard.pdf
PDF · 2.4 MB
Remove
```
## Composition
Use the following composition to build an attachment:
```text
Attachment
├── AttachmentMedia
├── AttachmentContent
│ ├── AttachmentTitle
│ └── AttachmentDescription
├── AttachmentActions
│ └── AttachmentAction
└── AttachmentTrigger
```
Use `AttachmentGroup` to lay out multiple attachments in a scrollable row:
```text
AttachmentGroup
├── Attachment
└── Attachment
```
## Features
- Icon and image media through `AttachmentMedia`
- Upload states: `idle`, `uploading`, `processing`, `error`, and `done` with built-in styling and a shimmer while in progress
- Three sizes and horizontal or vertical orientation
- A full-card `AttachmentTrigger` that opens a link or dialog while the actions stay independently clickable
- Scrollable, snapping `AttachmentGroup` with an edge fade
- Customizable styling through the `class` prop on every part
## Image
Set `variant="image"` on `AttachmentMedia` and render an `
` inside it. Use `orientation="vertical"` to stack the media above the content.
[Example: attachment-image]
## States
Set `state` to reflect the upload lifecycle. `uploading` and `processing` shimmer the title, and `error` switches to a destructive treatment.
[Example: attachment-states]
## Sizes
Use `size` to switch between `default`, `sm`, and `xs`.
[Example: attachment-sizes]
## Group
Wrap attachments in `AttachmentGroup` to lay them out in a horizontally scrollable, snapping row with an edge fade.
[Example: attachment-group]
## Trigger
Add an `AttachmentTrigger` to make the whole card open a link or dialog. It fills the card behind the actions, so the actions stay clickable.
[Example: attachment-trigger]
```tsx showLineNumbers
```
## Accessibility
`AttachmentAction` renders a `Button`, and `AttachmentTrigger` renders a real `