Checkbox
A square that picks items out of a list, with a mixed state for a header box.
import { Checkbox } from "@arcadia/ui"1 selected
TSX
For picking items out of a list (bulk actions on rows); an on/off setting is a Switch. The box is 16px in a 20px target, so it lines up with a row's icon slot. checked="mixed" draws the dash for a header box over a partial selection; toggling it checks everything.
Examples
rootStyle takes layout and the checked fill and mark.
| Knob | Takes | Default | Sets |
|---|---|---|---|
Paint | var(--bg-inverse) | The box's fill when checked or mixed. | |
Paint | var(--text-inverse) | The mark's colour when checked or mixed. |
A button with role="checkbox" and aria-checked (true, false or mixed), named by label: say what it selects ("Select Fix the pricing bug"), since the row's text is not its name. Space and click toggle it; it never submits a form. Disabled boxes keep their place and leave the tab order.
Checkbox
checked- boolean | "mixed"
- Controlled state;
"mixed"for a header box over a partial selection. defaultChecked- booleanDefaultfalse
- Initial state when uncontrolled.
onCheckedChange- (checked: boolean, details: { event: Event }) => void
- Called with the new state when the box toggles (mixed always goes to checked).
labelrequired- string
- Required: the accessible name ("Select Fix the pricing bug"). A checkbox in a row names what it selects.
rootStyle- CheckboxStyle
Rest props go to <button> props.