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
| Name | Type | Description | Default |
|---|---|---|---|
| initialValue | boolean | Initial value. | false |
Returns
| Name | Description |
|---|---|
| [value, toggle, setTrue, setFalse, setValue] | State and helpers. |
Example
const [isOpen, toggle, open, close] = useToggle();
Notes
Small convenience hook used widely in UI components.