Skip to main content

Checkbox

Note: There are deprecated versions of this component. Switch to a version of the docs older than 10.0.x to view their docs.

Usage

Overview

Checkboxes enable users to select from a list of items. They often appear in forms, where there is a need to collect user information. When using checkboxes, users can select one or more items from a set.

For a detailed guide on when to use this component, explore the following UI component decision tree.

UI component decision tree for checkbox
group

When to use

  • Use the checkbox group when there are multiple options to select independently of each other.
  • Use the checkbox group when a user needs to see all options in one place (without additional interactions).
  • Use a single checkbox when there is only one option to select.

When not to use

  • When an action must be applied instantly. Use the switch component instead.
  • If a user can select only one option from a list. Use the radio group component instead.
  • When there are 6 or more options from which users can choose. Use the dropdown component instead.

Source: Nielsen Norman Group

Do use radio buttons when only one option can be selected at a time.
Don't use checkboxes when only one option can be selected at a time.

Types

Checkboxes come in the form of a checkbox group or single checkbox.

Checkbox group

A checkbox group is a list of checkbox items under one group label. Users can select all items that are relevant under the group label. This format is useful when there are multiple valid options for a single instance.

Single checkbox

Jutro also accommodates checkboxes with a single item. Note that checkboxes can be used to turn an option on or off (for example, when enabling or disabling a setting).

Checkbox variations
Checkbox group (left) and single checkbox (right).

Formatting

Anatomy

Checkbox anatomy

The checkbox consists of the following elements:

  1. Checkbox group label: Explains the purpose of the checkbox group.
  2. Helper text (optional): Gives additional context for the checkbox group.
  3. Checkbox input: Indicates the appropriate state. By default it's unselected.
  4. Checkbox label: Describes the information that's going to be selected or unselected.
  5. Tooltip icon (optional): Serves to disambiguate the context for a given checkbox. The tooltip appears when hovered.

Alignment and placement

A checkbox group can be arranged vertically or horizontally depending on the page structure. By default, checkboxes are arranged vertically for easier reading.

As is the case with all input components, the label for the checkbox group can appear at the top (default) or on the left of the input itself.

image that illustrates the alignment and placement of the checkbox component

Content

General writing guidelines

  • Use sentence case for all aspects of designing Guidewire product interfaces. Don't use title case.
  • Use present tense verbs and active voice in most situations.
  • Use common contractions to lend your copy a more natural and informal tone.
  • Use plain language. Avoid unnecessary jargon and complex language.
  • Keep words and sentences short.

Label checkbox groups

Checkbox groups must have a label that describes what the list of options represents. A checkbox group without a label is ambiguous and not accessible.

Use the group label to state the category of the grouping or describe what actions to take below.

Do include a label that clearly describes what the list of options represents.
Don't assume that the options are self-explanatory without a label.

Use clear, consistent checkbox labels

  • Try to make all labels in a checkbox group as parallel as possible. They should follow the same format and be approximately the same length.
  • Use labels that are clear, concise, and unambiguous. Labels should describe options that are easy for average users to understand.
  • Use positive and active wording for checkbox labels. Make it clear what will happen if the user checks a particular box, and what will happen if they leave it unchecked.
  • Avoid negations such as "Don't send me email notifications". This would mean that the user would have to check the box in order for something not to happen.
  • When asking the user for their consent, use the first person. For example, “I agree to the terms of service”.

Reference: Nielsen Norman

Do use parallel phrasing and try to keep the length about the same for all labels.
Don't use widely varied wording. This may slow down or even confuse users.

Keep checkbox labels concise

Limit the checkbox text label to a single line. We recommend using one to three words for checkbox labels.

Don't truncate checkbox labels with an ellipsis (...). If the label is too long for the horizontal space available, consider rewording it. You can also wrap long checkbox labels to a second line. This is preferable to truncation.

Do keep checkbox label text concise. If necessary, wrap to a second line.
Don't truncate checkbox label text with an ellipsis.

Use error text to guide users

Checkbox groups and checkboxes can include error messages to show that a selection is required to move forward, or that a selection that was made is invalid.

Use sentence case for error text. Write 1-2 short, complete sentences that end with a period.

Do use error text to guide the user and show them a solution.
Don't write ambiguous error messages or leave users guessing as to how to resolve a problem.

Mark required fields

Use an asterisk (*) to indicate required fields. The asterisk precedes the field label. This helps users to easily locate which fields are required by scanning just the left-most character of the label.

In addition to marking required fields with an asterisk, it is recommended to include clear instructions at the top of the form, such as "All fields marked with an asterisk are mandatory," to ensure users understand the meaning of the asterisk.

Do use an asterisk to indicate that a field is required.
Don't use an asterisk to denote anything that is optional.

Use sentence case

Group labels and checkbox labels appear in sentence case.

Refer to the UI text style guide for more information on how to implement sentence case.

Do use sentence case.
Don't use title case.

Behaviors

States

The checkbox component has 2 main states: unchecked and checked. Checkboxes default to having none of the options selected.

In addition to the unchecked and checked states, checkboxes also have interactive states for enabled, disabled, hover, focus, active, and error.

VisualStateDescription
Enabled stateEnabledCommunicates to the user that the element is enabled for interaction (default)
Disabled stateDisabledCommunicates to the user that the element is not currently available for interaction.
Hover stateHoverIndicates that the user has placed a cursor over the element (desktop only).
Focus stateFocusIndicates that the user has highlighted the element, typically using an input method such as a keyboard or voice.
Active stateActiveIndicates that the user is clicking or tapping the element.
Error stateErrorIndicates that the user has not checked all required fields (or other form-related error).

Interactions

Mouse

Users can select an option by clicking on either the checkbox itself or its label. Research shows that a bigger target is faster to click.

Keyboard

When the checkbox has focus, pressing the Space key changes the state of the checkbox. This follows the standards established by the World Wide Web Consortium (W3C).

Screen reader

For the checkbox group: The checkbox group implements <input type='checkbox'>. The group derives its accessible name from the group label. This can be changed using the label field in Storybook. A 'for/id' association is implemented to associate each individual checkbox with its label, while the 'checked/unchecked' state of the element is communicated through the aria-checked attribute.

For the single checkbox: The checkbox element is programmatically associated with its label. This means that users can use the TAB key to navigate through elements, and their respective labels will be voiced by screen readers. The 'checked/unchecked' state is communicated through the aria-checked attribute.

Accessibility

The contrast ratio of textual elements against their background is above 4.5:1 as per WCAG 2.1 AA requirements. Non-textual content that needs to convey meaning (such as icons and keyboard focus visibility) has a contrast ratio of at least 3:1 with its adjacent colors. All content is visible and functional up to and including 400% without requiring scrolling in two dimensions.

This component has been validated to meet the WCAG 2.1 AA accessibility guidelines. However, changes made by the content author can affect accessibility conformance.

Follow the guidance below and also refer to the WAI-Authoring Practices for Checkboxes when using this component in your applications:

  • Checkbox labels must be clear and concise.
  • Users must be informed if selecting a checkbox causes a change of context.