State Management

useToggle

Toggle boolean state with optional callback and initial value support.

import { useToggle } from "saha-ui"

Uses

Simplified boolean state with helper toggles and explicit setters.

Props

NameTypeDescriptionDefault
initialValuebooleanInitial value.false

Returns

NameDescription
[value, toggle, setTrue, setFalse, setValue]State and helpers.

Example

const [isOpen, toggle, open, close] = useToggle();

Notes

Small convenience hook used widely in UI components.
Saha UI - The Modern React Component Library