[ Forms ]
Checklist
An onboarding-style checklist: round checks joined by a connector that fills in as steps are done. Clicking a step toggles it, and the next unfinished step is highlighted automatically.
Import#
import { Checklist } from 'reusify-ui';When to use#
- Getting-started and setup guides where users tick off steps in any order.
- Short to-do lists inside cards and popovers.
- For read-only progress (running, failed…), use StepList; for a single yes/no, Checkbox.
Examples#
Onboarding#
sequential makes steps finish in order: only the next step can be completed, and only the latest finished one can be undone, so a step in the middle can never be unchecked. Later steps are dimmed until their turn.
Done: ["extension"]
const steps = [
{ key: 'extension', title: 'Connect extension', description: 'Add MemoryBase to Chrome' },
{ key: 'login', title: 'Log in to your AI tools', description: 'Bring in your past conversations' },
{ key: 'memory', title: 'Try your first memory', description: 'Open ChatGPT or Claude to try it' },
];
const [done, setDone] = useState(['extension']);
<Checklist items={steps} value={done} onChange={setDone} color="#ec4899" sequential />Uncontrolled, custom active, disabled steps#
defaultValue for uncontrolled use. active picks the highlighted step yourself (null for none). Disabled steps cannot be toggled.
<Checklist
defaultValue={['account']}
active="team"
items={[
{ key: 'account', title: 'Create account' },
{ key: 'team', title: 'Invite your team' },
{ key: 'billing', title: 'Add billing', description: 'Available after the trial', disabled: true },
]}
/>Used in designs#
Checklist in real layouts: this design uses it. Open one to try it and copy the code.
API reference#
<Checklist />
Renders an <ol>; other props go on it.
| Prop | Type | Default | Description |
|---|---|---|---|
items* | { key, title, description?, disabled? }[] | - | The steps. |
value | string[] | - | Keys of completed steps (controlled). |
defaultValue | string[] | [] | Initially completed keys (uncontrolled). |
onChange | (keys: string[]) => void | - | Called with the new list of completed keys. |
active | string | null | - | Highlighted step. Defaults to the first unfinished one. |
sequential | boolean | false | Steps complete in order; only the next step can be checked and only the latest done one unchecked. |
color | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | CSS color | 'primary' | Color of checks, titles and the filled connector. |
connector | boolean | true | Line between the checks. |
items*-{ key, title, description?, disabled? }[]The steps.
value-string[]Keys of completed steps (controlled).
defaultValue[]string[]Initially completed keys (uncontrolled).
onChange-(keys: string[]) => voidCalled with the new list of completed keys.
active-string | nullHighlighted step. Defaults to the first unfinished one.
sequentialfalsebooleanSteps complete in order; only the next step can be checked and only the latest done one unchecked.
color'primary''primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | CSS colorColor of checks, titles and the filled connector.
connectortruebooleanLine between the checks.
Accessibility#
- Each step is a button with role="checkbox" and aria-checked, so it is announced as a checkbox with its title and description.
- The highlighted step has aria-current="step".
- With sequential, steps that can't be toggled right now have aria-disabled but stay focusable, so their state can still be read.
- Keyboard: Tab moves between steps, Space or Enter toggles.