What problem does it solve?
Tailwind v4 + shadcn/ui theming often requires careful setup to support dark mode, semantic color tokens, and a CSS-first architecture. This guide provides a proven four-step pattern to define CSS variables at root, map them to Tailwind utilities with @theme inline, apply base styles, and enable automatic dark mode, dramatically reducing common errors and migration complexities.
Core Features & Use Cases
- Define CSS variables at root level and keep them centralized for all themes.
- Map variables to Tailwind utilities with @theme inline to generate semantic classes like bg-background and text-foreground.
- Provide a ThemeProvider-based dark mode approach that toggles a .dark class on <html> and persists user choice.
- Offer migration guidance from v3 (e.g., removing tailwind.config.ts, avoiding @apply in v4) and a structured reference for common gotchas.
Quick Start
Run through the four-step setup to enable CSS-variable theming and automatic dark mode in a React + Vite project.