Dark Mode
A wrapper component for managing themes using next-themes and shadcn/ui.
Theme Provider
A client-side wrapper component that provides theme switching functionality powered by next-themes.
Note
We use shadcn/ui for the theme switching functionality. You can use the useTheme hook to access the current theme.
Options
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | Required | Child elements to be rendered |
| attribute | string | "class" | Attribute to add to the html element |
| defaultTheme | string | "system" | Default theme when first loading |
| enableSystem | boolean | true | Enable system theme detection |
| value | Record<string, any> | - | Controlled theme value |
| forcedTheme | string | - | Forced theme to use (disables switching) |
| disableTransitionOnChange | boolean | false | Disable transitions when switching themes |
Mode Toggle
Place a mode toggle on your site at @/components/themes/mode-toggle.tsx to toggle between light and dark mode.