- Accordion
- Action Bar
- Action Toast
- Alert Banner
- Alert Dialog
- Alert
- Alphabet Index
- Amount Field
- Aspect Ratio
- Attachment
- Availability List
- Avatar
- Badge
- Bank Card
- Breadcrumb
- Bubble
- Button Group
- Button
- Calendar
- Camera Frame
- Card Design Picker
- Card Details
- Card Peek
- Card Stack
- Card
- Carousel
- Chart
- Chat Thread
- Checkbox
- Chip Group
- Choice Tile
- Code Block
- Code Dots
- Collapsible
- Combobox
- Command
- Context Menu
- Copy Field
- Countdown
- Country Select
- Data Table
- Date Field
- Date Picker
- Date Range Picker
- Dialog
- Direction
- Document Paper
- Drawer
- Dropdown Menu
- Empty
- Entity Avatar
- Field
- File Trigger
- File Upload Item
- Hover Card
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Key Value
- Keypad
- Label
- Live Region
- Marker
- Message Scroller
- Message
- Money Amount
- Native Select
- Number Field
- Pagination
- Percent Split Editor
- Phone Field
- Popover
- Progress
- QR Code
- Questionnaire
- Radio Group
- Range Histogram
- Rating
- Resizable
- Scroll Area
- Search Field
- Select
- Separator
- Share Bar
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Sortable List
- Spinner
- Status Timeline
- Step Header
- Steps List
- Swipe Row
- Switch
- Table
- Tabs
- Text Field
- Textarea
- Tier Ladder
- Toggle Group
- Toggle
- Token Search Field
- Tooltip
- Trace
- Transaction Row
- Usage Meter
We use and recommend CSS variables for theming.
This gives you semantic theme tokens like background, foreground, and primary that components use by default. Override those tokens in your CSS to change the look of your app without rewriting component classes.
<div className="bg-background text-foreground" />To use CSS variables for theming, set tailwind.cssVariables to true in your components.json file. This is the default.
{
"style": "dots",
"rsc": true,
"tailwind": {
"config": "",
"css": "app/globals.css",
"baseColor": "neutral",
"cssVariables": true
}
}Tailwind maps these tokens into utilities like bg-background, text-foreground, border-border, and ring-ring.
Dark mode works by overriding the same tokens inside a .dark selector. See the dark mode docs for adding a theme provider and toggling the .dark class.
Token Convention#
We use semantic background and foreground pairs. The base token controls the surface color and the -foreground token controls the text and icon color that sits on that surface.
The background suffix is omitted for the surface token. For example, primary pairs with primary-foreground.
Given the following CSS variables:
--primary: oklch(0.205 0 0);
--primary-foreground: oklch(0.985 0 0);The background color of the following component will be var(--primary) and the foreground color will be var(--primary-foreground).
<div className="bg-primary text-primary-foreground">Hello</div>Theme Tokens#
These tokens live in your CSS file under :root and .dark.
| Token | What it controls | Used by |
|---|---|---|
background / foreground | The default app background and text color. | The page shell, page sections, and default text. |
card / card-foreground | Elevated surfaces and the content inside them. | Card, dashboard panels, settings panels. |
popover / popover-foreground | Floating surfaces and the content inside them. | Popover, DropdownMenu, ContextMenu, and other overlays. |
primary / primary-foreground | High-emphasis actions and brand surfaces. | Default Button, selected states, badges, and active accents. |
secondary / secondary-foreground | Lower-emphasis filled actions and supporting surfaces. | Secondary buttons, secondary badges, and supporting UI. |
muted / muted-foreground | Subtle surfaces and lower-emphasis content. | Descriptions, placeholders, empty states, helper text, and subdued surfaces. |
accent / accent-foreground | Interactive hover, focus, and active surfaces. | Ghost buttons, menu highlight states, hovered rows, and selected items. |
destructive | Destructive actions and error emphasis. | Destructive buttons, invalid states, and destructive menu items. |
border | Default borders and separators. | Cards, menus, tables, separators, and layout dividers. |
input | Form control borders and input surface treatment. | Input, Textarea, Select, and outline-style controls. |
ring | Focus rings and outlines. | Buttons, inputs, checkboxes, menus, and other focusable controls. |
chart-1 ... chart-5 | The default chart palette. | Charts. |
sidebar / sidebar-foreground | The base sidebar surface and default sidebar text. | The Sidebar container and its default content. |
sidebar-primary / sidebar-primary-foreground | High-emphasis actions inside the sidebar. | Active items, icon tiles, badges, and sidebar CTAs. |
sidebar-accent / sidebar-accent-foreground | Hover and selected states inside the sidebar. | Sidebar menu hover states, open items, and interactive rows. |
sidebar-border | Sidebar-specific borders and separators. | Sidebar headers, groups, and internal dividers. |
sidebar-ring | Sidebar-specific focus rings. | Focused controls inside the sidebar. |
radius | The base corner radius scale. | Cards, inputs, buttons, popovers, and the derived radius-* tokens. |
The chart tokens are covered in more detail in the Chart theming docs.
Radius Scale#
--radius is the base radius token for your theme.
We derive a small radius scale from it so components can use consistent corner sizes while still sharing a single source of truth.
@theme inline {
--radius-sm: calc(var(--radius) * 0.6);
--radius-md: calc(var(--radius) * 0.8);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) * 1.4);
--radius-2xl: calc(var(--radius) * 1.8);
--radius-3xl: calc(var(--radius) * 2.2);
--radius-4xl: calc(var(--radius) * 2.6);
}This means:
radius-lgis the base value.- Smaller radii scale down from
--radius. - Larger radii scale up from
--radius. - Changing
--radiusupdates the entire radius scale.
Adding New Tokens#
To add a new token, define it under :root and .dark, then expose it to Tailwind with @theme inline.
:root {
--warning: oklch(0.84 0.16 84);
--warning-foreground: oklch(0.28 0.07 46);
}
.dark {
--warning: oklch(0.41 0.11 46);
--warning-foreground: oklch(0.99 0.02 95);
}
@theme inline {
--color-warning: var(--warning);
--color-warning-foreground: var(--warning-foreground);
}You can now use bg-warning and text-warning-foreground in your components.
<div className="text-warning-foreground bg-warning" />The Dots Palette#
init writes the Dots palette into your CSS file: the tokens above under :root and .dark, plus the extra tokens Dots components use (warning, track, glass and the --dots-shadow-* shadows) with their @theme inline mappings. The palette is monochrome: primary is the foreground and background inverted, and colour is kept for destructive and warning.
tailwind.baseColor in components.json is always neutral. The CLI records it, but the Dots palette overrides every token it defines. To see the exact values, open your CSS file after init or request the preset at /init.
Without CSS Variables#
If you do not want to use CSS variables, the CLI can generate components with inline Tailwind color utilities instead.
pnpm dlx shadcn@latest init --no-css-variables
This sets tailwind.cssVariables to false in your components.json file.
<div className="bg-zinc-950 text-zinc-50 dark:bg-white dark:text-zinc-950" />This is an installation-time choice. To switch an existing project, delete and re-install your components.