Documentation

Documentation versions (currently viewingVaadin 23)

You are viewing documentation for Vaadin 23. View latest documentation

Checkbox

Checkbox is an input field representing a binary choice. Checkbox Group is a group of related binary choices.

Open in a
new tab
Source code
checkbox-basic.ts
CheckboxBasic.java
Open in a
new tab
Source code
checkbox-group-basic.ts
CheckboxGroupBasic.java

Use Checkbox Group to group related items. Individual checkboxes should be used for options that aren’t related to each other in any way.

Common Input Field Features

Checkbox Group includes all shared input field features.

States

Disabled

Disable a field to mark it as currently unavailable. Disabled state is used for fields that aren’t editable and don’t need to be readable. Disabled elements can’t be focused and may be inaccessible to assistive technologies like screen readers.

Disabling can be preferable to hiding an element to prevent changes in layout when the element’s visibility changes, and to make users aware of its existence even when currently unavailable.

Open in a
new tab
Source code
checkbox-disabled.ts
CheckboxDisabled.java
Note
Read-only state
Checkbox doesn’t support read-only state.

Indeterminate

The indeterminate state can be used for a parent checkbox to show that there is a mix of checked and unchecked child items in a list, and to change the state of all child items at once.

Open in a
new tab
Source code
checkbox-indeterminate.ts
CheckboxIndeterminate.java

Orientation

The component’s default orientation is horizontal but vertical orientation is recommended whenever possible as it’s easier for the user to scan a vertical list of options:

Open in a
new tab
Source code
checkbox-vertical.ts
CheckboxVertical.java

In cases where vertical space needs to be conserved, horizontal orientation can be used, but no more than 3 options are recommended:

Open in a
new tab
Source code
checkbox-horizontal.ts
CheckboxHorizontal.java

Best Practices

Labeling

Aim for short and descriptive labels using positive wording. Avoid negations.

Open in a
new tab
Source code
checkbox-labeling.ts

It’s important to provide labels for Checkbox Groups to clearly distinguish adjacent groups.

Open in a
new tab
Source code
checkbox-adjacent-groups.ts
CheckboxAdjacentGroups.java
Component Usage recommendations

Select

A field for selecting an item from a list of options which are presented in an overlay. Recommended when there is insufficient space for a Radio Button Group.

Combo Box

A filterable, lazy loading alternative to Select, recommended for ten or more items.

List Box

Scrollable list of options. Supports single and multi-select.

Radio Button Group

Corresponding component for mutually exclusive options, or “single-select”.

F86F2BE5-1BDA-4E79-BD9E-6CE12742450B