Checkbox
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 tailwind-merge
Anatomy
import { Checkbox, CheckboxField } from "@/components/ui/checkbox"
import { Description } from "@/components/ui/field"<CheckboxField>
<Checkbox>Remember me</CheckboxLabel>
<Description>Keep me logged in on this device</Description>
</CheckboxField>Examples
Invalid
The checkbox is in an error state.
Description
You can add a description to checkbox by adding Description component as a child of CheckboxField.
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
CheckboxGroup
The CheckboxGroup component groups related checkbox options.
| Prop | Type | Default |
|---|---|---|
className | string | - |
CheckboxField
The CheckboxField component renders the checkbox label.
| Prop | Type | Default |
|---|---|---|
className | string | - |
Checkbox
The Checkbox component renders the checkbox label.
| Prop | Type | Default |
|---|---|---|
className | string | - |
See the React Aria for the full API reference.
