Skip to main content
Wraps the application with next-themes for dark mode support. Features:
  • Applies theme via class attribute on the root element (for Tailwind dark: prefix)
  • Defaults to system to respect OS preference
  • Persists user preference in localStorage
  • Prevents flash of wrong theme on load

Props

children
React.ReactNode
required
children

Usage

import { ThemeProvider } from '@/components/ThemeProvider';

export default function Example() {
  return (
    <ThemeProvider>
      <App />
    </ThemeProvider>
  );
}