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

PropTypeDefaultDescription
label*string-Text beside the box. Required, and always passed in: the package ships no copy.
data-testidstring-Names the element for a test. Never rendered, never announced.
checkedboolean-
defaultCheckedboolean-
onCheckedChange(checked: boolean) => void-
isIndeterminateboolean-Base UI models the mixed state as its own prop rather than a third value of `checked`, which keeps the callback a plain boolean.
isDisabledboolean-
isLabelHiddenboolean-Hides the label visually while keeping it announced, for table cells.
namestring-
valuestring-