Difference between revisions of "KDE Visual Design Group/HIG/CheckBox"

Jump to: navigation, search
(Added implementation links)
(Move notice)
 
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
  
== Purpose ==
+
{{Note|This page is now on [[https://hig.kde.org/components/editing/checkbox.html https://hig.kde.org/]]}}
A ''check box'' is a control that permits the user to make multiple selections from a number of options. Check boxes are used to toggle an option on or off, or to select or deselect an item. Users make a decision between two clearly opposite choices, e.g. 'on vs. off', 'apply vs. don't apply', 'show vs. hide'.
 
 
 
== Example ==
 
== Guidelines ==
 
=== Is this the right control ===
 
* Use check boxes for non-exclusive options that have clear alternatives. Mutually exclusive options should use a set of [[KDE_Visual_Design_Group/HIG/Radio_Buttons| radio buttons]] or a [[KDE_Visual_Design_Group/HIG/Combo_Box| combo box]].
 
 
 
{| style="border-spacing: 20px 0px; border-collapse: separate; margin: 5px 0 20px 0;"
 
| style="width: 160px;"|[[Image:Ambiguous_Opposite_Bad.qml.png|160px|center]]
 
| style="width: 160px;"|[[Image:Ambiguous_Opposite_Good.qml.png ‎|160px|center]]
 
|-
 
| style=" vertical-align: top;"|<span style="color: red;">BAD</span><br/>Do not use a check box if the opposite is ambiguous.
 
| style=" vertical-align: top;"|<span style="color: green;">GOOD</span><br/>Using two radio buttons instead of a check box removes the need to guess.
 
|}
 
 
 
* For more than five options, use either a [[KDE_Visual_Design_Group/HIG/ListView| list view]] or the [[KDE_Visual_Design_Group/HIG/SOU_Workspace/Two_Lists | dual-list pattern]] in case of multiple selections.
 
* Do not use the selection to perform commands.
 
{| style="border-spacing: 20px 0px; border-collapse: separate; margin: 5px 0 20px 0;"
 
| style="width: 160px;"|[[Image:No_Command_2_Bad.qml.png|160px|center]]
 
| style="width: 160px;"|[[Image:No_Command_2_Good.qml.png ‎|160px|center]]
 
|-
 
| style=" vertical-align: top;"|<span style="color: red;">BAD</span><br/>Do not use the selection to perform commands.
 
| style=" vertical-align: top;"|<span style="color: green;">GOOD</span><br/>Consider using a [[../Buttons|push button]] instead.
 
|}
 
 
 
 
 
===  Behavior ===
 
* Checking a check box should always "enable" an option or change the state of an option to "on".  Checking a negative or disabling option is a double negative and causes confusion and errors.
 
{| style="border-spacing: 20px 0px; border-collapse: separate; margin: 5px 0 20px 0;"
 
| style="width: 320px;"|[[Image:Checkbox_Enable_Bad.qml.png|320px|center]]
 
| style="width: 320px;"|[[Image:Checkbox_Enable_Good.qml.png ‎|320px|center]]
 
|-
 
| style=" vertical-align: top;"|<span style="color: red;">BAD</span>
 
| style=" vertical-align: top;"|<span style="color: green;">GOOD</span>
 
|}
 
 
 
* Use the mixed state only to indicate that an option is set for some, but not all, child objects. Mixed state must not be used to represent a third state.
 
[[Image:Checkbox_Mixed_State.qml.png|frame|center]]
 
 
 
* Users must not be able to set a mixed state directly.
 
* Clicking a mixed state check box enables all child objects.
 
* Do not use sliding switches in Desktop applications. They only offer good user interaction on touch screens, so they should only be used in applications for [http://community.kde.org/Plasma/Active Plasma Active].
 
{| style="border-spacing: 20px 0px; border-collapse: separate; margin: 5px 0 20px 0;"
 
| style="width: 320px;"|[[Image:Checkbox_Switch_Desktop.qml.png|320px|center]]
 
| style="width: 320px;"|[[Image:Checkbox_Switch_Mobile.qml.png ‎|320px|center]]
 
|-
 
| style=" vertical-align: top;"|<span style="color: red;">BAD</span><br/>
 
| style=" vertical-align: top;"|<span style="color: green;">GOOD</span>
 
|}
 
 
 
=== Appearance ===
 
If you are using qt widgets you should use one of Qt's Layout Classes like {{qt|QFormLayout}} , that will take care of lay outing and spacing of your controls.
 
 
 
* The text of a check box is on the right of its tick rectangle, which can make it difficult to avoid blank areas on the left side of the form. To keep the layout of the form balanced you can use one of the following approaches:
 
** Group check boxes together in the widget column and add a label describing the group in the label column.
 
**: [[Image:Grouped_checkboxes.qml.png|frame|center|Grouped checkboxes]]
 
** Make the check boxes span the two columns, but keep them at the bottom of the form. <font color="blue">Remark: This interferes with other layout guidelines</font>
 
**: [[Image:Two_column_checkboxes.qml.png|frame|center|Checkboxes spanning two columns]]
 
** If all else fails, add a label describing the checkbox on the left side of the checkbox, then set the text of the checkbox to "Enabled", "On", or similar.
 
**: [[Image:Checkbox_separate_label.qml.png|frame|center|Using a separate title label for the checkbox.]]
 
* When options are subordinate to a check box (e.g. Audio level can only be set if the Activate Audio option is selected), this relation should be visualized by indenting the sub-options. There are two options to do so:
 
** When you are using a left-aligned check box, indent the sub-options by using a horizontal spacer of SizeType "Minimum".
 
**: [[Image:Suboption_spacer.qml.png|frame|center|Aligning sub-options with a horizontal spacer of SizeType "Minimum".]]
 
** When you are using a check box that is placed right to its label, indent the sub-options in the same vertical axis as the check box.
 
**:  [[Image:Suboption_right.qml.png|frame|center|Aligning sub-options with the same vertical axis as the checkbox itself.]]
 
 
 
* If activating a choice affects the appearance or the enabled state of other controls, place them next to the check box (group).
 
* Align check boxes vertically rather than horizontally, as this makes them easier to scan visually. Use horizontal or rectangular alignments only if they greatly improve the layout of the window.
 
* If certain controls in a configuration dialog are only relevant if a certain check box is checked (i.e. they are dependent controls), disable them instead of hiding them if that check box is unchecked.
 
 
 
* Do not separate check box and label. Clicking on both the box and the label should toggle the option.
 
*: [[File:HIG_Checkbox5.png]]
 
* Do not add line breaks. If necessary place an additional label below the check box.
 
{| style="border-spacing: 20px 0px; border-collapse: separate; margin: 5px 0 20px 0;"
 
| style="width: 320px;"|[[Image:Checkbox_Alignment_Bad.qml.png|320px|center]]
 
| style="width: 320px;"|[[Image:Checkbox_Alignment_Good.qml.png ‎|320px|center]]
 
|-
 
| style=" vertical-align: top;"|<span style="color: red;">BAD</span>
 
| style=" vertical-align: top;"|<span style="color: green;">GOOD</span>
 
|}
 
 
 
* Label a group of check box with a descriptive caption to the top left of the group (cf. [[KDE_Visual_Design_Group/HIG/Alignment| Alignment]]).
 
* Create a buddy relation so access keys are assigned.
 
* Use [[KDE_Visual_Design_Group/HIG/Capitalization|sentence style capitalization]] for check box items.
 
* Do not use ending punctuation (neither dot nor colon) for group label.
 
 
 
== Implementation ==
 
=== qwidget ===
 
* {{qt|QCheckBox}}
 
 
 
=== QML ===
 
* [http://doc.qt.io/qt-5/qml-qtquick-controls-checkbox.html QML CheckBox]
 
* [https://api.kde.org/frameworks/plasma-framework/html/classorg_1_1kde_1_1plasma_1_1components_1_1CheckBox.html Plasma CheckBox]
 
* [http://doc.qt.io/qt-5/qml-qtquick-controls-switch.html QML Switch]
 
* [https://api.kde.org/frameworks/plasma-framework/html/classorg_1_1kde_1_1plasma_1_1components_1_1Switch.html Plasma Switch]
 
 
 
[[Category:Usability]]
 
[[Category:Behavior|Check Box]]
 
[[Category:Editing_and_Manipulation]]
 
[[Category:Selection]]
 

Latest revision as of 16:43, 5 February 2019


Note-box-icon.png
 
Note
This page is now on [https://hig.kde.org/]

This page was last edited on 5 February 2019, at 16:43. Content is available under Creative Commons License SA 4.0 unless otherwise noted.