Checkbox
One yes-or-no choice inside a form, applied when the form is saved. The label is part of the component, because a checkbox reads on one line rather than under a heading.
Reach for it
An independent yes or no, or several answers from a set.
Not for
One answer from a set, which is a Radio group, or a setting that applies immediately, which is a Switch.
States
For a setting that takes effect the moment it is pressed, use a Switch instead. For one choice among a few, use a Radio group: a row of checkboxes says any number of these, which is a different question.
API reference
Checkbox
| Prop | Type | Default | Description |
|---|---|---|---|
| label* | string | - | Text beside the box. Required, and always passed in: the package ships no copy. |
| data-testid | string | - | Names the element for a test. Never rendered, never announced. |
| checked | boolean | - | |
| defaultChecked | boolean | - | |
| onCheckedChange | (checked: boolean) => void | - | |
| isIndeterminate | boolean | - | Base UI models the mixed state as its own prop rather than a third value of `checked`, which keeps the callback a plain boolean. |
| isDisabled | boolean | - | |
| isLabelHidden | boolean | - | Hides the label visually while keeping it announced, for table cells. |
| name | string | - | |
| value | string | - |