SSE Hooks

useDarkMode

GitHub
Custom hook that returns the current state of the dark mode.

Installation

npx sse-hooks add use-dark-mode

Usage

example.ts
import { useDarkMode } from "./{hooks file}";

const { isDarkMode, toggle, enable, disable, set } = useDarkMode({
  defaultValue: true,
});

API

Parameters

Prop Default Type
options

{}

DarkModeOptions

The initial value of the dark mode, default false.

Returns

Return Value Default Type
disable-

() => void

Function to disable the dark mode.

enable-

() => void

Function to enable the dark mode.

isDarkMode-

boolean

The current state of the dark mode.

set-

(value: boolean) => void

Function to set a specific value to the dark mode.

toggle-

() => void

Function to toggle the dark mode.

Types Aliases

No specific type aliases defined for this component.

Changelog

c165d — feat: enhance useRoleGuard and useSSR hooks with additional options and documentation

30da4 — feat: add new hooks and their metadata

cf13e — feat: add custom hooks for step navigation, ternary dark mode, timeout, toggle, unmount, and window size

Built with Love • © 2026