Checkbox
Checkboxes allow users to make binary selections, opt in to preferences, and choose multiple independent options. Use clear labels so users understand the consequence of each selection.
Checkbox
Features
- Optional labels and supporting descriptions for each checkbox.
- Grouped usage through CheckboxGroup with a semantic fieldset and legend.
- Visible checked, focus, and disabled states using semantic design tokens.
- Supports standard native checkbox behavior and attributes.
When to use
Accessibility
Best Practices
Use Descriptive Labels
Write labels that describe the exact choice or commitment being made, such as 'Send me weekly product updates'.
Use Descriptions for Clarity
Add a description when the label alone is not enough to help users understand the option.
Group Related Options
Use CheckboxGroup with a meaningful legend when checkboxes answer a shared question or belong to the same category.
Use for Independent Choices
Use checkboxes only when options are independent and multiple selections are valid.
Use Vague Labels
Avoid labels like 'Option 1' without context because they force users to guess what each choice means.
Use for Mutually Exclusive Choices
Do not present mutually exclusive options as checkboxes. Use radios when only one selection is allowed.
Rely on Surrounding Layout Alone
Do not rely on surrounding content or layout to explain what a checkbox controls without a clear label.
Hide Consequences from the Label
Do not hide important consequences or requirements away from the checkbox label or description.
Disable Without Context
Do not disable options without giving users enough context when the reason affects completion.
Props API
| Name | Type | Description |
|---|---|---|
| label | React.ReactNode | Optional visible label associated with the checkbox input. |
| description | React.ReactNode | Optional supporting text rendered below the label and connected with aria-describedby. |
| id | string | Optional explicit ID for label and description association; otherwise generated internally. |
| legend | React.ReactNode | Required CheckboxGroup legend for grouped checkbox sets. |
| ...props | React.InputHTMLAttributes<HTMLInputElement> | Native checkbox attributes such as checked, defaultChecked, disabled, required, name, value, and onChange. |
| ...props (group) | React.FieldsetHTMLAttributes<HTMLFieldSetElement> | Native fieldset attributes for grouped checkbox layouts. |