---
title: useBoolean
description: "`useBoolean` is a custom hook used to manage boolean values using `on`, `off`, and `toggle` functions."
links:
- source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-boolean
- storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-useboolean--basic
---
# useBoolean
`useBoolean` is a custom hook used to manage boolean values using `on`, `off`, and `toggle` functions.
```tsx
const [flg, { on, off, toggle }] = useBoolean()
return (
State: {String(flg)}
On
Off
Toggle
)
```
## Usage
```tsx
import { useBoolean } from "@yamada-ui/react"
```
```tsx
import { useBoolean } from "@/components/ui"
```
```tsx
import { useBoolean } from "@workspaces/ui"
```
```tsx
const [flg, { on, off, toggle }] = useBoolean()
```
### Using Initial Values
```tsx
const [flg, { on, off, toggle }] = useBoolean(true)
return (
State: {String(flg)}
On
Off
Toggle
)
```
## Used By Components & Hooks
- [Carousel](https://yamada-ui.com/docs/components/carousel.md): `Carousel` is a component that displays multiple elements like a slideshow.
- [useProcessing](https://yamada-ui.com/docs/hooks/use-processing.md): `useProcessing` is a custom hook for handling processing states.