dark class is present on the page. This guide covers how to toggle between them.
How the generated code works
- Tailwind v3
- Tailwind v4
The CLI syncs two files:Import
tailwind.config.js— references CSS variables instead of hardcoded values, withdarkMode: 'selector'enabledtheme.css— defines:rootvariables for light mode and.darkoverrides for dark mode
tailwind.config.js
theme.css
theme.css in your global stylesheet or entry point:globals.css
Sync your theme
Run the CLI to sync your theme (including dark mode) to your codebase:Add a toggle
To switch between light and dark mode, your app needs to toggle thedark class on the <html> element. Here’s how to set that up:
- Next.js (next-themes)
- Vite / React
1
Install next-themes
2
Wrap your app in the ThemeProvider
app/layout.tsx
3
Add a toggle button

