The ThemeProvider component manages theme state including dark mode, light mode, and system preference. It includes the ThemeSwitcher component for toggling themes and the useTheme hook for accessing theme state.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/raystack/apsara/llms.txt
Use this file to discover all available pages before exploring further.
Usage
Theme configuration
Custom themes
ThemeSwitcher
A pre-built component for toggling between light and dark themes.useTheme hook
Access and control theme state from any component.Forced theme
Force a specific theme for certain pages or components.Disable transitions
API reference
ThemeProvider
The default theme to use. If enableSystem is false, defaults to ‘light’.
List of all available theme names.
Force a specific theme for the current page or component tree.
Whether to enable system theme preference (prefers-color-scheme).
Whether to indicate to browsers which color scheme is used for built-in UI elements.
Disable all CSS transitions when switching themes to prevent flickering.
Key used to store theme setting in localStorage.
HTML attribute modified based on the active theme. Accepts ‘class’ or any data attribute like ‘data-theme’, ‘data-mode’, etc.
Mapping of theme name to HTML attribute value. Object where key is theme name and value is the attribute value.
Style variant of the theme. Affects radius and font properties.
Accent color for the theme.
Gray color variant for the theme.
Nonce string to pass to the inline script for CSP headers.
ThemeSwitcher
Size of the theme toggle icon in pixels.
useTheme
Returns an object with the following properties:The active theme name.
Function to update the theme.
List of all available theme names.
The forced theme for the current page, if any.
If enableSystem is true and the active theme is ‘system’, this returns the resolved system preference (‘dark’ or ‘light’). Otherwise, identical to theme.
If enableSystem is true, returns the system theme preference, regardless of the active theme.