Surfaces and display
Checklist
A list of things to do with a bar of how many are done. <kui-checklist> counts the ticked boxes, updates the bar and its words, says “All done” at the end, and with remember keeps the ticks in this browser.
Examples
Before moving house
Tick the boxes: the bar and “2 of 5 done” follow. Reload the page: the ticks stay, because of the remember attribute. Tick all five to see the done message.
Pre selidbe0 of 5 done
All done. Welcome home.
HTML
<kui-checklist class="kui-checklist" remember="docs-checklist-move">
<div class="kui-progress">
<div class="kui-progress__head"><span id="checklist-name">Pre selidbe</span><span data-progress>0 of 5 done</span></div>
<progress class="kui-progress__bar" aria-labelledby="checklist-name" max="5" value="0"></progress>
</div>
<ul class="kui-checklist__items">
<li><label class="kui-check"><input class="kui-checkbox" type="checkbox" value="mup"><span class="kui-check__text"><span class="kui-check__title">Prijavite novu adresu u MUP-u</span><span class="kui-hint">Within 8 days of moving, with your identity card.</span></span></label></li>
<li><label class="kui-check"><input class="kui-checkbox" type="checkbox" value="eps"><span class="kui-check__text"><span class="kui-check__title">Move the electricity account</span><span class="kui-hint">EPS needs the meter reading on the day.</span></span></label></li>
<li><label class="kui-check"><input class="kui-checkbox" type="checkbox" value="bank"><span class="kui-check__text"><span class="kui-check__title">Tell the bank and the employer</span></span></label></li>
<li><label class="kui-check"><input class="kui-checkbox" type="checkbox" value="tax"><span class="kui-check__title">Prijava poreza na imovinu</span></label></li>
<li><label class="kui-check"><input class="kui-checkbox" type="checkbox" value="post"><span class="kui-check__title">Nachsendeauftrag bei der Post</span></label></li>
</ul>
<p class="kui-checklist__done"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#circle-check"></use></svg><span>All done. Welcome home.</span></p>
</kui-checklist>
States
Every state
A ticked item is struck through and muted. The bar fills with each tick. When every box is ticked the element sets data-complete and the done line shows; “All done” is announced. A disabled item is faded and does not count against the person if it cannot be done yet.
States
All done.
HTML
<kui-checklist class="kui-checklist">
<div class="kui-progress">
<div class="kui-progress__head"><span id="checklist-s-name">States</span><span data-progress></span></div>
<progress class="kui-progress__bar" aria-labelledby="checklist-s-name"></progress>
</div>
<ul class="kui-checklist__items">
<li><label class="kui-check"><input class="kui-checkbox" type="checkbox" checked><span class="kui-check__title">Done</span></label></li>
<li><label class="kui-check"><input class="kui-checkbox" type="checkbox"><span class="kui-check__title">To do</span></label></li>
<li><label class="kui-check"><input class="kui-checkbox" type="checkbox" disabled><span class="kui-check__text"><span class="kui-check__title">Not yet possible</span><span class="kui-hint">Opens after the contract is signed.</span></span></label></li>
</ul>
<p class="kui-checklist__done"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#circle-check"></use></svg><span>All done.</span></p>
</kui-checklist>
Classes and attributes
kui-checklist.kui-checklist- The element: counts ticks, updates the bar and words, sets data-complete.
remember="KEY"- Keeps the ticks in this browser under KEY. Give each box a value.
progress- The bar; the element sets max and value.
[data-progress]- Where the element writes the keyed “2 of 5 done”.
.kui-checklist__items- The framed list of items.
.kui-check, .kui-check__text, .kui-check__title, .kui-hint- One item: the checkbox and its words, with an optional hint.
.kui-checklist__done- Shown when everything is ticked.
data-complete- Set on the element when every box is ticked.
Keyboard
- Tab
- Moves from box to box.
- Space
- Ticks or clears the box.
Accessibility
- Each item is a native checkbox inside its label, so the whole row is the target.
- The progress is announced in words after each change (“2 of 5 done”), and “All done” at the end.
- The bar is named by the checklist’s title.
- The ticks are kept on this device only; say so if people may expect them elsewhere.
Do and do not
Do
- Write each item as one action, verb first.
- Put a deadline or a place in the hint.
- Keep the list under about ten items.
Do not
- Do not use a checklist for settings; use switches.
- Do not untick boxes for the person.
- Do not keep sensitive answers in the browser with remember.