Skip to main content

use_theme_provider

Function use_theme_provider 

Source
pub fn use_theme_provider(theme: Option<ThemeConfig>) -> Signal<String>
Expand description

Provide the CurrentTheme context and apply the persisted theme on mount.

Reads the stored preference from localStorage (falling back to the config’s default theme), sets data-theme on <html>, and keeps the returned signal in sync. Called by DocsLayout/BlogLayout; call it yourself when you render kit components (e.g. ThemeToggle) outside those layouts, e.g. in a landing-page navbar.