ThemeProvider
⚠️ Most apps don't need ThemeProvider but will benefit from ThemeController. You generally only need ThemeProvider to apply a different theme to a subsection of your app or to snoop the CSS variables into JavaScript variables.
ThemeProvider is a special use component for applying DaisyUI theme variables and attributes to any part of your app. It parses DaisyUI plugin theme strings, applies CSS variables as inline styles, and sets non-variable attributes as data attributes.
The theme prop lets you specify a named theme that you have pre-programmed in your DaisyUI config. If you also provide the cssVars prop, its values will override the named theme, allowing for granular customization or one-off theme adjustments.
You can nest multiple ThemeProvider instances. Whichever ThemeProvider is the closest parent to a given element in the DOM will control the theme for that section, ensuring precise and predictable theme scoping.
This enables dynamic theme switching, dark/light mode support, and granular theme customization for your components or app sections.
Basic Example
This section uses the some-custom theme.