Checkbox

A yes or no that waits for a submit: agreeing to something, opting in. Black with a white tick when ticked, with an optional label and description. A setting that takes effect at once is a Switch instead. Built on the vendored Base UI checkbox.

Playground

Checkbox
State

States

Empty is an ink-tint edge on white, ticked is black. Asked for and missed, the edge turns the destructive red. Disabled dims the box and ignores presses.

With a label

label wraps the box in a real <label>: clicking the text ticks it, and the text names it. A description sits under the label and is read after it. A label can hold links; pressing one follows it and leaves the box as it was.

API reference

PropTypeDefaultDescription
checkedboolean—Controlled state. Pair with onCheckedChange.
defaultCheckedbooleanfalseInitial state when uncontrolled.
onCheckedChange(checked: boolean, details) => void—Called with the new state on every tick.
labelReactNode—Visible text in a wrapping <label>: clicking it ticks, and it names the box. Can hold links.
descriptionReactNode—A quieter line under the label, read after its name. Needs label.
aria-invalidboolean—Asked for and missed: the edge turns the destructive red. Say why in the description.
disabledbooleanfalseIgnores presses and dims the box; a label's text goes muted.
classNamestring—Layout for the outermost element: the label when there is one.