Stepper

Where someone is in a wizard or a setup checklist, with complete, current, error and optional steps.

3 rows have no email. Fix them in the file, or skip them.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/stepper

Usage

import { Stepper } from "./ui/uicontext/components/Stepper.ts"
const Message = UiSchema.TaggedEnum({ PickedStep: { id: Schema.String } })const steps = [	{ id: "account", title: "Account" },	{ id: "plan", title: "Plan" },	{ id: "payment", title: "Payment" },]export const SignUpSteps = (h: Html.H<typeof Message.Type>, current: string) =>	Stepper(h, { steps, current, onSelect: (id) => Message.PickedStep({ id }) })

Examples

Vertical checklist

The current step opens under its title. Finished steps stay one click away.

API reference

Options

Stepper options
NameTypeDefaultDescription
stepsrequiredStep[]——
currentrequiredstring—The id of the step someone is on. Steps before it are complete unless errors names them.
errorsstring[]—Steps with something to fix: "The CSV has 3 rows without an email".
completedstring[]—Steps finished out of order, such as optional ones after the current step.
orientation"horizontal" | "vertical"horizontalhorizontal for a wizard's header, vertical for a checklist; horizontal by default.
onSelect(id: string) => Message—Go back to a step already reached (complete, or with an error). Without it the steps are plain text.
content(step: Step) => View.Content—Vertical only: what the current step shows under its title.
labelstring"Progress"Names the list; "Progress" by default.
styleStyle—StyleX styles applied after the stepper's own.

Source