# Changelog
Notable changes to the shadcn-cssinjs registry.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## June 2026 [#june-2026]
### Full shadcn/ui parity [#full-shadcnui-parity]
The registry now mirrors the complete shadcn/ui component set — **51 components**.
New additions:
* **Overlays & menus** — `alert-dialog`, `hover-card`, `menubar`,
`navigation-menu`, `select`.
* **Forms** — `checkbox`, `radio-group`, `switch`, `slider`, `toggle-group`,
`label`, `textarea`, `input-otp`.
* **Data & layout** — `avatar`, `breadcrumb`, `button-group`, `pagination`,
`progress`, `scroll-area`, `table`, `spinner`.
* **Heavy-dependency components** — `calendar` (react-day-picker), `carousel`
(embla), `chart` (recharts), `resizable` (react-resizable-panels), `sonner`.
* **Compositions** — `date-picker`, `combobox`, and `data-table` docs showing how
to assemble the primitives.
### RTL support [#rtl-support]
Every component now uses logical CSS properties and Base UI's `DirectionProvider`,
so they flip correctly in right-to-left layouts. See the [RTL guide](/docs/rtl) and
the RTL preview on each component page.
### Docs parity [#docs-parity]
Component pages were rebuilt to mirror the shadcn/ui base docs: live preview with
inline source, CLI/Manual installation tabs, usage, composition, RTL, and an API
reference link.
## Earlier [#earlier]
* Initial release: StyleX + Base UI port of the core shadcn/ui components, shared
`stylex-tokens`, and the theme customizer.
# Introduction
Copy-paste UI components for React. Styled with StyleX on Base UI, works with the shadcn CLI.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
**shadcn-cssinjs** provides beautifully designed, accessible, and customizable UI
components. Styled with [StyleX](https://stylexjs.com) on top of
[Base UI](https://base-ui.com) primitives, and designed to work seamlessly with the
[shadcn CLI](https://ui.shadcn.com).
## Philosophy [#philosophy]
shadcn-cssinjs follows the shadcn model for CSS-in-JS: copy-paste components you can own,
with zero lock-in and sensible defaults that work immediately.
Most shadcn setups assume Tailwind. That works well — until your team wants colocated,
type-safe styles that compile to atomic CSS at build time. shadcn-cssinjs takes a
different approach. It keeps the familiar component API, styles with StyleX instead of
utility classes, and builds on Base UI so you can drop down to the primitives whenever you
need more control.
The goal is simple: make StyleX-styled components feel like the rest of your stack —
composable, themeable, accessible, and easy to customize.
## Why shadcn-cssinjs? [#why-shadcn-cssinjs]
Most CSS-in-JS component setups are either too opinionated or too scattered.
shadcn-cssinjs is built for teams that want to ship quickly without giving up control:
* **Own Your Code:** Copy the components into your project and customize everything.
* **Start Fast:** Run one command and get production-ready defaults with StyleX and Base UI.
* **Scale Safely:** Stay close to StyleX and Base UI primitives, then drop to raw APIs when needed.
## Features [#features]
# Installation
Set up StyleX and Base UI, then install components from the shadcn-cssinjs registry.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
These components are styled with StyleX and built on Base UI. Before installing any
component, your project needs StyleX's build pipeline configured. Do this once, then add as
many components as you like with the `shadcn` CLI.
Already using shadcn/ui? You can drop these components alongside your existing
ones — they reuse the same CSS variables (`--background`, `--primary`, …) for
theming.
## Set up StyleX [#set-up-stylex]
Install the dependencies
```bash
pnpm add @stylexjs/stylex @base-ui/react
pnpm add -D @stylexjs/babel-plugin @stylexjs/postcss-plugin @babel/preset-typescript
```
Configure Babel
StyleX transforms your component source with a Babel plugin. Create a `.babelrc` at the
root of your project:
```json title=".babelrc"
{
"presets": ["next/babel", "@babel/preset-typescript"],
"plugins": [
[
"@stylexjs/babel-plugin",
{
"runtimeInjection": false,
"styleResolution": "property-specificity",
"unstable_moduleResolution": { "type": "commonJS", "rootDir": "." }
}
]
]
}
```
Adding a `.babelrc` opts Next.js out of Turbopack/SWC for compilation. Run
`next dev` and `next build` without the `--turbopack` flag so the Babel
pipeline (and therefore StyleX) runs.
Configure PostCSS
The PostCSS plugin extracts the compiled CSS. It must run **before** Tailwind, and its
options must match `.babelrc` so the class-name hashes line up.
```js title="postcss.config.mjs"
const config = {
plugins: {
"@stylexjs/postcss-plugin": {
include: ["app/**/*.{js,jsx,ts,tsx}", "components/**/*.{js,jsx,ts,tsx}"],
useCSSLayers: true,
styleResolution: "property-specificity",
runtimeInjection: false,
unstable_moduleResolution: { type: "commonJS", rootDir: process.cwd() },
},
"@tailwindcss/postcss": {},
},
};
export default config;
```
Add the StyleX directive
Add `@stylex;` to your global stylesheet. The PostCSS plugin replaces it with the compiled
component CSS.
```css title="app/globals.css"
@import "tailwindcss";
@stylex;
```
## Add the design tokens [#add-the-design-tokens]
Every component references a shared set of design tokens. Install them once:
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/stylex-tokens.json
```
This drops `components/ui/tokens.stylex.ts`, which maps your CSS variables to typed StyleX
tokens. You can edit it to point at different variables or add your own.
## Install a component [#install-a-component]
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/button.json
```
The component is copied into `components/ui//`. Import and use it:
```tsx
import { Button } from "@/components/ui/button/button";
export function Demo() {
return ;
}
```
Browse the [components](/docs/components) for the full list and per-component install
commands.
# MCP Server
Install components from this registry with your AI coding agent via the shadcn MCP server.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
The [shadcn MCP server](https://ui.shadcn.com/docs/mcp) lets AI coding agents browse
and install registry items for you. Point it at this registry and you can say
*"add the button and dialog components"* and the agent runs the install.
## Configure the registry [#configure-the-registry]
Add this registry to your project's `components.json` under `registries`:
```json title="components.json"
{
"registries": {
"@shadcn-cssinjs": "https://shadcn-cssinjs.com/r/{name}.json"
}
}
```
## Add the MCP server [#add-the-mcp-server]
Claude Code
Cursor
Run the shadcn MCP init command, or add the server manually:
```bash
npx shadcn@latest mcp init --client claude
```
Add the server to `.cursor/mcp.json`:
```json title=".cursor/mcp.json"
{
"mcpServers": {
"shadcn": {
"command": "npx",
"args": ["-y", "shadcn@latest", "mcp"]
}
}
}
```
## Use it [#use-it]
Once configured, prompt your agent naturally:
```txt
Show me the components available in the @shadcn-cssinjs registry.
Add the dialog and dropdown-menu components to my project.
```
The agent reads each item's JSON, installs npm dependencies, and writes the source
into `components/ui/` — the same result as running the CLI yourself.
The MCP server uses the registry config in `components.json`. Make sure the
`@shadcn-cssinjs` entry above is present before starting your agent.
# Registry
How this registry is structured and how to consume it with the shadcn CLI.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
This project is a [shadcn registry](https://ui.shadcn.com/docs/registry) — a
collection of components distributed as source code over HTTP. The `shadcn` CLI reads
a JSON descriptor for each item and copies the files straight into your project.
## Installing an item [#installing-an-item]
Point the CLI at any item's JSON URL:
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/button.json
```
The CLI resolves dependencies, installs npm packages, and writes the files to
`components/ui//`. You own the code from that point on.
## Registry structure [#registry-structure]
Each item is declared in `registry.json` and built into a static JSON file under
`public/r/`. A typical entry looks like this:
```json title="registry.json"
{
"name": "button",
"type": "registry:ui",
"dependencies": ["@base-ui/react", "@stylexjs/stylex"],
"files": [
{
"path": "registry/bases/stylex/ui/button.tsx",
"type": "registry:ui",
"target": "components/ui/button.tsx"
}
],
"registryDependencies": ["stylex-tokens", "stylex-utils"]
}
```
* **`dependencies`** — npm packages the CLI installs for you.
* **`registryDependencies`** — other items in this registry that get pulled in
automatically. Every component depends on `stylex-tokens`, which installs the
shared `tokens.stylex.ts`.
* **`files`** — each component ships its `.tsx` and `.stylex.ts` side by side.
## Shared tokens [#shared-tokens]
The `stylex-tokens` item is a `registry:lib` that installs
`components/ui/tokens.stylex.ts`. It is the single source of truth for theming and is a
`registryDependency` of nearly every component, so you rarely install it by hand. See
[Theming](/docs/theming) for details.
## Building the registry [#building-the-registry]
If you fork this project, regenerate the `public/r/*.json` files after editing
`registry.json`:
```bash
pnpm registry:build
```
Want to publish your own registry? Follow the official [registry
guide](https://ui.shadcn.com/docs/registry/getting-started) — the same `shadcn
build` pipeline powers this site.
# RTL
Enable right-to-left layouts for shadcn-cssinjs components.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
Every component in shadcn-cssinjs ships with right-to-left (RTL) support. The styles are
authored with **CSS logical properties** (`margin-inline-start`, `inset-inline-end`,
`text-align: start`, …) instead of physical ones, so spacing, borders and alignment flip
automatically when the text direction changes.
For interactive components that render in a portal (menus, popovers, tooltips, dialogs),
Base UI also needs to know the direction so keyboard navigation and positioning flip
correctly. You provide it with the `dir` attribute and a `DirectionProvider`.
## Set the direction [#set-the-direction]
Set `dir="rtl"` on an element — usually `` — and wrap your app in Base UI's
`DirectionProvider`. The `dir` attribute drives the CSS logical properties; the provider
makes portalled content (menus, popovers) inherit the same direction.
```tsx title="app/layout.tsx"
import { DirectionProvider } from "@base-ui/react/direction-provider";
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
{children}
);
}
```
The `direction` passed to `DirectionProvider` should match the `dir` attribute
on the DOM. Keep them in sync if you let users toggle direction at runtime.
## Scoping to a subtree [#scoping-to-a-subtree]
You don't have to flip the whole page. Set `dir` on any wrapper and add a
`DirectionProvider` around the same subtree to flip just that region:
```tsx
```
## How it works [#how-it-works]
* **Styling** flips through CSS logical properties. `padding-inline-start`,
`border-inline-start`, `inset-inline-end` and `text-align: start` resolve against the
nearest `dir`, so no JavaScript is involved for layout.
* **Behavior** flips through Base UI's `DirectionProvider`. Arrow-key navigation in menus,
the side a submenu or popover opens toward, and slide animations all read the provided
direction.
Throughout the component docs, the **RTL** section shows each component rendered with
`dir="rtl"` so you can verify the result.
# Theming
Theme the StyleX components with CSS variables, exactly like shadcn/ui.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
Every component in this registry is themed with **CSS variables** — the same
`--background`, `--primary`, `--ring` … tokens that shadcn/ui uses. Nothing is
hard-coded. If you already have a shadcn/ui theme, these components adopt it with
zero changes.
## How it works [#how-it-works]
StyleX rules never reference raw colors. Instead each component reads from a shared
token file that maps your CSS variables into typed StyleX tokens:
```ts title="components/ui/tokens.stylex.ts"
import * as stylex from "@stylexjs/stylex";
export const colors = stylex.defineVars({
background: "var(--background)",
foreground: "var(--foreground)",
primary: "var(--primary)",
primaryForeground: "var(--primary-foreground)",
border: "var(--border)",
ring: "var(--ring)",
// …
});
```
Because the tokens resolve to `var(--…)`, the actual values are whatever your
stylesheet defines. Change the variable, and every component updates.
## Defining the variables [#defining-the-variables]
Define your light and dark palettes in your global stylesheet. Dark mode is driven by
a `.dark` class on the document (e.g. via `next-themes`), exactly like stock shadcn/ui.
```css title="app/globals.css"
:root {
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
--primary: oklch(0.205 0 0);
--primary-foreground: oklch(0.985 0 0);
--border: oklch(0.922 0 0);
--ring: oklch(0.708 0 0);
--radius: 0.625rem;
}
.dark {
--background: oklch(0.145 0 0);
--foreground: oklch(0.985 0 0);
--primary: oklch(0.985 0 0);
--primary-foreground: oklch(0.205 0 0);
--border: oklch(1 0 0 / 10%);
--ring: oklch(0.556 0 0);
}
```
Copy the full variable set from the [shadcn/ui theming
docs](https://ui.shadcn.com/docs/theming) — this registry uses the identical
variable names, so any shadcn/ui theme, generator, or `tweakcn` export works
as-is.
## Radius [#radius]
Components read `--radius` for their corner rounding. Set it once and the whole set
scales:
```css
:root {
--radius: 0.5rem; /* try 0rem for sharp, 1rem for round */
}
```
## Adding your own tokens [#adding-your-own-tokens]
`tokens.stylex.ts` is yours after install — add tokens for any extra variables you
use, then reference them from a component's `.stylex.ts` file:
```ts
import { colors } from "@/components/ui/tokens.stylex";
export const styles = stylex.create({
base: { backgroundColor: colors.primary, color: colors.primaryForeground },
});
```
# Accordion
A vertically stacked set of interactive headings that each reveal a section of content.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/accordion.json
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#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 [#composition]
Use the following composition to build an `Accordion`:
```text
Accordion
├── AccordionItem
│ ├── AccordionTrigger
│ └── AccordionContent
└── AccordionItem
├── AccordionTrigger
└── AccordionContent
```
## Basic [#basic]
A basic accordion that shows one item at a time. The first item is open by default.
## Multiple [#multiple]
Use the `multiple` prop to allow multiple items to be open at the same time.
## Disabled [#disabled]
Use the `disabled` prop on `AccordionItem` to disable individual items.
## Borders [#borders]
Add `border` to the `Accordion` and `border-b last:border-b-0` to the `AccordionItem` to add borders to the items.
## Card [#card]
Wrap the `Accordion` in a `Card` component.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
See the [Base UI](https://base-ui.com/react/components/accordion#api-reference) documentation for more information.
# Alert Dialog
A modal dialog that interrupts the user with important content and expects a response.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/alert-dialog.json
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#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.
CancelContinue
```
## Composition [#composition]
Use the following composition to build an `AlertDialog`:
```text
AlertDialog
├── AlertDialogTrigger
└── AlertDialogContent
├── AlertDialogHeader
│ ├── AlertDialogMedia
│ ├── AlertDialogTitle
│ └── AlertDialogDescription
└── AlertDialogFooter
├── AlertDialogCancel
└── AlertDialogAction
```
## Basic [#basic]
A basic alert dialog with a title, description, and cancel and continue buttons.
## Small [#small]
Use the `size="sm"` prop to make the alert dialog smaller.
## Media [#media]
Use the `AlertDialogMedia` component to add a media element such as an icon or image to the alert dialog.
## Small with 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.
## Destructive [#destructive]
Use the `AlertDialogAction` component to add a destructive action button to the alert dialog.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
### size [#size]
Use the `size` prop on the `AlertDialogContent` component to control the size of the alert dialog. It accepts the following values:
| Prop | Type | Default |
| ------ | ------------------- | ----------- |
| `size` | `"default" \| "sm"` | `"default"` |
For more information about the other components and their props, see the [Base UI documentation](https://base-ui.com/react/components/alert-dialog#api-reference).
# Alert
Displays a callout for user attention.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/alert.json
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx showLineNumbers
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 [#composition]
Use the following composition to build an `Alert`:
```text
Alert
├── Icon
├── AlertTitle
├── AlertDescription
└── AlertAction
```
## Basic [#basic]
A basic alert with an icon, title and description.
## Destructive [#destructive]
Use `variant="destructive"` to create a destructive alert.
## Action [#action]
Use `AlertAction` to add a button or other action element to the alert.
## Custom Colors [#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.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
### Alert [#alert]
The `Alert` component displays a callout for user attention.
| Prop | Type | Default |
| --------- | ---------------------------- | ----------- |
| `variant` | `"default" \| "destructive"` | `"default"` |
### AlertTitle [#alerttitle]
The `AlertTitle` component displays the title of the alert.
| Prop | Type | Default |
| ----------- | -------- | ------- |
| `className` | `string` | - |
### AlertDescription [#alertdescription]
The `AlertDescription` component displays the description or content of the alert.
| Prop | Type | Default |
| ----------- | -------- | ------- |
| `className` | `string` | - |
### AlertAction [#alertaction]
The `AlertAction` component displays an action element (like a button) positioned absolutely in the top-right corner of the alert.
| Prop | Type | Default |
| ----------- | -------- | ------- |
| `className` | `string` | - |
# Aspect Ratio
Displays content within a desired ratio.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/aspect-ratio.json
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx showLineNumbers
import { AspectRatio } from "@/components/ui/aspect-ratio";
```
```tsx showLineNumbers
```
## Square [#square]
A square aspect ratio component using the `ratio={1 / 1}` prop. This is useful for displaying images in a square format.
## Portrait [#portrait]
A portrait aspect ratio component using the `ratio={9 / 16}` prop. This is useful for displaying images in a portrait format.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
### AspectRatio [#aspectratio]
The `AspectRatio` component displays content within a desired ratio.
| Prop | Type | Default | Required |
| ----------- | -------- | ------- | -------- |
| `ratio` | `number` | - | Yes |
| `className` | `string` | - | No |
For more information, see the [Base UI documentation](https://base-ui.com/react/components/aspect-ratio#api-reference).
# Avatar
An image element with a fallback for representing the user.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/avatar.json
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx showLineNumbers
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
```
```tsx showLineNumbers
CN
```
## Composition [#composition]
Use the following composition to build an `Avatar`:
```text
Avatar
├── AvatarImage
├── AvatarFallback
└── AvatarBadge
```
Use the following composition to build an `AvatarGroup`:
```text
AvatarGroup
├── Avatar
│ ├── AvatarImage
│ ├── AvatarFallback
│ └── AvatarBadge
├── Avatar
│ ├── AvatarImage
│ ├── AvatarFallback
│ └── AvatarBadge
└── AvatarGroupCount
```
## Basic [#basic]
A basic avatar component with an image and a fallback.
## Badge [#badge]
Use the `AvatarBadge` component to add a badge to the avatar. The badge is positioned at the bottom right of the avatar.
Use the `className` prop to add custom styles to the badge such as custom colors, sizes, etc.
```tsx showLineNumbers
CN
```
## Badge with Icon [#badge-with-icon]
You can also use an icon inside ``.
## Avatar Group [#avatar-group]
Use the `AvatarGroup` component to add a group of avatars.
## Avatar Group Count [#avatar-group-count]
Use `` to add a count to the group.
## Avatar Group with Icon [#avatar-group-with-icon]
You can also use an icon inside ``.
## Sizes [#sizes]
Use the `size` prop to change the size of the avatar.
## Dropdown [#dropdown]
You can use the `Avatar` component as a trigger for a dropdown menu.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
### Avatar [#avatar]
The `Avatar` component is the root component that wraps the avatar image and fallback.
| Prop | Type | Default |
| ----------- | --------------------------- | ----------- |
| `size` | `"default" \| "sm" \| "lg"` | `"default"` |
| `className` | `string` | - |
### AvatarImage [#avatarimage]
The `AvatarImage` component displays the avatar image. It accepts all Base UI Avatar Image props.
| Prop | Type | Default |
| ----------- | -------- | ------- |
| `src` | `string` | - |
| `alt` | `string` | - |
| `className` | `string` | - |
### AvatarFallback [#avatarfallback]
The `AvatarFallback` component displays a fallback when the image fails to load. It accepts all Base UI Avatar Fallback props.
| Prop | Type | Default |
| ----------- | -------- | ------- |
| `className` | `string` | - |
### AvatarBadge [#avatarbadge]
The `AvatarBadge` component displays a badge indicator on the avatar, typically positioned at the bottom right.
| Prop | Type | Default |
| ----------- | -------- | ------- |
| `className` | `string` | - |
### AvatarGroup [#avatargroup]
The `AvatarGroup` component displays a group of avatars with overlapping styling.
| Prop | Type | Default |
| ----------- | -------- | ------- |
| `className` | `string` | - |
### AvatarGroupCount [#avatargroupcount]
The `AvatarGroupCount` component displays a count indicator in an avatar group, typically showing the number of additional avatars.
| Prop | Type | Default |
| ----------- | -------- | ------- |
| `className` | `string` | - |
For more information about Base UI Avatar props, see the [Base UI documentation](https://base-ui.com/react/components/avatar#api-reference).
# Badge
Displays a badge or a component that looks like a badge.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/badge.json
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx
import { Badge } from "@/components/ui/badge";
```
```tsx
Badge
```
## Variants [#variants]
Use the `variant` prop to change the variant of the badge.
## With Icon [#with-icon]
You can render an icon inside the badge. Use `data-icon="inline-start"` to render the icon on the left and `data-icon="inline-end"` to render the icon on the right.
## With Spinner [#with-spinner]
You can render a spinner inside the badge. Remember to add the `data-icon="inline-start"` or `data-icon="inline-end"` prop to the spinner.
## Link [#link]
Use the `render` prop to render a link as a badge.
## Custom Colors [#custom-colors]
You can customize the colors of a badge by adding custom classes such as `bg-green-50 dark:bg-green-800` to the `Badge` component.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
### Badge [#badge]
The `Badge` component displays a badge or a component that looks like a badge.
| Prop | Type | Default |
| ----------- | ----------------------------------------------------------------------------- | ----------- |
| `variant` | `"default" \| "secondary" \| "destructive" \| "outline" \| "ghost" \| "link"` | `"default"` |
| `className` | `string` | - |
# Breadcrumb
Displays the path to the current resource using a hierarchy of links.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/breadcrumb.json
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx showLineNumbers
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/components/ui/breadcrumb";
```
```tsx showLineNumbers
}>Home
}>
Components
Breadcrumb
```
## Composition [#composition]
Use the following composition to build a `Breadcrumb`:
```text
Breadcrumb
└── BreadcrumbList
├── BreadcrumbItem
│ └── BreadcrumbLink
├── BreadcrumbSeparator
├── BreadcrumbItem
│ └── BreadcrumbLink
├── BreadcrumbSeparator
└── BreadcrumbItem
└── BreadcrumbPage
```
## Basic [#basic]
A basic breadcrumb with a home link and a components link.
## Custom separator [#custom-separator]
Use a custom component as `children` for `` to create a custom separator.
## Dropdown [#dropdown]
You can compose `` with a `` to create a dropdown in the breadcrumb.
## Collapsed [#collapsed]
We provide a `` component to show a collapsed state when the breadcrumb is too long.
## Link component [#link-component]
To use a custom link component from your routing library, you can use the `render` prop on ``.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
### Breadcrumb [#breadcrumb]
The `Breadcrumb` component is the root navigation element that wraps all breadcrumb components.
| Prop | Type | Default |
| ----------- | -------- | ------- |
| `className` | `string` | - |
### BreadcrumbList [#breadcrumblist]
The `BreadcrumbList` component displays the ordered list of breadcrumb items.
| Prop | Type | Default |
| ----------- | -------- | ------- |
| `className` | `string` | - |
### BreadcrumbItem [#breadcrumbitem]
The `BreadcrumbItem` component wraps individual breadcrumb items.
| Prop | Type | Default |
| ----------- | -------- | ------- |
| `className` | `string` | - |
### BreadcrumbLink [#breadcrumblink]
The `BreadcrumbLink` component displays a clickable link in the breadcrumb.
| Prop | Type | Default |
| ----------- | -------- | ------- |
| `className` | `string` | - |
### BreadcrumbPage [#breadcrumbpage]
The `BreadcrumbPage` component displays the current page in the breadcrumb (non-clickable).
| Prop | Type | Default |
| ----------- | -------- | ------- |
| `className` | `string` | - |
### BreadcrumbSeparator [#breadcrumbseparator]
The `BreadcrumbSeparator` component displays a separator between breadcrumb items. You can pass custom children to override the default separator icon.
| Prop | Type | Default |
| ----------- | ----------------- | ------- |
| `children` | `React.ReactNode` | - |
| `className` | `string` | - |
### BreadcrumbEllipsis [#breadcrumbellipsis]
The `BreadcrumbEllipsis` component displays an ellipsis indicator for collapsed breadcrumb items.
| Prop | Type | Default |
| ----------- | -------- | ------- |
| `className` | `string` | - |
# Button Group
A container that groups related buttons together with consistent styling.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/button-group.json
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx
import {
ButtonGroup,
ButtonGroupSeparator,
ButtonGroupText,
} from "@/components/ui/button-group";
```
```tsx
```
## Composition [#composition]
Use the following composition to build a `ButtonGroup`:
```text
ButtonGroup
├── Button or Input
├── ButtonGroupSeparator
└── ButtonGroupText
```
## Accessibility [#accessibility]
* The `ButtonGroup` component has the `role` attribute set to `group`.
* Use Tab to navigate between the buttons in the group.
* Use `aria-label` or `aria-labelledby` to label the button group.
```tsx showLineNumbers
```
## ButtonGroup vs ToggleGroup [#buttongroup-vs-togglegroup]
* Use the `ButtonGroup` component when you want to group buttons that perform an action.
* Use the `ToggleGroup` component when you want to group buttons that toggle a state.
## Orientation [#orientation]
Set the `orientation` prop to change the button group layout.
## Size [#size]
Control the size of buttons using the `size` prop on individual buttons.
## Nested [#nested]
Nest `` components to create button groups with spacing.
## Separator [#separator]
The `ButtonGroupSeparator` component visually divides buttons within a group.
Buttons with variant `outline` do not need a separator since they have a border. For other variants, a separator is recommended to improve the visual hierarchy.
## Split [#split]
Create a split button group by adding two buttons separated by a `ButtonGroupSeparator`.
## Input [#input]
Wrap an `Input` component with buttons.
## Input Group [#input-group]
Wrap an `InputGroup` component to create complex input layouts.
## Dropdown Menu [#dropdown-menu]
Create a split button group with a `DropdownMenu` component.
## Select [#select]
Pair with a `Select` component.
## Popover [#popover]
Use with a `Popover` component.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
### ButtonGroup [#buttongroup]
The `ButtonGroup` component is a container that groups related buttons together with consistent styling.
| Prop | Type | Default |
| ------------- | ---------------------------- | -------------- |
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` |
```tsx
```
Nest multiple button groups to create complex layouts with spacing. See the [nested](#nested) example for more details.
```tsx
```
### ButtonGroupSeparator [#buttongroupseparator]
The `ButtonGroupSeparator` component visually divides buttons within a group.
| Prop | Type | Default |
| ------------- | ---------------------------- | ------------ |
| `orientation` | `"horizontal" \| "vertical"` | `"vertical"` |
```tsx
```
### ButtonGroupText [#buttongrouptext]
Use this component to display text within a button group.
| Prop | Type | Default |
| -------- | -------------------- | ------- |
| `render` | `React.ReactElement` | |
```tsx
Text
```
Use the `render` prop to render a custom component as the text, for example a label.
```tsx showLineNumbers
import { ButtonGroupText } from "@/components/ui/button-group";
import { Label } from "@/components/ui/label";
export function ButtonGroupTextDemo() {
return (
}>Text
);
}
```
# Button
Displays a button or a component that looks like a button.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/button.json
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx
import { Button } from "@/components/ui/button";
```
```tsx
```
## Size [#size]
Use the `size` prop to change the size of the button.
## Default [#default]
## Outline [#outline]
## Secondary [#secondary]
## Ghost [#ghost]
## Destructive [#destructive]
## Link [#link]
## Icon [#icon]
## With Icon [#with-icon]
Remember to add the `data-icon="inline-start"` or `data-icon="inline-end"` attribute to the icon for the correct spacing.
## Rounded [#rounded]
Use the `className` prop to make the button rounded.
## Spinner [#spinner]
Render a `` component inside the button to show a loading state. Remember to add the `data-icon="inline-start"` or `data-icon="inline-end"` attribute to the spinner for the correct spacing.
## Button Group [#button-group]
To create a button group, use the `ButtonGroup` component. See the [Button Group](/docs/components/base/button-group) documentation for more details.
## As Link [#as-link]
You can use the `buttonVariants` helper to make a link look like a button.
**Do not use `} nativeButton={false} />` for links.** The Base UI `Button` component always applies `role="button"`, which overrides the semantic link role on `` elements. Use `buttonVariants` with a plain `` tag instead.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
### Button [#button]
The `Button` component is a wrapper around the `button` element that adds a variety of styles and functionality.
| Prop | Type | Default |
| --------- | ------------------------------------------------------------------------------------ | ----------- |
| `variant` | `"default" \| "outline" \| "ghost" \| "destructive" \| "secondary" \| "link"` | `"default"` |
| `size` | `"default" \| "xs" \| "sm" \| "lg" \| "icon" \| "icon-xs" \| "icon-sm" \| "icon-lg"` | `"default"` |
# Calendar
A calendar component that allows users to select a date or a range of dates.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/calendar.json
```
Install the following dependencies:
```bash
npm install react-day-picker date-fns
```
Add the
`Button`
component to your project.
The `Calendar` component uses the `Button` component. Make sure you have it installed in your project.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx showLineNumbers
import { Calendar } from "@/components/ui/calendar";
```
```tsx showLineNumbers
const [date, setDate] = React.useState(new Date());
return (
);
```
See the [React DayPicker](https://react-day-picker.js.org) documentation for more information.
## About [#about]
The `Calendar` component is built on top of [React DayPicker](https://react-day-picker.js.org).
## Date Picker [#date-picker]
You can use the `` component to build a date picker. See the [Date Picker](/docs/components/base/date-picker) page for more information.
## Persian / Hijri / Jalali Calendar [#persian--hijri--jalali-calendar]
To use the Persian calendar, edit `components/ui/calendar.tsx` and replace `react-day-picker` with `react-day-picker/persian`.
```diff
- import { DayPicker } from "react-day-picker"
+ import { DayPicker } from "react-day-picker/persian"
```
## Selected Date (With TimeZone) [#selected-date-with-timezone]
The Calendar component accepts a `timeZone` prop to ensure dates are displayed and selected in the user's local timezone.
```tsx showLineNumbers
export function CalendarWithTimezone() {
const [date, setDate] = React.useState(undefined);
const [timeZone, setTimeZone] = React.useState(undefined);
React.useEffect(() => {
setTimeZone(Intl.DateTimeFormat().resolvedOptions().timeZone);
}, []);
return (
);
}
```
**Note:** If you notice a selected date offset (for example, selecting the 20th highlights the 19th), make sure the `timeZone` prop is set to the user's local timezone.
**Why client-side?** The timezone is detected using `Intl.DateTimeFormat().resolvedOptions().timeZone` inside a `useEffect` to ensure compatibility with server-side rendering. Detecting the timezone during render would cause hydration mismatches, as the server and client may be in different timezones.
## Basic [#basic]
A basic calendar component. We used `className="rounded-lg border"` to style the calendar.
## Range Calendar [#range-calendar]
Use the `mode="range"` prop to enable range selection.
## Month and Year Selector [#month-and-year-selector]
Use `captionLayout="dropdown"` to show month and year dropdowns.
## Presets [#presets]
## Date and Time Picker [#date-and-time-picker]
## Booked dates [#booked-dates]
## Custom Cell Size [#custom-cell-size]
You can customize the size of calendar cells using the `--cell-size` CSS variable. You can also make it responsive by using breakpoint-specific values:
```tsx showLineNumbers
```
Or use fixed values:
```tsx showLineNumbers
```
## Week Numbers [#week-numbers]
Use `showWeekNumber` to show week numbers.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
See also the [Hijri Guide](#persian--hijri--jalali-calendar) for enabling the Persian / Hijri / Jalali calendar.
When using RTL, import the locale from `react-day-picker/locale` and pass both the `locale` and `dir` props to the Calendar component:
```tsx showLineNumbers
import { arSA } from "react-day-picker/locale";
;
```
## API Reference [#api-reference]
See the [React DayPicker](https://react-day-picker.js.org) documentation for more information on the `Calendar` component.
# Card
Displays a card with header, content, and footer.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/card.json
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx showLineNumbers
import {
Card,
CardAction,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card";
```
```tsx showLineNumbers
Card TitleCard DescriptionCard Action
```
## Composition [#composition]
Use the following composition to build a `RadioGroup`:
```text
RadioGroup
├── RadioGroupItem
└── RadioGroupItem
```
## Description [#description]
Radio group items with a description using the `Field` component.
## Choice Card [#choice-card]
Use `FieldLabel` to wrap the entire `Field` for a clickable card-style selection.
## Fieldset [#fieldset]
Use `FieldSet` and `FieldLegend` to group radio items with a label and description.
## Disabled [#disabled]
Use the `disabled` prop on `RadioGroup` to disable all items.
## Invalid [#invalid]
Use `aria-invalid` on `RadioGroupItem` and `data-invalid` on `Field` to show validation errors.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
See the [Base UI Radio Group](https://base-ui.com/react/components/radio-group#api-reference) documentation.
# Resizable
Accessible resizable panel groups and layouts with keyboard support.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## About [#about]
The `Resizable` component is built on top of [react-resizable-panels](https://github.com/bvaughn/react-resizable-panels) by [bvaughn](https://github.com/bvaughn).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/resizable.json
```
Install the following dependencies:
```bash
npm install react-resizable-panels
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx showLineNumbers
import {
ResizableHandle,
ResizablePanel,
ResizablePanelGroup,
} from "@/components/ui/resizable";
```
```tsx showLineNumbers
OneTwo
```
## Composition [#composition]
Use the following composition to build a `ResizablePanelGroup`:
```text
ResizablePanelGroup
├── ResizablePanel
├── ResizableHandle
└── ResizablePanel
```
## Vertical [#vertical]
Use `orientation="vertical"` for vertical resizing.
## Handle [#handle]
Use the `withHandle` prop on `ResizableHandle` to show a visible handle.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
See the [react-resizable-panels](https://github.com/bvaughn/react-resizable-panels/tree/main/packages/react-resizable-panels) documentation.
# Scroll Area
Augments native scroll functionality for custom, cross-browser styling.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/scroll-area.json
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx showLineNumbers
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
```
```tsx showLineNumbers
Your scrollable content here.
```
## Composition [#composition]
Use the following composition to build a `ScrollArea`:
```text
ScrollArea
└── ScrollBar
```
## Horizontal [#horizontal]
Use `ScrollBar` with `orientation="horizontal"` for horizontal scrolling.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
See the [Base UI Scroll Area](https://base-ui.com/react/components/scroll-area#api-reference) documentation.
# Select
Displays a list of options for the user to pick from—triggered by a button.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/select.json
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx showLineNumbers
import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
```
```tsx showLineNumbers
const items = [
{ label: "Light", value: "light" },
{ label: "Dark", value: "dark" },
{ label: "System", value: "system" },
]
```
## Composition [#composition]
Use the following composition to build a `Select`:
```text
Select
├── SelectTrigger
│ └── SelectValue
└── SelectContent
├── SelectGroup
│ ├── SelectLabel
│ ├── SelectItem
│ └── SelectItem
├── SelectSeparator
└── SelectGroup
├── SelectLabel
├── SelectItem
└── SelectItem
```
## Align Item With Trigger [#align-item-with-trigger]
Use `alignItemWithTrigger` on `SelectContent` to control whether the selected item aligns with the trigger. When `true` (default), the popup positions so the selected item appears over the trigger. When `false`, the popup aligns to the trigger edge.
## Groups [#groups]
Use `SelectGroup`, `SelectLabel`, and `SelectSeparator` to organize items.
## Scrollable [#scrollable]
A select with many items that scrolls.
## Disabled [#disabled]
## Invalid [#invalid]
Add the `data-invalid` attribute to the `Field` component and the `aria-invalid` attribute to the `SelectTrigger` component to show an error state.
```tsx showLineNumbers /data-invalid/ /aria-invalid/
Fruit
```
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
See the [Base UI Select](https://base-ui.com/react/components/select#api-reference) documentation.
# Separator
Visually or semantically separates content.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/separator.json
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx showLineNumbers
import { Separator } from "@/components/ui/separator";
```
```tsx showLineNumbers
```
## Vertical [#vertical]
Use `orientation="vertical"` for a vertical separator.
## Menu [#menu]
Vertical separators between menu items with descriptions.
## List [#list]
Horizontal separators between list items.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
See the [Base UI Separator](https://base-ui.com/react/components/separator#api-reference) documentation.
# Sheet
Extends the Dialog component to display content that complements the main content of the screen.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/sheet.json
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx showLineNumbers
import {
Sheet,
SheetClose,
SheetContent,
SheetDescription,
SheetFooter,
SheetHeader,
SheetTitle,
SheetTrigger,
} from "@/components/ui/sheet";
```
```tsx showLineNumbers
OpenAre you absolutely sure?This action cannot be undone.
```
## Composition [#composition]
Use the following composition to build a `Sheet`:
```text
Sheet
├── SheetTrigger
└── SheetContent
├── SheetHeader
│ ├── SheetTitle
│ └── SheetDescription
└── SheetFooter
```
## Side [#side]
Use the `side` prop on `SheetContent` to set the edge of the screen where the sheet appears. Values are `top`, `right`, `bottom`, or `left`.
## No Close Button [#no-close-button]
Use `showCloseButton={false}` on `SheetContent` to hide the close button.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
See the [Base UI Dialog](https://base-ui.com/react/components/dialog#api-reference) documentation.
# Sidebar
A composable, themeable and customizable sidebar component.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
A sidebar that collapses to icons.
Sidebars are one of the most complex components to build. They are central
to any application and often contain a lot of moving parts.
We now have a solid foundation to build on top of. Composable. Themeable.
Customizable.
[Browse the Blocks Library](/blocks).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/sidebar.json
```
## Usage [#usage]
```tsx showLineNumbers title="app/layout.tsx"
import { SidebarProvider, SidebarTrigger } from "@/components/ui/sidebar";
import { AppSidebar } from "@/components/app-sidebar";
export default function Layout({ children }: { children: React.ReactNode }) {
return (
{children}
);
}
```
```tsx showLineNumbers title="components/app-sidebar.tsx"
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarGroup,
SidebarHeader,
} from "@/components/ui/sidebar";
export function AppSidebar() {
return (
);
}
```
## Composition [#composition]
Use the following composition to build a `Sidebar` layout:
```text
SidebarProvider
├── Sidebar
│ ├── SidebarHeader
│ ├── SidebarContent
│ │ ├── SidebarGroup
│ │ │ ├── SidebarGroupLabel
│ │ │ ├── SidebarGroupAction
│ │ │ ├── SidebarGroupContent
│ │ │ └── SidebarMenu
│ │ │ ├── SidebarMenuItem
│ │ │ │ ├── SidebarMenuButton
│ │ │ │ ├── SidebarMenuAction
│ │ │ │ └── SidebarMenuBadge
│ │ │ └── SidebarMenuItem
│ │ │ ├── SidebarMenuButton
│ │ │ └── SidebarMenuSub
│ │ │ ├── SidebarMenuSubItem
│ │ │ └── SidebarMenuSubItem
│ │ └── SidebarGroup
│ │ └── SidebarMenu
│ │ ├── SidebarMenuItem
│ │ └── SidebarMenuItem
│ ├── SidebarFooter
│ └── SidebarRail
├── SidebarInset
└── SidebarTrigger
```
## Structure [#structure]
* **SidebarProvider** — Handles collapsible state and provides sidebar context to child components.
* **Sidebar** — The main collapsible sidebar panel.
* **SidebarHeader** — Sticky at the top; use for branding, titles, or workspace switchers.
* **SidebarFooter** — Sticky at the bottom; use for user menus, settings, or actions.
* **SidebarContent** — Scrollable region between the header and footer.
* **SidebarGroup** — Groups related navigation with optional label, action, and content areas.
* **SidebarMenu** / **SidebarMenuItem** — Menu structure for links, badges, actions, and nested submenus.
* **SidebarRail** — Resize handle for adjusting sidebar width when applicable.
* **SidebarInset** — Wraps main content when using the `inset` variant.
* **SidebarTrigger** — Control that toggles the sidebar open or collapsed.
## SidebarProvider [#sidebarprovider]
The `SidebarProvider` component is used to provide the sidebar context to the `Sidebar` component. You should always wrap your application in a `SidebarProvider` component.
### Props [#props]
| Name | Type | Description |
| -------------- | ------------------------- | -------------------------------------------- |
| `defaultOpen` | `boolean` | Default open state of the sidebar. |
| `open` | `boolean` | Open state of the sidebar (controlled). |
| `onOpenChange` | `(open: boolean) => void` | Sets open state of the sidebar (controlled). |
### Width [#width]
If you have a single sidebar in your application, you can use the `SIDEBAR_WIDTH` and `SIDEBAR_WIDTH_MOBILE` variables in `sidebar.tsx` to set the width of the sidebar.
```tsx showLineNumbers title="components/ui/sidebar.tsx"
const SIDEBAR_WIDTH = "16rem";
const SIDEBAR_WIDTH_MOBILE = "18rem";
```
For multiple sidebars in your application, you can use the `--sidebar-width` and `--sidebar-width-mobile` CSS variables in the `style` prop.
```tsx showLineNumbers
```
### Keyboard Shortcut [#keyboard-shortcut]
To trigger the sidebar, you use the `cmd+b` keyboard shortcut on Mac and `ctrl+b` on Windows.
```tsx showLineNumbers title="components/ui/sidebar.tsx"
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
```
## Sidebar [#sidebar]
The main `Sidebar` component used to render a collapsible sidebar.
### Props [#props-1]
| Property | Type | Description |
| ------------- | --------------------------------- | --------------------------------- |
| `side` | `left` or `right` | The side of the sidebar. |
| `variant` | `sidebar`, `floating`, or `inset` | The variant of the sidebar. |
| `collapsible` | `offcanvas`, `icon`, or `none` | Collapsible state of the sidebar. |
| Prop | Description |
| ----------- | ------------------------------------------------------------ |
| `offcanvas` | A collapsible sidebar that slides in from the left or right. |
| `icon` | A sidebar that collapses to icons. |
| `none` | A non-collapsible sidebar. |
**Note:** If you use the `inset` variant, remember to wrap your main content
in a `SidebarInset` component.
```tsx showLineNumbers
{children}
```
## useSidebar [#usesidebar]
The `useSidebar` hook is used to control the sidebar.
```tsx showLineNumbers
import { useSidebar } from "@/components/ui/sidebar";
export function AppSidebar() {
const {
state,
open,
setOpen,
openMobile,
setOpenMobile,
isMobile,
toggleSidebar,
} = useSidebar();
}
```
| Property | Type | Description |
| --------------- | ------------------------- | --------------------------------------------- |
| `state` | `expanded` or `collapsed` | The current state of the sidebar. |
| `open` | `boolean` | Whether the sidebar is open. |
| `setOpen` | `(open: boolean) => void` | Sets the open state of the sidebar. |
| `openMobile` | `boolean` | Whether the sidebar is open on mobile. |
| `setOpenMobile` | `(open: boolean) => void` | Sets the open state of the sidebar on mobile. |
| `isMobile` | `boolean` | Whether the sidebar is on mobile. |
| `toggleSidebar` | `() => void` | Toggles the sidebar. Desktop and mobile. |
## SidebarHeader [#sidebarheader]
Use the `SidebarHeader` component to add a sticky header to the sidebar.
```tsx showLineNumbers title="components/app-sidebar.tsx"
}>
Select Workspace
Acme Inc
```
## SidebarFooter [#sidebarfooter]
Use the `SidebarFooter` component to add a sticky footer to the sidebar.
```tsx showLineNumbers
Username
```
## SidebarContent [#sidebarcontent]
The `SidebarContent` component is used to wrap the content of the sidebar. This is where you add your `SidebarGroup` components. It is scrollable.
```tsx showLineNumbers
```
## SidebarGroup [#sidebargroup]
Use the `SidebarGroup` component to create a section within the sidebar.
A `SidebarGroup` has a `SidebarGroupLabel`, a `SidebarGroupContent` and an optional `SidebarGroupAction`.
```tsx showLineNumbers
ApplicationAdd Project
```
To make a `SidebarGroup` collapsible, wrap it in a `Collapsible`.
```tsx showLineNumbers
}>
Help
```
## SidebarMenu [#sidebarmenu]
The `SidebarMenu` component is used for building a menu within a `SidebarGroup`.
```tsx showLineNumbers
{projects.map((project) => (
}>
{project.name}
))}
```
## SidebarMenuButton [#sidebarmenubutton]
The `SidebarMenuButton` component is used to render a menu button within a `SidebarMenuItem`.
By default, the `SidebarMenuButton` renders a button but you can use the `render` prop to render a different component such as a `Link` or an `a` tag.
Use the `isActive` prop to mark a menu item as active.
```tsx showLineNumbers
} isActive>
Home
```
## SidebarMenuAction [#sidebarmenuaction]
The `SidebarMenuAction` component is used to render a menu action within a `SidebarMenuItem`.
```tsx showLineNumbers
}>
HomeAdd Project
```
## SidebarMenuSub [#sidebarmenusub]
The `SidebarMenuSub` component is used to render a submenu within a `SidebarMenu`.
```tsx showLineNumbers
```
## SidebarMenuBadge [#sidebarmenubadge]
The `SidebarMenuBadge` component is used to render a badge within a `SidebarMenuItem`.
```tsx showLineNumbers
24
```
## SidebarMenuSkeleton [#sidebarmenuskeleton]
The `SidebarMenuSkeleton` component is used to render a skeleton for a `SidebarMenu`.
```tsx showLineNumbers
{Array.from({ length: 5 }).map((_, index) => (
))}
```
## SidebarTrigger [#sidebartrigger]
Use the `SidebarTrigger` component to render a button that toggles the sidebar.
```tsx showLineNumbers
import { useSidebar } from "@/components/ui/sidebar";
export function CustomTrigger() {
const { toggleSidebar } = useSidebar();
return ;
}
```
## SidebarRail [#sidebarrail]
The `SidebarRail` component is used to render a rail within a `Sidebar`. This rail can be used to toggle the sidebar.
```tsx showLineNumbers
```
## Controlled Sidebar [#controlled-sidebar]
Use the `open` and `onOpenChange` props to control the sidebar.
```tsx showLineNumbers
export function AppSidebar() {
const [open, setOpen] = React.useState(false);
return (
);
}
```
## Theming [#theming]
We use the following CSS variables to theme the sidebar.
```css
@layer base {
:root {
--sidebar-background: 0 0% 98%;
--sidebar-foreground: 240 5.3% 26.1%;
--sidebar-primary: 240 5.9% 10%;
--sidebar-primary-foreground: 0 0% 98%;
--sidebar-accent: 240 4.8% 95.9%;
--sidebar-accent-foreground: 240 5.9% 10%;
--sidebar-border: 220 13% 91%;
--sidebar-ring: 217.2 91.2% 59.8%;
}
.dark {
--sidebar-background: 240 5.9% 10%;
--sidebar-foreground: 240 4.8% 95.9%;
--sidebar-primary: 0 0% 98%;
--sidebar-primary-foreground: 240 5.9% 10%;
--sidebar-accent: 240 3.7% 15.9%;
--sidebar-accent-foreground: 240 4.8% 95.9%;
--sidebar-border: 240 3.7% 15.9%;
--sidebar-ring: 217.2 91.2% 59.8%;
}
}
```
## Styling [#styling]
Here are some tips for styling the sidebar based on different states.
```tsx
```
```tsx
```
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
{/* prettier-ignore */}
# Skeleton
Use to show a placeholder while content is loading.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/skeleton.json
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx
import { Skeleton } from "@/components/ui/skeleton";
```
```tsx
```
## Avatar [#avatar]
## Card [#card]
## Text [#text]
## Form [#form]
## Table [#table]
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
# Slider
An input where the user selects a value from within a given range.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/slider.json
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx
import { Slider } from "@/components/ui/slider";
```
```tsx
```
## Range [#range]
Use an array with two values for a range slider.
## Multiple Thumbs [#multiple-thumbs]
Use an array with multiple values for multiple thumbs.
## Vertical [#vertical]
Use `orientation="vertical"` for a vertical slider.
## Controlled [#controlled]
## Disabled [#disabled]
Use the `disabled` prop to disable the slider.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
See the [Base UI Slider](https://base-ui.com/react/components/slider#api-reference) documentation.
# Sonner
An opinionated toast component for React.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
CLI
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/sonner.json
```
Install the following dependencies:
```bash
pnpm add sonner
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx
import { Toaster } from "@/components/ui/sonner/sonner";
import { toast } from "sonner";
```
```tsx
// Add to your root layout, then:
toast("Event has been created");
```
## Examples [#examples]
### Types [#types]
### Description [#description]
### Position [#position]
## RTL [#rtl]
To enable right-to-left support, see the [RTL guide](/docs/rtl).
## API Reference [#api-reference]
See the [Sonner](https://sonner.emilkowal.ski/) documentation for the full API reference.
# Spinner
An indicator that can be used to show a loading state.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/spinner.json
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx
import { Spinner } from "@/components/ui/spinner";
```
```tsx
```
## Customization [#customization]
You can replace the default spinner icon with any other icon by editing the `Spinner` component.
```tsx showLineNumbers title="components/ui/spinner.tsx"
import { LoaderIcon } from "lucide-react";
import { cn } from "@/lib/utils";
function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
return (
);
}
export { Spinner };
```
## Size [#size]
Use the `size-*` utility class to change the size of the spinner.
## Button [#button]
Add a spinner to a button to indicate a loading state. Place the `` before the label with `data-icon="inline-start"` for a start position, or after the label with `data-icon="inline-end"` for an end position.
## Badge [#badge]
Add a spinner to a badge to indicate a loading state. Place the `` before the label with `data-icon="inline-start"` for a start position, or after the label with `data-icon="inline-end"` for an end position.
## Input Group [#input-group]
## Empty [#empty]
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
# Switch
A control that allows the user to toggle between checked and not checked.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/switch.json
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx
import { Switch } from "@/components/ui/switch";
```
```tsx
```
## Description [#description]
## Choice Card [#choice-card]
Card-style selection where `FieldLabel` wraps the entire `Field` for a clickable card pattern.
## Disabled [#disabled]
Add the `disabled` prop to the `Switch` component to disable the switch. Add the `data-disabled` prop to the `Field` component for styling.
## Invalid [#invalid]
Add the `aria-invalid` prop to the `Switch` component to indicate an invalid state. Add the `data-invalid` prop to the `Field` component for styling.
## Size [#size]
Use the `size` prop to change the size of the switch.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
See the [Base UI Switch](https://base-ui.com/react/components/switch#api-reference) documentation.
# Table
A responsive table component.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/table.json
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx showLineNumbers
import {
Table,
TableBody,
TableCaption,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
```
```tsx showLineNumbers
A list of your recent invoices.InvoiceStatusMethodAmountINV001PaidCredit Card$250.00
```
## Composition [#composition]
Use the following composition to build a `Table`:
```text
Table
├── TableCaption
├── TableHeader
│ └── TableRow
│ ├── TableHead
│ ├── TableHead
│ ├── TableHead
│ └── TableHead
├── TableBody
│ ├── TableRow
│ │ ├── TableCell
│ │ ├── TableCell
│ │ ├── TableCell
│ │ └── TableCell
│ └── TableRow
│ ├── TableCell
│ ├── TableCell
│ ├── TableCell
│ └── TableCell
└── TableFooter
```
## Footer [#footer]
Use the `` component to add a footer to the table.
## Actions [#actions]
A table showing actions for each row using a `` component.
## Data Table [#data-table]
You can use the `
` component to build more complex data tables. Combine it with [@tanstack/react-table](https://tanstack.com/table/latest) to create tables with sorting, filtering and pagination.
See the [Data Table](/docs/components/data-table) documentation for more information.
You can also see an example of a data table in the [Tasks](/examples/tasks) demo.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
# Tabs
A set of layered sections of content—known as tab panels—that are displayed one at a time.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/tabs.json
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx showLineNumbers
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
```
```tsx showLineNumbers
AccountPasswordMake changes to your account here.Change your password here.
```
## Composition [#composition]
Use the following composition to build `Tabs`:
```text
Tabs
├── TabsList
│ ├── TabsTrigger
│ └── TabsTrigger
├── TabsContent
└── TabsContent
```
## Line [#line]
Use the `variant="line"` prop on `TabsList` for a line style.
## Vertical [#vertical]
Use `orientation="vertical"` for vertical tabs.
## Disabled [#disabled]
## Icons [#icons]
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
See the [Base UI Tabs](https://base-ui.com/react/components/tabs#api-reference) documentation.
# Textarea
Displays a form textarea or a component that looks like a textarea.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/textarea.json
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx
import { Textarea } from "@/components/ui/textarea";
```
```tsx
```
## Field [#field]
Use `Field`, `FieldLabel`, and `FieldDescription` to create a textarea with a label and description.
## Disabled [#disabled]
Use the `disabled` prop to disable the textarea. To style the disabled state, add the `data-disabled` attribute to the `Field` component.
## Invalid [#invalid]
Use the `aria-invalid` prop to mark the textarea as invalid. To style the invalid state, add the `data-invalid` attribute to the `Field` component.
## Button [#button]
Pair with `Button` to create a textarea with a submit button.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
# Toggle Group
A set of two-state buttons that can be toggled on or off.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/toggle-group.json
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
```
```tsx
ABC
```
## Composition [#composition]
Use the following composition to build a `ToggleGroup`:
```text
ToggleGroup
├── ToggleGroupItem
└── ToggleGroupItem
```
## Outline [#outline]
Use `variant="outline"` for an outline style.
## Size [#size]
Use the `size` prop to change the size of the toggle group.
## Spacing [#spacing]
Use `spacing` to add spacing between toggle group items.
## Vertical [#vertical]
Use `orientation="vertical"` for vertical toggle groups.
## Disabled [#disabled]
## Custom [#custom]
A custom toggle group example.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
See the [Base UI Toggle Group](https://base-ui.com/react/components/toggle-group#api-reference) documentation.
# Toggle
A two-state button that can be either on or off.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/toggle.json
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage [#usage]
```tsx
import { Toggle } from "@/components/ui/toggle";
```
```tsx
Toggle
```
## Outline [#outline]
Use `variant="outline"` for an outline style.
## With Text [#with-text]
## Size [#size]
Use the `size` prop to change the size of the toggle.
## Disabled [#disabled]
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
See the [Base UI Toggle](https://base-ui.com/react/components/toggle#api-reference) documentation.
# Tooltip
A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
## Installation [#installation]
Command
Manual
Run the following command:
```bash
npx shadcn@latest add https://shadcn-cssinjs.com/r/tooltip.json
```
Add the
`TooltipProvider`
to the root of your app.
```tsx title="app/layout.tsx" showLineNumbers {1,7}
import { TooltipProvider } from "@/components/ui/tooltip";
export default function RootLayout({ children }) {
return (
{children}
);
}
```
Install the following dependencies:
```bash
pnpm add @base-ui/react @stylexjs/stylex
```
Make sure [StyleX is configured](/docs/installation) and the design tokens are
installed.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
Add the
`TooltipProvider`
to the root of your app.
```tsx title="app/layout.tsx" showLineNumbers {1,7}
import { TooltipProvider } from "@/components/ui/tooltip";
export default function RootLayout({ children }) {
return (
{children}
);
}
```
## Usage [#usage]
```tsx showLineNumbers
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
```
```tsx showLineNumbers
Hover
Add to library
```
## Composition [#composition]
Use the following composition to build a `Tooltip`:
```text
Tooltip
├── TooltipTrigger
└── TooltipContent
```
## Side [#side]
Use the `side` prop to change the position of the tooltip.
## With Keyboard Shortcut [#with-keyboard-shortcut]
## Disabled Button [#disabled-button]
Show a tooltip on a disabled button by wrapping it with a span.
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
## API Reference [#api-reference]
See the [Base UI Tooltip](https://base-ui.com/react/components/tooltip#api-reference) documentation.
# Typography
Styles for headings, paragraphs, lists, etc.
> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).
We do not ship any typography styles by default. This page is an example of how you can use utility classes to style your text.
## h1 [#h1]
## h2 [#h2]
## h3 [#h3]
## h4 [#h4]
## p [#p]
## blockquote [#blockquote]
## table [#table]
## list [#list]
## Inline code [#inline-code]
## Lead [#lead]
## Large [#large]
## Small [#small]
## Muted [#muted]
## RTL [#rtl]
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).