Componentsv2.189.1
Iconsv1.19.0
MCPv0.8.62
Tokensv0.34.3

Checkboxes allow users to select one or more items from a group of options.

Structure

The Checkbox component is built using a native HTML <input type="checkbox"> element. The input is visually hidden but remains in the accessibility tree, while a custom-styled <div> provides the visual appearance. Its <label> element points to the input's id to allow the Checkbox to be toggled when clicking the label.

Assistive text (description and error) renders in separate elements below the input. Their IDs are automatically linked to the input through the aria-describedby attribute so that assistive technology will properly announce them.

ARIA

table
ElementAttributeDescription
Inputaria-describedbyReferences the assistive text element. Error text takes precedence over visible descriptions. Custom text may be set.
Inputaria-labelProvides an accessible name when no visible label is rendered.
Inputaria-labelledbyReferences the visible label element's ID. When a custom ariaLabelledby prop is also provided, both IDs are included so the input is named by all referenced elements.

Labels

We highly recommend adding visible labels with the label prop to prevent a lapse in communication. If a visible label is unneeded for the use case, such as a Checkbox in a table row, add an ariaLabel or ariaLabelledby so assistive technology will announce the Checkbox to the user. Omitting a label will result in an error.

Indeterminate state

The Indeterminate state is set through a DOM property for visual feedback regarding the state of a Checkbox group. Screen readers will announce indeterminate checkboxes as "mixed." The Checkbox's underlying state may still be either checked or unchecked.

Keyboard

table
KeyFunction
SpaceToggles the Checkbox between checked and unchecked.
TabMoves focus to the next focusable element.
Shift+TabMoves focus to the previous focusable element.

On this page