Checklist

An onboarding list: "Get set up, 3 of 5 done", each step a link to where it is done. Covers checklist and checklist-item.

Checklist

Plain Blade: the items are native disclosures and open with no script. collapsible needs Alpine, as panel's does, and dismissKey needs Alpine and the package's script.

Use it

<x-ds::checklist title="Get set up" dismissKey="setup-{{ $team->id }}">
    <x-ds::checklist-item label="Create your workspace" :done="true" />
    <x-ds::checklist-item label="Invite your team" :done="$team->users_count > 1"
        description="Everyone you invite gets an email." :href="route('team.invite')" actionLabel="Invite people" />
    <x-ds::checklist-item label="Connect your domain" :done="$team->domain_verified"
        description="Add a CNAME record pointing at us." :href="route('domains')" />
    <x-ds::checklist-item label="Add a payment method" :done="$team->hasPaymentMethod()"
        description="Needed before your trial ends." :href="route('billing')" />
    <x-ds::checklist-item label="Install the mobile app" :optional="true" :done="$user->has_app"
        description="On iOS and Android." :href="route('apps')" />
</x-ds::checklist>

Done is detected, never ticked

There are no checkboxes. Each item says whether the work is done, and the host decides that from the data: the domain verifies, the first invite is accepted. A box the reader ticks records only that they ticked it, and a checklist that can be ticked without doing the work is a checklist that lies. So every item is a link (or a button in its action slot) to the real task, and comes back done once it is.

What it does

  • Counts itself. "3 of 5 done" and the progress bar are counted from the items, so the host never says it twice. Optional items are marked "Optional" and left out of the count: the total is the work that finishes it.
  • Opens one item. The item marked current, or else the first required item not done, is open on first paint with its description and action; the rest open on click. The items share a name, so opening one closes the other, where the browser supports it (everywhere current); elsewhere several can be open at once.
  • Ends. Once every required item is done, the progress bar gives way to a completion line (completeText, or the completion slot). With dismissKey, a Dismiss button there puts the list away for good: the dismissal is kept in localStorage under the key and checked before the first paint, as announcement bar's is.
  • Folds away. collapsible makes the heading a button, as on a panel.

An item with no description, href or action is a plain row that does not open.

checklist props

PropTypeDefaultWhat it does
titlestring—The heading, and the progress bar's name. Required.
collapsibleboolfalseThe heading becomes a button that folds the list away. Needs Alpine.
openbooltrueWith collapsible, whether it starts open.
dismissKeystring—A localStorage key. When complete, Dismiss puts the list away for good. Needs Alpine and the script.
progressTextstring:done of :total doneUnder the heading.
completeTextstringYou are all set.The completion line.
dismissLabelstringDismissThe dismiss button's words.
noncestringVite'sThe CSP nonce for the dismissKey check.
Slot
defaultThe items.
completionReplaces completeText.

checklist-item props

PropTypeDefaultWhat it does
labelstring—The task. Required.
descriptionstring—Shown when the item is open.
doneboolfalseDone, as you have detected it.
hrefstring—Where the task is done. Draws a button in the open item.
actionLabelstringStartThat button's words.
currentboolfalseOpen this item rather than the first not done.
optionalboolfalseNot needed to finish: left out of the count.
doneText todoText optionalTextstringDone Not done OptionalThe state in words.

Plus an action slot, for a button of your own (a form that does the task in place, say).

Dismissed for good

@unless ($team->onboarding_dismissed)
    <x-ds::checklist title="Get set up" dismissKey="setup-{{ $team->id }}"
        x-on:dismiss="$wire.dismissOnboarding()">
        …
    </x-ds::checklist>
@endunless

localStorage is per browser. To make it stick everywhere, listen for dismiss (it bubbles from the list) and remember it on the server too.

Accessibility

  • An ordered list, under a heading, with a progress bar named by the title.
  • Each item's state is in words before its label, "Done: Invite your team", so it is not carried by the tick alone.
  • An item is a native details: its summary is a button that says whether it is expanded, and Enter or Space opens it. Its action is an ordinary link.
  • Find-in-page finds the text of a closed item, and opens it in browsers that open a details for a match (Chromium does; check the others you support).
KeyWhereDoes
Tabanywheremoves through the item summaries, and the open item's action
Enter / Spaceon a summaryopens or closes that item

Don't

  • Don't add a checkbox. See above.
  • Don't list more than about seven. Onboarding longer than that is a manual.
  • Don't keep it after it is done, unless the reader may want to look back. Give it a dismissKey.

More in specs/checklist.md.


From the package repo: edit this page on GitHub.

Was this page helpful?