Checkbox
An interactive input that allows users to toggle a selection on or off, often used for settings or multiple-choice selections. It supports indeterminate states.
Installation
Install the component via the CLI in one command.
npx shadcn@latest add @intentui/checkbox
Composed components
When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.
Manual installation
Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.
npm install react-aria-components @heroicons/react
Anatomy
import { Checkbox } from "@/components/ui/checkbox"
import { Description, Label } from "@/components/ui/field"<Checkbox>
<Label>Remember me</Label>
<Description>Keep me logged in on this device</Description>
</Checkbox>Examples
Invalid
The checkbox is in an error state.
Indeterminate
The checkbox is in an indeterminate state.
Controlled
You can control the checkbox value by using the value prop.
Uncontrolled
You can control the checkbox value by using the defaultValue prop.
Disabled
The checkbox is disabled.
Component API
Checkbox
The Checkbox component is used for a single selectable option.
| Prop | Type | Default |
|---|---|---|
className | string | - |
CheckboxGroup
The CheckboxGroup component groups related checkbox options.
| Prop | Type | Default |
|---|---|---|
className | string | - |
CheckboxLabel
The CheckboxLabel component renders the checkbox label.
| Prop | Type | Default |
|---|---|---|
className | string | - |
See the React Aria for the full API reference.
Unlock the full power ofIntent UI Design
Build modern web apps faster with 1000+ resources across components, blocks, patterns, templates, and starter kits.