shadcn
Project-aware shadcn/ui workflow for searching, adding, composing, and fixing components with correct patterns.
Install
npx skills add https://github.com/shadcn-ui/ui --skill shadcnCustomization & Theming
Components reference semantic CSS variable tokens. Change the variables to change every component.
Contents
- How it works (CSS variables → Tailwind utilities → components)
- Color variables and OKLCH format
- Dark mode setup
- Changing the theme (presets, CSS variables)
- Adding custom colors (Tailwind v3 and v4)
- Border radius
- Customizing components (variants, className, wrappers)
- Checking for updates
How It Works
- CSS variables defined in
:root(light) and.dark(dark mode). - Tailwind maps them to utilities:
bg-primary,text-muted-foreground, etc. - Components use these utilities — changing a variable changes all components that reference it.
Color Variables
Every color follows the name / name-foreground convention. The base variable is for backgrounds, -foreground is for text/icons on that background.
Colors use OKLCH: --primary: oklch(0.205 0 0) where values are lightness (0–1), chroma (0 = gray), and hue (0–360).
Dark Mode
Class-based toggle via .dark on the root element. In Next.js, use next-themes:
Changing the Theme
Or edit CSS variables directly in globals.css.
Adding Custom Colors
Add variables to the file at tailwindCssFile from npx shadcn@latest info (typically globals.css). Never create a new CSS file for this.
When tailwindVersion is "v3" (check via npx shadcn@latest info), register in tailwind.config.js instead:
Border Radius
--radius controls border radius globally. Components derive values from it (rounded-lg = var(--radius), rounded-md = calc(var(--radius) - 2px)).
When a brand spec defines its own radius scale, pin each step in @theme inline (--radius-sm … --radius-4xl) instead of deriving from --radius. See design-system.md.
Customizing Components
See also: rules/styling.md for Incorrect/Correct examples.
Prefer these approaches in order:
1. Built-in variants
2. Tailwind classes via className
3. Add a new variant
Edit the component source to add a variant via cva:
4. Wrapper components
Compose shadcn/ui primitives into higher-level components:
Checking for Updates
To preview exactly what would change before updating, use --dry-run and --diff:
See Updating Components in SKILL.md for the full smart merge workflow.