web / lib/hooks/use-theme
lib/hooks/use-theme
Theme hook that wraps next-themes for consistent API.
Provides theme state and setter with proper typing for the application’s supported themes (light, dark, system).
Type Aliases
Theme
Theme =
"light"|"dark"|"system"
Functions
useMounted()
useMounted():
boolean
Hook to check if the component is mounted on the client. Useful for avoiding hydration mismatches with theme-dependent rendering.
Returns
boolean
useTheme()
useTheme():
object
Returns
theme
theme:
Theme
Current theme setting: “light”, “dark”, or “system”
setTheme()
setTheme: (
theme) =>void
Set the theme
Parameters
theme
Returns
void
resolvedTheme
resolvedTheme:
"light"|"dark"
The actual resolved theme after system preference is applied
systemTheme
systemTheme:
"light"|"dark"|undefined
The system’s preferred theme
Last updated on