useTernaryDarkMode
Custom hook that manages ternary (system, dark, light) dark mode with local storage support.
Custom hook that manages ternary (system, dark, light) dark mode with local storage support.
Usage
import { useTernaryDarkMode } from "@tilt-legal/cubitt-components/utilities/hooks";
const { isDarkMode, ternaryDarkMode, setTernaryDarkMode, toggleTernaryDarkMode } = useTernaryDarkMode({ defaultValue: 'dark' });
// Access and use the dark mode state and provided helper functions.API
Signature
declare function useTernaryDarkMode({ defaultValue, localStorageKey, initializeWithValue, }?: TernaryDarkModeOptions): TernaryDarkModeReturn;Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
[options] | `?TernaryDarkModeOptions | string` | Options or the local storage key for the hook. |
Return Value
| Value | Type | Description |
|---|---|---|
return | TernaryDarkModeReturn | An object containing the dark mode state and helper functions. |