Checkbox
Renders a checkbox input with support for checked, unchecked, and indeterminate states.
Usage
import { Checkbox, CheckboxProps } from "@desk/ui/components/checkbox";Best practices
A bare
Checkboxhas no label — pair it with aLabel(htmlFor) or useCheckboxField, which wiresid/htmlFor/aria-describedbyfor you.Set the tri-state via
indeterminate(sugar forchecked="indeterminate"), never by passing the string"indeterminate"tocheckedyourself.Controlled use needs
checked+onCheckedChangetogether; passing onlycheckedfreezes the box — usedefaultCheckedfor uncontrolled.For a selectable card or a label+description row, reach for
CheckboxCardGroup/CheckboxFieldinstead of hand-laying-out aroundCheckbox.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| indeterminate | boolean | undefined | When true, displays an indeterminate state (dash icon). This is syntactic sugar for checked="indeterminate". | |
| size | ResponsiveSize | "xs" | Checkbox size — a single token or a per-breakpoint object like
|
Also exports
- type
CheckboxProps
Composition
Used by