Dither / components
Checkbox
Toggle an option on or off, with label, description and a box layout.
- Stable
- 8 variants
- 7 props
- Light & Dark
light
dark
Code
import { Checkbox } from "@/components/ui/checkbox";export default function CheckboxDemo() { return ( <div className="grid w-full max-w-sm gap-4"> <Checkbox label="Accept terms and conditions" defaultChecked /> <Checkbox label="Weekly digest" description="A summary of revenue and reports every Monday." /> <Checkbox label="Select all" checked="indeterminate" /> <Checkbox label="Required" description="You must accept to continue." invalid /> <Checkbox label="Disabled" disabled /> </div> );}Installation
npx shadcn add @dither/checkboxUsage
import { Checkbox } from "@/components/ui/checkbox";
<Checkbox label="Weekly digest" description="A summary every Monday." />Guidelines
- Use for independent choices and for agreeing to something; a single on/off setting that applies at once is a Switch.
- The label is the click target too; keep it positive ("Email me" rather than "Don't email me").
- Indeterminate for "some of the children" in a selectable list.
Props
Prop
Type
Examples
Box
light
dark
Code
import { Checkbox } from "@/components/ui/checkbox";export default function CheckboxBox() { return ( <div className="grid w-full max-w-sm gap-2"> <Checkbox variant="box" label="Share across devices" description="Focus mode follows you on every device." defaultChecked /> <Checkbox variant="box" placement="end" label="Email notifications" description="Get an email when a report is ready." /> </div> );}