Checklist
An onboarding list of tasks the host detects as done, counted and opened from
the items. checklist and checklist-item.
Anatomy
[dsDismiss root, with dismissKey]
└── ds::panel title, subtitle "3 of 5 done", collapsible?
├── div.px-4.py-3: ds::progress (sm, success, named by title)
│ or the completion line (+ Dismiss with dismissKey)
└── ol.divide-y
└── li
└── details.group/item[name=group][data-ds-checklist-item=state][open?][data-ds-current?]
├── summary[data-ds-checklist-summary]: state mark, "Done: " (sr-only), label, Optional, chevron
└── description, then ds::button href (actionLabel) and the action slot
An item with no description, href or action is a div row in place of the
details.
How the list knows its items
A component's slot renders before the component, so the list reads the rendered items (as chip-group does):
data-ds-checklist-itemisdone,todo,optional-doneoroptional-todo.doneandtodoare counted; optional items are not.- A required item not done and not
currentcarriesdata-ds-checklist-pending(openfor a details,rowfor a row). If no item iscurrent, the first pending one getsopen data-ds-current; then every pending marker is removed. data-ds-checklist-groupis replaced by onenameper list, making its details an exclusive accordion wherenameis supported:ds-checklist-{id}with the host's id, else the title's hash and a count of the lists rendered so far. Never the title alone: two lists with one title would be one accordion, and opening an item in either would close the other's.
States
| Mark | |
|---|---|
| done | check-circle, solid, success; label in fg-muted |
| todo | 18px ring, border-strong; accent on the current item |
| optional todo | dashed ring |
Complete (every required item done, at least one): the progress row becomes a
check-badge and completeText (or the completion slot); with dismissKey,
a secondary Dismiss button marked data-ds-dismiss, invisible until
dsDismiss starts. The root collapses on the announcement bar's grid row and
has its pre-paint Dismissal::script.
Why no checkboxes
Completion is a fact the host detects (a verified domain, an accepted invite). A box the reader ticks records only the tick; the list would lie. Items link to the task instead.
Accessibility
| Structure | heading (the panel's h2), ol of items |
| Progress | progressbar named by the title |
| Item | details/summary: a disclosure button, expanded state from the browser |
| State | in words before the label: "Done: …", "Not done: …" |
| Keyboard | Tab through summaries and the open item's action; Enter/Space toggles |
| Focus ring | inside (-outline-offset-2) on the summary, which spans the row |
| Motion | the chevron turn is motion-safe: |
Do not
- Do not add checkboxes.
- Do not count in the host. The list counts the items it is given.
- Do not make every item optional. Nothing would finish it.
From the package repo: edit this page on GitHub.