Prerequisites
Before installing themes, ensure you have shadcn/ui set up in your Next.js project. If you haven’t already:Installation
Install the theme system
Install the complete theme system with all 40+ themes:This installs:
lib/themes-config.ts- Theme configuration and metadatacomponents/providers/theme-provider.tsx- Next.js theme providercomponents/theme-switcher.tsx- Interactive theme switcher UIstyles/themes/*.css- All 40+ theme CSS filesnext-themesdependency for theme management
Add ThemeProvider to your root layout
Wrap your application with the ThemeProvider in
app/layout.tsx:app/layout.tsx
The
suppressHydrationWarning prop prevents hydration warnings from theme switching.How it works
The Next.js adapter uses next-themes for theme management:Theme Provider implementation
Theme Provider implementation
Located at Themes are stored as
components/providers/theme-provider.tsx:data-theme attributes with values like catppuccin-dark or vercel-light.Theme configuration
Theme configuration
All theme metadata is in
lib/themes-config.ts:Theme switching logic
Theme switching logic
The ThemeSwitcher component parses theme strings to separate color theme from mode:
Adding individual themes
To install specific themes instead of all 40+:styles/themes/index.css
Customizing themes
All theme CSS files are instyles/themes/. Each theme defines CSS variables:
styles/themes/catppuccin.css
TypeScript usage
Use theuseTheme hook from next-themes:
Next steps
Browse Themes
Explore all 40+ available themes
Theme Picker
Preview themes in real-time
Vite Setup
Install themes in Vite React
Astro Setup
Install themes in Astro