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-item is done, todo, optional-done or optional-todo. done and todo are counted; optional items are not.
  • A required item not done and not current carries data-ds-checklist-pending (open for a details, row for a row). If no item is current, the first pending one gets open data-ds-current; then every pending marker is removed.
  • data-ds-checklist-group is replaced by one name per list, making its details an exclusive accordion where name is 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
donecheck-circle, solid, success; label in fg-muted
todo18px ring, border-strong; accent on the current item
optional tododashed 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

Structureheading (the panel's h2), ol of items
Progressprogressbar named by the title
Itemdetails/summary: a disclosure button, expanded state from the browser
Statein words before the label: "Done: …", "Not done: …"
KeyboardTab through summaries and the open item's action; Enter/Space toggles
Focus ringinside (-outline-offset-2) on the summary, which spans the row
Motionthe 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.

Was this page helpful?