Checklist Task
FreeOne step of a setup checklist that can be ticked off and ticked again. The step to do next is tinted and has its own start button.
npx wunderui-cli add checklist-taskPlayground
- Invite your teamTakes about 2 min
- Invite your teamTakes about 2 min
Installation
npx wunderui-cli add checklist-taskWrites the source into your project with its dependencies and, on first use, the styles - see Installation.
Then import what you need:
import { ChecklistTask } from "@/components/blocks/application"Then use it:
import { useState } from "react"
import { ChecklistTask } from "@wunderui/react"
export function Step() {
const [done, setDone] = useState(false)
return (
<ChecklistTask done={done} meta="3 min" onClick={() => setDone(!done)}>
Create your first project
</ChecklistTask>
)
}Expected result: You see one row with an empty circle, the label with 3 min under it and a chevron. Pressing it turns the circle green, adds a tick and dims the label.
When to use
Use Checklist Task for
- The steps of an onboarding, setup or getting-started checklist
- A list where one step is next and has its own button
- A short list of tasks that people tick and untick
States
An open step has an empty circle and a chevron. The current step is tinted, and a done step has a green tick and a quiet label.
State
- Invite your teamTakes about 2 min
Meta and action
The meta line sits under the label and takes the row's tint on the current step. The action is a button at the right of the current step only.
Content
- Create your first project
- Create your first project3 min
Long text
A long label and meta wrap onto more lines and the row grows. The action keeps its size, so the text gives way.
Text
- Invite your teamTakes about 2 min
- Review the data processing agreement with your legal team and send the signed copy to info@wunderui.comTakes about 15 minutes. Have the company registration number ready.
- Invite your teamTakes about 2 min
Keyboard interactions
An open or done step is one tab stop, and the current step has two: its circle, then its action. Both are native buttons, so Enter and Space work on them.
- TaborShift+Tab
- Moves focus to the next or previous step. On the current step it visits the circle first and the action second.
- SpaceorEnter
- Toggles the focused step and calls . On the current step, the circle toggles it and the action does whatever you gave it.
Arrow keys do not move between steps. Build the steps as a list and let Tab walk through them.
Behavior and motion
What the row does with state, content, the DOM and motion.
- Three states, two kinds of element
- An open or done step is one checkbox button. The current step is a block holding two buttons, the circle (Mark as done) and your action, and done and current can be set together.
- Hover
- Hovering an open or done step fills the row lightly, and the circle of an open step turns indigo. The current step has no hover fill, because its action is the thing to press.
- Focus
- Keyboard focus draws an indigo border with a 2 px ring around the row, or around the circle on the current step. The ring follows the rounded shape.
- Long text
- The label and meta wrap and the row grows. The action keeps its size, so the text gives way, and a word without a break point is not cut.
- Names for assistive technology
- An open or done step is named by its label followed by its meta. The current step's circle is always named Mark as done, so give the Start button its own label.
- Focus after a tick
- A step that becomes or stops being current is rebuilt as another element, and the focused button disappears. Return focus to the checkbox of the step the person pressed.
- Motion and reduced motion
- Colours of the row, circle and label change quickly, and the green tick scales in once with a fade. With reduced motion it only fades in, and the colours still change.
Anatomy
The parts of a step, numbered in the figure. The figure shows the current step, the only state that has an action.
- Invite your teamTakes about 2 min
- 1data-slot="checklist-task"
The row: 12 px side padding, 8 px radius and 12 px between its parts. A done or open step is one checkbox button, while the current step is a tinted block with two buttons.
- 2
A 22 px circle: empty with a 1.5 px rim while open, indigo rim on the current step, solid green with a tick when done. On the current step it is its own checkbox button named Mark as done.
- 3
The label in 14 px medium text. It is quiet (tertiary) when the step is done and takes the tint of the row on the current step.
- 4Optional
The meta line under the label, in 12 px text, for example the time a step takes. It is shown in every state.
- 5Optional
The action, usually a Start button, at the right of the current step. The other states do not render it.
- Optional
A 16 px chevron at the right of an open step that is not current. A done step and the current step have none.
Best practices
- Do
Mark exactly one step current and give it an action such as Start. Only the current step shows the action, and its circle becomes a checkbox button of its own.
- Do
Handle the click as a toggle. It fires for open and done steps alike, so a step can be ticked and unticked again.
- Do
Work out the current step from the list, as the first step that is not done, so it moves on by itself when a step is ticked.
- Do
Put the steps in a list. Inside a panel with 8 px of padding and a 16 px radius, the 8 px row is concentric to the panel.
- Do
After a tick, move focus back to the checkbox of the step that was pressed. The current step is rebuilt as another element, so a step that becomes or stops being current loses focus.
- Don’t
Don't pass an action to steps that are not current. It is not rendered there.
- Don’t
Don't use a step for something that cannot be ticked yet. There is no disabled state, so leave the step out until it can be done.
API reference
Checklist Task is one component with the props below. It takes no other attributes, so an id or a data attribute cannot be passed to the row.
The row: 12 px side padding, 8 px radius and 12 px between its parts. A done or open step is one checkbox button, while the current step is a tinted block with two buttons.
| Prop | Type | Default | Description |
|---|---|---|---|
| children required | ReactNode | — | The label of the step. Required. |
| done | boolean | — | Draws a green circle with a tick and a quiet label, and sets . Without it the step is open. |
| current | boolean | — | Marks the step to do next: tinted row, circle as its own checkbox button, room for . Use it on one step. |
| meta | ReactNode | — | A line under the label, for example how long the step takes. Shown in every state. |
| action | ReactNode | — | A button at the right of the current step, for example Start. Not rendered on a step that is not current. |
| onClick | () => void | — | Toggles the step. On an open or done step it is the row; on the current step it is the circle. Called for ticking and unticking alike. |
| className | string | — | Added to the row. Use it for the width or for spacing in a list. |
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("checklist-task")npx wunderui-cli add checklist-taskThe full library index for assistants is at /llms.txt.
Related components
- NLNora LindgrenWunderUI Pro, one-time$299.00Today
- DODaniel OkaforWunderUI Core, one-time$199.00Yesterday
- PRPriya RamanWunderUI Pro, one-time$299.00Nov 4
Data & Tables9 stylesProList ItemOne list row: an icon tile, avatar, logo, flag, checkbox or date tile on the left, title and description in the middle, a value, badge, trend, button, switch or menu on the right. Comfortable or compact, with default, hover, selected and disabled states.