Skip to main content

Prerequisites

Before installing themes, ensure you have shadcn/ui set up in your Next.js project. If you haven’t already:
1

Initialize shadcn/ui

2

Install required components

The theme system requires these shadcn/ui components:

Installation

1

Install the theme system

Install the complete theme system with all 40+ themes:
This installs:
  • lib/themes-config.ts - Theme configuration and metadata
  • components/providers/theme-provider.tsx - Next.js theme provider
  • components/theme-switcher.tsx - Interactive theme switcher UI
  • styles/themes/*.css - All 40+ theme CSS files
  • next-themes dependency for theme management
2

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.
3

Add the ThemeSwitcher to your UI

Import and use the ThemeSwitcher component anywhere in your app:
components/header.tsx

How it works

The Next.js adapter uses next-themes for theme management:
Located at components/providers/theme-provider.tsx:
Themes are stored as data-theme attributes with values like catppuccin-dark or vercel-light.
All theme metadata is in lib/themes-config.ts:
The ThemeSwitcher component parses theme strings to separate color theme from mode:

Adding individual themes

To install specific themes instead of all 40+:
Then import only the themes you need:
styles/themes/index.css

Customizing themes

All theme CSS files are in styles/themes/. Each theme defines CSS variables:
styles/themes/catppuccin.css
Edit these files to customize colors, borders, shadows, and more.

TypeScript usage

Use the useTheme 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