Skip to content
Mosaic
On this page

Checkbox

A native input type="checkbox" with a styled indicator for checked and indeterminate. Inside a Field it takes the field's id, disabled, required and ARIA wiring.

Use for

  • a checkbox in a form
  • a select-all checkbox with an indeterminate state
  • a row selection checkbox

Practices

GuidancePractice
DoPut it in a Field with a Field.Label so it gets a label and its messages.
DoUse indeterminate for a select-all when only some rows are selected.
Don’tExpect xstyle to reach the input. It styles the wrapper (cl-checkbox); every other prop and the ref go to the input.

API reference

Checkbox

A wrapper span around the input (cl-checkbox-input) and two indicators (cl-checkbox-indicator with data-state). The wrapper carries data-size and data-disabled.

Slot: cl-checkbox

PropTypeDescription
size'sm' | 'md'sm or md.Default: 'md'
indeterminatebooleanSets the input to its indeterminate state.Default: false

Examples

In a field

TSX
<Field.Root orientation='horizontal'>
  <Checkbox checked={accepted} onChange={e => setAccepted(e.target.checked)} />
  <Field.Content>
    <Field.Label>{m.acceptTerms}</Field.Label>
  </Field.Content>
</Field.Root>