Skip to content

ThemeProvider

daisyUI theme provider. Manages the selected theme (any enabled daisyUI theme, or the special "system" value which follows the OS light/dark setting), applies it to the document data-theme attribute via IJSRuntime, and persists the choice to localStorage + cookie. Cascades itself so descendants can read ThemeProvider.Preference / ThemeProvider.Theme / ThemeProvider.IsDarkMode and call SetThemeAsync(System.String).

Brand-neutral: the light/dark theme applied for "system", the set of selectable themes, and the set of themes considered “dark” are all parameter-driven, so any application can plug in its own daisyUI themes without modifying this component.

Content rendered inside the provider; receives this as a cascading value.

Cookie name for the preference (so the server can read it during SSR). Defaults to daisy-theme.

Cookie name for the resolved theme (so SSR can paint the right theme). Defaults to daisy-darkmode.

Themes considered “dark” (used to resolve ThemeProvider.IsDarkMode). Defaults to ThemeProvider.DaisyUiDarkThemes.

Kept for backwards compatibility; no longer used to seed state (the resolved theme cookie is preferred).

Initial preference read by the consumer (typically from the server-side cookie during SSR) to avoid a flash of the wrong theme on first paint. May be a theme name or "system". Pass null to skip.

Whether the applied theme is a dark theme.

Raised after the applied theme changes (e.g. to refresh a theme picker).

Current selection: a theme name, or "system".

localStorage key for the saved preference. Defaults to daisy-theme.

Theme applied for ThemeProvider.SystemPreference when the OS is in dark mode. Defaults to dark.

Theme applied for ThemeProvider.SystemPreference when the OS is in light mode. Defaults to light.

The daisyUI theme actually applied (resolves "system" to a concrete theme).

All selectable themes, in display order. Must stay in sync with the themes: list enabled in your Tailwind/daisyUI css. Defaults to all 35 built-in daisyUI themes (ThemeProvider.DaisyUiThemes).

Resolves a preference (theme name or “system”) to a concrete daisyUI theme.

Selects a theme and persists it. Pass any value from ThemeProvider.Themes, or ThemeProvider.SystemPreference to follow the OS setting.

The persisted choice: a theme name, or ThemeProvider.SystemPreference.

The actual daisyUI theme currently applied to data-theme.

The built-in daisyUI themes that use a dark color scheme. Default for ThemeProvider.DarkThemes.

The 35 built-in daisyUI v5 themes, in display order. Used as the default for ThemeProvider.Themes.

The special preference value that follows the OS light/dark setting.