useTogglestate
useToggle
NewSSR SAFEToggles a boolean state value with memoized handlers.
$ pnpm dlx shadcn@latest add @byphongphan/use-toggleRequires
@byphongphan in components.jsonuse-toggle.tsx
Loading preview...
Installation
$ pnpm dlx shadcn@latest add @byphongphan/use-toggleRequires
@byphongphan in components.jsonUsage
Props & Parameters
| Param | Type | Default | Description |
|---|---|---|---|
initialValue | boolean | false | Initial boolean state value. |
Returns
| Return | Type | Description |
|---|---|---|
[value, toggle, actions] | [boolean, (next?: boolean) => void, UseToggleActions] | Tuple containing state, toggle callback, and memoized action helpers (setTrue, setFalse, setValue). |