A checkbox group enables the user to select one or more options from a list.
A checkbox group enables a user to select one or more options from a list. Use a checkbox group when:
If a user can only select one option from a list, use a select or radio group instead. If the potential responses can't be pre-defined, use a text field or text area.
An error message can also be displayed below the description when needed.
Radio groups support the following states:
Design system components are published in a Figma library. Install the library and add it to your project to start using this component.
A checkbox group has two parts:
Each part has its own set of controls.
If your use case requires hiding the group label, you must also provide a non-visible label using the aria-label property.
Detailed technical documentation, interactive previews and code samples are published in the B.C. Design System Storybook.
A reference implementation of the checkbox group component in React is published in the React components library. Install the package via npm to start using the component.
The component is comprised of two subcomponents:
The checkbox group component is a styled version of the React Aria CheckboxGroup. It uses Checkbox to populate individual list items.
Refer to the React Aria documentation for detailed information about:
These summaries reflect the component used as provided. If you modify it, confirm that your changes comply with the Web Content Accessibility Guidelines (WCAG). B.C. government digital services are required to meet the WCAG Level AA standard.
Requirement | WCAG Success Criterion | Validation |
---|---|---|
Make sure visual formatting is represented in the backend code | 1.3.1 (Level A) |
Group label and list are automatically associated via an aria-labelledby attribute |
Clearly define the purpose of input fields | 1.3.5 (Level AA) |
The checkbox group has a visible label, used to explain its purpose Note: if you do not use the label property, you must use aria-label to provide a semantic label |
Make websites keyboard accessible | 2.1.1 (Level A) |
Checkbox group is focusable and fully operable using only the keyboard, with visual indicators for focused elements |
Prevent keyboard navigation traps | 2.1.2 (Level A) |
When in focus, the user can exit the radio group by pressing the 'Tab' or 'Escape' keys |
Ensure content reads in the right order for people using assistive technology | 2.4.3 (Level A) |
Focus moves through list options vertically from top to bottom |
Show where the keyboard is active on the screen | 2.4.7 (Level AA) |
Focused elements are indicated with an offset border ring |
Make sure components can be read and used by assistive technology | 4.1.2 (Level A) |
Group label and list are automatically associated via an aria-labelledby attribute. The list has the "group" role |