Use radio button instead if:
+If only one option in a group can be selected, use radio button:
- ![]() ![]() |
+
+ ![]() |
- Only one option in a group can be selected. |
If the behavior in the "off" state is unclear from the checkbox label, use two radio buttons instead + and label them accordingly:
+
- ![]() ![]() |
- The behavior in the "off" state is unclear from the checkbox label. Use two radio buttons instead - and label them accordingly + |
+ ![]() |
If a label is long, split it into two lines. Use HTML formatting for that. Avoid labels that take more than two lines. See recommendations on writing concise labels below.
-
- ![]() |
-
- ![]() |
-
+ ![]() |
+
+ ![]() |
+
If a checkbox appears in a table, place the label into the column header and do not repeat it on every row:
@@ -107,24 +120,20 @@In a group of options, use the parent checkbox to show the status of its children:
+In a group of options, use the parent checkbox to show the status of its children. The state of the parent checkbox can be checked, indeterminate or unchecked. When a user clicks an indeterminate checkbox for the first time, the whole group becomes checked. The second click unchecks the whole group. +
The parent checkbox in checked, indeterminate and unchecked states.
ThreeStateCheckBox
class which represents its state with the ThreeStateCheckBox.State
enum containing SELECTED,
NOT_SELECTED, DONT_CARE
states.When the user clicks an indeterminate checkbox for the first time, the whole group becomes checked. The - second click unchecks the whole group.
-An indeterminate checkbox can also show the download status. An example with a remote repository:
+An indeterminate checkbox can also show the download status. In the example below, a remote repository with Repositories "tools-base" and "contrib" are being loaded. When loading is finished, the indeterminate checkbox will be replaced with the checked checkbox if there are commits, or an unchecked checkbox if there are no commits.
- Repositories "tools-base" and "contrib" are being loaded. When loading is - finished, the indeterminate checkbox will be replaced with the checked checkbox if there are - commits, or an unchecked checkbox if there are no commits. -
In a table, the three-state checkbox is represented by ThreeStateCheckBoxRenderer
that provides both TableCellRenderer
and TableEditor
.
@@ -133,10 +142,10 @@
Otherwise, it becomes SELECTED
for Boolean.TRUE
, and NOT_SELECTED
for Boolean.FALSE
.
@@ -149,8 +158,7 @@ |
@@ -163,8 +171,7 @@ |
@@ -177,8 +184,7 @@ |
@@ -192,16 +198,15 @@ |
Follow
If a checkbox depends on another control, for example, an input field, follow the rules for dependent controls. Otherwise, follow the rules for independent controls.