Checkbox
A control that toggles between checked and unchecked.
Default
Pass the label as children so the text and control share one hit target.
Sizes
The default size is sm (16px). md is 20px and lg is 24px.
Without label
In table rows, omit children and give each checkbox an aria-label that names the row.
Disabled
Error
Set aria-invalid for the danger ring and point aria-describedby at the message.
Confirm recording consent to publish this agent.
Best practices
When to use
- Use for additive selection, acknowledgements, and multi-select lists.
- Use Switch for one immediate on/off setting and Radio for one choice from mutually exclusive options.
Behavior
- Put the label in Checkbox children so the text and control share one hit target.
- Use size sm (16px) by default. Use md or lg only when the checkbox sits beside larger type.
- Validate required acknowledgements on submit, not on every toggle. Set aria-invalid to show the danger ring.
Content
- Write labels as the thing that becomes true when checked, such as “Send a transcript after each call”.
Accessibility
- Group related choices in a Fieldset. Give row-selection checkboxes an aria-label that names the row, such as “Select call from +1 415 555 0132”.
- Point aria-describedby at the error message when using aria-invalid.