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.

Anatomy

  1. Container: Wraps the input, label, and assistive text.
  2. Checkbox: Visually represents the current state as either a checkmark or horizontal dash.
  3. Label (optional): Describes what the Checkbox controls or represents. Can accept rich content.
  4. Assistive text (optional): Displays description or error text to aid the user.

Guidelines

Checkbox vs Radio and Toggle

The Checkbox, Radio, and Toggle components are all form controls that allow a user to select options. However, it's important to understand the difference as they are not interchangeable:

  • Checkboxes allow users to select zero or more options independently and allow deselection.
  • Radios are limited to only one choice in a group of options that cannot be deselected.
  • Toggles function similarly to real-world on/off switches. Form submission is not required; the setting takes effect immediately.

Standalone Checkboxes vs groups

Standalone Checkboxes are suitable for choices such as confirming an action, agreeing to terms, or enabling a single feature. Multiple options should be presented within a CheckboxGroup to take advantage of parent Checkbox controls and a shared label.

Best practices

Select all

When using a select all parent Checkbox, use Indeterminate to make it clear when not all options are selected.

Do: Show the parent Checkbox's indeterminate state when some children in a group are selected.
Don't: Show a checked parent when not all children are selected.

Behaviors

States

Base

Unchecked and checked Checkboxes show default styles with no user interaction.

Hover

On mouse hover, the border color updates for unchecked Checkboxes and the background color darkens for checked Checkboxes.

Focus

On keyboard focus, the Checkbox receives the standard 2px focus ring.

Disabled

Disabled Checkboxes cannot be interacted with. The background color updates to indicate the Checkbox is unavailable.

Danger

The Checkbox adopts the critical color treatment to indicate there's an error. An error message displays below the Checkbox when set.

Indeterminate

Indeterminate is a state represented by a horizontal dash instead of a checkmark and communicates partial Checkbox group selection. Within a group of Checkboxes, a parent Checkbox can control the state of its children. When only some children are selected, the parent checkbox adopts the indeterminate role.

The indeterminate state is unrelated to the checked state; a Checkbox may still be either checked or unchecked while indeterminate. This state is purely for visual communication.

Indeterminate

A dash icon replaces the checkmark to indicate partial selection within a controlled group.

Truncation

Truncation can be enabled for longer labels that would otherwise extend past the parent container. Truncation prevents text wrapping and will display an ellipsis to cut the label short when applicable.

Truncation

When enabled, truncation clips the label to prevent wrapping.

Content

Assistive text

Assistive text displays below the Checkbox and gives the user information about the form field they're interacting with. Assistive text comes in different forms including descriptions and error text.

Description

Descriptions provide extra context to the Checkbox option when the label itself will not suffice. Short phrases are preferred and end punctuation is unnecessary.

Do: Use a short phrase that provides extra information beyond the label.
Don't: Restate the label without adding new information.

Error

Error messages communicate issues with the Checkbox that the user must resolve before submission. Frame validation errors as direct instructions, not accusations. Be sure to provide guidance on how to fix the error. Keep messages direct and concise. Never use "Please".

Do: Note the specific problem and how to solve it.

Labels

Write labels that clearly describe what option the Checkbox controls or represents. Labels should be self-explanatory without relying on surrounding context.

For option Checkboxes, phrase labels as the setting or feature being enabled:

Do: Write clear statements of what is being enabled or disabled.
Don't: Use vague labels that don't explain the effect.

For confirmation or agreement checkboxes, use short first-person statements:

Do: Use first-person statements for confirmations and agreements.
Don't: Frame confirmations as commands.