Elements

Components

Checkbox

Checkbox, dressed in the paper-and-ink system: a square-cut seal that fills flat with primary ink when ticked, the mark springing into place. The parts — Root, Label, Control, Indicator, HiddenInput.

#Basic usage

checkbox/basic Vue React

#Props

#Control

A styled part — no props of its own; it takes the anatomy's shared styling.

#GroupProvider

PropTypeDefaultDescription
valueUnwrapRef<UseCheckboxGroupReturn>—

#Group

PropTypeDefaultDescription
defaultValuestring[]The initial value of value when uncontrolled
disabledbooleanIf true, the checkbox group is disabled
invalidbooleanIf true, the checkbox group is invalid
maxSelectedValuesnumberThe maximum number of selected values
modelValuestring[]The controlled value of the checkbox group
namestringThe name of the input fields in the checkbox group (Useful for form submission).
readOnlybooleanIf true, the checkbox group is read-only

#HiddenInput

A styled part — no props of its own; it takes the anatomy's shared styling.

#Indicator

PropTypeDefaultDescription
indeterminateboolean—

#Label

A styled part — no props of its own; it takes the anatomy's shared styling.

#Root

PropTypeDefaultDescription
sizeString as PropType<"sm" | "md" | "lg">"md"One rung for the control's box: the tick scales with it.
checkedcheckbox.CheckedStateThe controlled checked state of the checkbox
defaultCheckedcheckbox.CheckedStateThe initial checked state of the checkbox when rendered. Use when you don't need to control the checked state of the checkbox.
disabledbooleanWhether the checkbox is disabled
formstringThe id of the form that the checkbox belongs to.
idstringThe unique identifier of the machine.
idsPartial<{ root: string; hiddenInput: string; control: string; label: string; }>The ids of the elements in the checkbox. Useful for composition.
invalidbooleanWhether the checkbox is invalid
namestringThe name of the input field in a checkbox. Useful for form submission.
readOnlybooleanWhether the checkbox is read-only
requiredbooleanWhether the checkbox is required
valuestring"on"The value of checkbox input. Useful for form submission.