Selection
Checkbox
A checkbox turns one option on or off, alone or in a group where any number can be chosen, and a parent checkbox selects a whole list at once.
In kanso-ui as Checkbox
Variants and sizes
- Single (
k-check). - Group (
k-groupon the<fieldset>,k-group__legendon the<legend>). - Parent and items: the items sit in a nested group (
k-group--nested), indented byspace-3xl, the box plus its gap.
States
- Unchecked: an empty box with an
outlineborder. - Checked: the box fills with
inkand shows a tick. Fill and mark, not hue. - Mixed: an
inkbox with a bar, on a parent whose items are partly checked. Choosing it checks every enabled item. - Hover: the pointer turns into a hand.
- Focus: a 2px
focus-ringring 2px outside the box, for keyboard focus. - Disabled: box and label drop to
inkat 38% (state-disabled-content), with the reason underneath (k-check__reason): "Ada added this file, so only she can delete it". - Error: for a required box, the message goes under it with the
erroricon, as in TextField.
Do and don’t
Do
Word each label as the thing chosen, in the positive: "Remind me about due dates", not "Don't remind me".
Name every group with a legend.
Make "Select all" act on enabled items only.
Say why an item is disabled, right under it.
Don’t
Use a checkbox for a setting that applies at once; use Switch.
Shrink the target to the 20px box; the label takes the tap too.
What you provide
- Label and checked state; for a parent, the mixed state worked out from its items.
- Disabled state with its reason.
- The group's legend, and a name and value for forms.