Checkbox
A checkbox for one boolean field value, with an indeterminate state.
Usage guidelines
- Use
Checkboxfor one boolean field value saved with its form, or for one option insideCheckboxGroup. UseCheckboxGroupfor several values from a visible set,Switchfor an on/off setting that takes effect immediately, andTogglefor the pressed state of a button. - Label the checkbox with a visible
FieldLabelthat wraps it, so clicking the text toggles it. Usearia-labelonly when no visible label exists, because a non-blankaria-labeloverrides the associated label. - Use
indeterminatewhen the checkbox summarizes a partial selection. It is controlled by the owner, which clears it once the user decides. InsideCheckboxGroup, aparentcheckbox derives the mixed state on its own. Checkboxrenders a<span>with a hidden<input>beside it. Setname,valueanduncheckedValuefor native form submission.- Use
disabledfor a value the user cannot change, and say why inFieldDescription.readOnlykeeps the value visible and focusable without allowing changes.
Anatomy
Checkbox owns its indicator: a check mark when checked and a dash when indeterminate.
Examples
Indeterminate
indeterminate shows the mixed state and sets aria-checked="mixed". The owner turns it off when the user picks a side.
3 of 8 members already have the editor role.
Disabled
Set disabled on Field to disable the checkbox and its label together. The description explains why the value is fixed.
Your workspace signs in through SSO only.
Required by your Enterprise plan.
Read-only
readOnly keeps the checkbox focusable, readable and included in form submission without allowing changes.
Locked by workspace policy. Focusable and submitted with the form, but cannot be toggled.
Keyboard
| Key | Action |
|---|---|
| Space | Toggles the focused checkbox. |
| Tab | Moves focus to the next control. A disabled checkbox is skipped. |
API reference
Checkbox
A checkbox control supporting checked, unchecked, and indeterminate states. Renders a <span> element and a hidden <input> beside.
Pair with a visible FieldLabel or <label>; use aria-label only when no visible label exists.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: CheckboxRootState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, CheckboxRootState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: CheckboxRootState) => React.CSSProperties | undefined) | No default | |
nativeButton | boolean | false | |
id | string | No default | |
name | string | undefined | |
form | string | No default | |
checked | boolean | undefined | |
defaultChecked | boolean | false | |
disabled | boolean | false | |
onCheckedChange | ((checked: boolean, eventDetails: CheckboxRootChangeEventDetails) => void) | No default | |
readOnly | boolean | false | |
required | boolean | false | |
indeterminate | boolean | false | |
inputRef | React.Ref<HTMLInputElement> | No default | |
parent | boolean | false | |
uncheckedValue | string | No default | |
value | string | No default | |
| Attribute | Description |
|---|---|
data-checked | Present when the checkbox is checked. |
data-unchecked | Present when the checkbox is not checked. |
data-indeterminate | Present when the checkbox is in an indeterminate state. |
data-disabled | Present when the checkbox is disabled. |
data-readonly | Present when the checkbox is readonly. |
data-required | Present when the checkbox is required. |
data-valid | Present when the checkbox is in a valid state (when wrapped in Field.Root). |
data-invalid | Present when the checkbox is in an invalid state (when wrapped in Field.Root). |
data-touched | Present when the checkbox has been touched (when wrapped in Field.Root). |
data-dirty | Present when the checkbox's value has changed (when wrapped in Field.Root). |
data-filled | Present when the checkbox is checked (when wrapped in Field.Root). |
data-focused | Present when the checkbox is focused (when wrapped in Field.Root). |
CheckboxSkeleton
Accepts the props of the element it renders.