App
Step List.
A compact progress list for background work: one line per step with a done, current, todo or error mark and a time on the right.
- Done: Planned 3 pages and an app0:21
- Done: Wrote index.json, about.json0:48
- Done: Wrote app.lua1:12
- In progress: Testing requests 3 of 51:19
- Not started: Preview and publish
import { StepList, StepListItem } from "@/components/ui/step-list";
export default function StepListDemo() {
return (
<StepList className="w-full max-w-sm" aria-label="Build progress">
<StepListItem state="done" time="0:21">
Planned 3 pages and an app
</StepListItem>
<StepListItem state="done" time="0:48">
Wrote index.json, about.json
</StepListItem>
<StepListItem state="done" time="1:12">
Wrote app.lua
</StepListItem>
<StepListItem state="current" time="1:19">
Testing requests 3 of 5
</StepListItem>
<StepListItem>Preview and publish</StepListItem>
</StepList>
);
}Installation#
With the CLI
$npx lanterncn add step-listThis also installs the Lantern theme and any Lantern UI components it depends on. The shadcn CLI works directly too: npx shadcn@latest add httptim/lantern-ui/step-list. See Installation if your project is not set up yet.
Manually
Install the dependencies
npm install lucide-reactCopy the source into your project
components/ui/step-list.tsximport * as React from "react"; import { CheckIcon, XIcon } from "lucide-react"; import { cn } from "@/lib/utils"; type StepListState = "done" | "current" | "todo" | "error"; const stateLabel: Record<StepListState, string> = { done: "Done", current: "In progress", todo: "Not started", error: "Failed", }; /** A compact progress list for background work: one line per step with a mark and a time. */ function StepList({ className, ...props }: React.ComponentProps<"ol">) { return <ol data-slot="step-list" className={cn("flex flex-col gap-2.5", className)} {...props} />; } function StepListItem({ className, state = "todo", time, children, ...props }: React.ComponentProps<"li"> & { state?: StepListState; /** Time the step finished or has been running, e.g. "0:48". */ time?: React.ReactNode; }) { return ( <li data-slot="step-list-item" data-state={state} aria-current={state === "current" ? "step" : undefined} className={cn( "flex min-w-0 items-start gap-2.5 text-[13px] leading-5", state === "todo" ? "text-muted-foreground" : "text-foreground", className, )} {...props} > <span data-slot="step-list-mark" aria-hidden="true" className="flex h-5 w-4 shrink-0 items-center justify-center"> {state === "done" && <CheckIcon className="size-3.5 text-success" />} {state === "error" && <XIcon className="size-3.5 text-destructive" />} {state === "current" && ( <span className="size-2.5 animate-lantern-pulse rounded-full border-2 border-primary [animation-duration:1.4s]" /> )} {state === "todo" && <span className="size-2.5 rounded-full border border-input" />} </span> <span className="sr-only">{stateLabel[state]}: </span> <span data-slot="step-list-label" className="min-w-0 flex-1"> {children} </span> {time != null && ( <span data-slot="step-list-time" className="shrink-0 font-mono text-[11px] leading-5 text-muted-foreground tabular-nums" > {time} </span> )} </li> ); } export { StepList, StepListItem, type StepListState };Update the import paths to match your project
The source imports
cnfrom@/lib/utils.
Usage#
import { StepList, StepListItem } from "@/components/ui/step-list";<StepList aria-label="Build progress">
<StepListItem state="done" time="0:48">Wrote index.json</StepListItem>
<StepListItem state="current" time="1:19">Testing requests 3 of 5</StepListItem>
<StepListItem>Preview and publish</StepListItem>
</StepList>Use Step List for work the app is doing (a build, a deploy, an AI run). Use Stepper for numbered steps a person follows, such as an install guide.
Each item reads its state to screen readers before the label, and the current one gets aria-current="step".
Examples#
Failed step
- Done: Uploaded 6 files to north hub0:04
- Failed: Reboot failedstartup.lua:12: attempt to index nil value0:09
- Not started: Announce on the network
import { StepList, StepListItem } from "@/components/ui/step-list";
export default function StepListError() {
return (
<StepList className="w-full max-w-sm" aria-label="Deploy progress">
<StepListItem state="done" time="0:04">
Uploaded 6 files to north hub
</StepListItem>
<StepListItem state="error" time="0:09">
<span>Reboot failed</span>
<span className="block text-xs text-muted-foreground">startup.lua:12: attempt to index nil value</span>
</StepListItem>
<StepListItem>Announce on the network</StepListItem>
</StepList>
);
}