@supunlakmal/hooks
Version:
A collection of reusable React hooks
17 lines (16 loc) • 602 B
TypeScript
interface UseDarkModeOutput {
isDarkMode: boolean;
toggle: () => void;
enable: () => void;
disable: () => void;
set: (value: boolean) => void;
}
/**
* Custom hook to manage dark mode state.
* It synchronizes with the user's OS preference and persists the choice in local storage.
*
* @param {boolean} [defaultValue] - Optional initial value (overrides OS preference and local storage).
* @returns {UseDarkModeOutput} An object containing the dark mode state and control functions.
*/
export declare const useDarkMode: (defaultValue?: boolean) => UseDarkModeOutput;
export {};