Skip to content

ThemeProvider

ThemeProvider(props): Element

Defined in: packages/react/src/components/ui/ThemeProvider.tsx:56

Framework-agnostic theme provider.

Manages the .dark class on <html> and persists the user’s preference to localStorage. Respects the system prefers-color-scheme media query when theme is set to "system".

Does NOT depend on next-themes — works in any React framework.

object & ClassAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement>

Component props.

Element

The provider wrapping children with theme context.

// Wrap your app root
<ThemeProvider>
<App />
</ThemeProvider>