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

ParameterTypeDescriptionDefault
[options]`?TernaryDarkModeOptionsstring`Options or the local storage key for the hook.

Return Value

ValueTypeDescription
returnTernaryDarkModeReturnAn object containing the dark mode state and helper functions.

On this page