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.
Basic
A checkbox is a small box you can tick to select an option. It’s either on or off.
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.
This component comes packed with several components to enhance functionality and provide a seamless experience.
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>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.
Intent UI Design
Build modern web apps faster with 1000+ resources across components, blocks, patterns, templates, and starter kits.