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.jsonpnpm dlx shadcn@latest add https://unlogg.com/r/use-boolean.jsonbunx shadcn@latest add https://unlogg.com/r/use-boolean.jsonNotes
- 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 | - |