Vesyl UI

Checkbox

A toggle for a single boolean value. Built on base-ui Checkbox — focus management, keyboard support, and ARIA wiring come for free.

Checkbox renders only the box. Give it an id and pair it with a FieldLabel (inside a Field) or a Label so the label text is clickable and the control is announced. See Field for the layout primitives.

With a label

Wrap the box and its label in a Field orientation="horizontal", and connect them with id / htmlFor. Clicking the label toggles the box.

Checked by default

Checkbox is uncontrolled by default — pass defaultChecked to start it on. To drive the value yourself, pass checked together with onCheckedChange (which receives the next boolean directly).

Disabled

disabled dims the control and blocks interaction. It works with both the unchecked and checked states.

Indeterminate

indeterminate renders a minus glyph instead of a check — the third “partially selected” state used for a parent that controls a group. It is purely visual; track the real value yourself and clear it once the user commits a choice.

Group / list

For a list of options, render one Checkbox per item and keep the selection in state. Wrapping each row in a Label makes the whole row a click target; data-checked lets you highlight the selected rows.

Reference

Checkbox

Extends base-ui Checkbox.Root props (minus onChange).

PropTypeDefaultDescription
checkedbooleanControlled checked state
defaultCheckedbooleanfalseInitial checked state (uncontrolled)
onCheckedChange(checked: boolean) => voidFires when the state changes; receives the next boolean directly
indeterminatebooleanfalseRenders the partial-selection (minus) glyph; visual only
disabledbooleanfalseDims the control and blocks interaction
idstringConnects the box to a FieldLabel / Label via htmlFor
namestringField name when submitted as part of a native form
valuestringSubmitted value when checked
requiredbooleanfalseMarks the field as required in a form
classNamestringMerged onto the box