Prerequisites
Before installing themes, ensure you have shadcn/ui set up in your Vite React 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/theme-provider.tsx- Custom React theme providercomponents/theme-switcher.tsx- Interactive theme switcher UIstyles/themes/*.css- All 40+ theme CSS files
Add ThemeProvider to your app root
Wrap your application with the ThemeProvider in
src/App.tsx:src/App.tsx
How it works
The Vite adapter uses a custom theme provider with localStorage persistence:Theme Provider implementation
Theme Provider implementation
Located at The provider manages theme state and automatically updates the
components/theme-provider.tsx:data-theme attribute on the document root.Theme configuration
Theme configuration
All theme metadata is in
lib/themes-config.ts:localStorage persistence
localStorage persistence
Themes are automatically saved to localStorage with the key On page load, the theme is restored from localStorage:
tweakcn-theme:Adding individual themes
To install specific themes instead of all 40+:src/styles/themes/index.css
Customizing themes
All theme CSS files are insrc/styles/themes/. Each theme defines CSS variables:
src/styles/themes/vercel.css
TypeScript usage
Use theuseTheme hook from the theme provider:
Vite configuration
Ensure yourvite.config.ts has path aliases configured:
vite.config.ts
Next steps
Browse Themes
Explore all 40+ available themes
Theme Picker
Preview themes in real-time
Next.js Setup
Install themes in Next.js
Remix Setup
Install themes in Remix