useBoolean
A custom React hook to manage boolean state with toggle functionality.
Example
Loading...
Install
npx shadcn@latest add https://unlogg.com/r/use-boolean.json
pnpm dlx shadcn@latest add https://unlogg.com/r/use-boolean.json
bunx shadcn@latest add https://unlogg.com/r/use-boolean.json
Notes
- Provides a simple way to manage boolean state with built-in toggle functionality.
- Includes functions to set the state to
true
,false
, or toggle the current state
API Reference
Parameters
Prop | Type | Default |
---|---|---|
defaultValue? | boolean | false |
Returns
Prop | Type | Default |
---|---|---|
toggle? | () => void | - |
setFalse? | () => void | - |
setTrue? | () => void | - |
setValue? | React.Dispatch<React.SetStateAction<boolean>> | - |
value? | boolean | - |