Forms
Checkbox
Boolean or tri-state control with a token-styled box. Supports color, error treatment, two sizes, label, required asterisk, and helper or error text.
Examples
States
Loading preview
<Checkbox label="Default" />
<Checkbox label="Checked" defaultChecked />
<Checkbox label="With error" error errorMessage="Required" />Label-less (table row selector)
Loading preview
<Checkbox size="small" inputProps={{ 'aria-label': 'Select row' }} />API
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | none | Visible label. |
checked / defaultChecked | boolean | none | Controlled or uncontrolled checked state. |
indeterminate | boolean | false | Mixed state, shown as a dash. |
error | boolean | false | Error treatment with red box. |
helperText / errorMessage | ReactNode | none | Helper or error text under the label. |
inputProps | AriaAttributes & { 'data-testid'?: string } | none | Attributes forwarded to the input — use aria-label to name a checkbox that has no visible label. |
style / className / event handlers | HTMLAttributes<HTMLSpanElement> | none | Standard DOM props (style, className, onClick, data-*, ...) are forwarded to the root wrapper; input-only attributes go through inputProps. |
Styling and attributes
Like every component, Checkbox accepts the universal token style props (m, p, sx, display, responsive maps, ...) and forwards standard DOM attributes (id, data-*, aria-*, event handlers) to the underlying element. See Styling for the full API.
Guidelines
Do
- Always provide a label, or an accessible name via inputProps aria-label.
- Use indeterminate for parent or select-all controls.
Avoid
- Do not use a checkbox for mutually exclusive options; use a radio or Select.