Overview
The checkbox component allows the user to to select one or more options from a list of choices.
When to use
- To present multiple options where one or more can be selected.
- When selection doesn’t take immediate effect and requires form submission.
When not to use
Anatomy
- Checkbox
- CheckboxInput
- Label
Variants & States
States
Checkbox interaction states are default, hover, disabled, and hasError. Checkbox selection states are checked=true and checked=false. The focus state is globally defined, and no special adjustment is made to this component. Checkboxes can be configured to display checked, unchecked, or disabled.
checkboxGroup
If there is the need to have multiple checkboxes displayed as part of the same fieldset, we provide the checkboxGroup component. The vertical spacing between checkboxes is spacing-3 and ensures consistent spacing throughout your form.
Internationalization
For RTL (right-to-left), the layout of the checkbox is mirrored.
Properties
| Name | Type | Values | Description |
|---|---|---|---|
| checked | Boolean | truefalse |
Specifies whether the checkbox should be checked by default |
| disabled | Boolean | truefalse |
Sets the checkbox to appear disabled, preventing user interaction |
| required | Boolean | truefalse |
Specifies if the checkbox is required |
| value | String | Text that represents the value of the checkbox when it’s checked | |
| id | String | Defines a unique identifier for the checkbox |
Usage Guidelines
Content Guidelines
We use checkboxes to let users select one or more options from a list, or to toggle a feature on or off.
Voice and tone
We maintain a clear and straightforward language.
Copy
- We clearly indicate what the user is opting in or out of.
- We use sentence case for checkbox labels.
- We phrase the label as a direct statement that becomes true when checked.
- We use plain language.
- We don’t use punctuation at the end of the label.
- For consent, we use “I agree…”
- If we’re short on space, we reword the label. We don’t truncate checkbox label text with an ellipsis.
- Long labels may wrap to a second line, and we prefer this to truncation.
Accessibility
- We ensure every checkbox has a visible, associated label. The label text is what the screen reader announces to describe the checkbox selection.
- We ensure the label text clearly states the consequence or selection being made. The screen reader must say whether the checkbox is selected or not and its role (checkbox).
- If we use a set of related checkboxes, we group them and provide a descriptive label for the group, which is announced first by the screen reader.
- Users move through a set of checkboxes using standard navigation keys, with the state of each element being clearly announced upon focus.