Components
Stepper
Shows where a person is in a multi-step flow, horizontal or vertical, with error states, clickable completed steps and a compact mode.
Overview
Stepper renders the steps of a flow and marks each as completed, current, upcoming or failed. Steps before current are completed. With onStepClick, completed steps become buttons, e.g. to go back in a wizard. compact reduces it to "Step n of N" plus the current step's label, for narrow screens.
Import
import { Stepper } from '@unflowio/ui/components/Stepper';Props
| Prop | Type | Default | Description |
|---|---|---|---|
steps | StepperStep[] | — | Required. The steps, in order |
current | number | — | Required. Index of the current step, from 0 |
orientation | 'horizontal' | 'vertical' | 'horizontal' | Layout |
onStepClick | (index: number) => void | — | Makes completed steps clickable |
compact | boolean | — | Shows only "Step n of N" and the current step's label |
StepperStep:
| Field | Type | Description |
|---|---|---|
label | ReactNode | Required. Step name |
description | ReactNode | Secondary line under the label |
error | boolean | Marks the step as failed, whatever its position |
Basic usage
- Brand, completed
- Workspace, completed
- Limits
- Sign-in
- Billing
- Invite
<Stepper steps={steps} current={2} />Vertical
- Upload data, completed1,240 rows
- ValidateChecks format and duplicates
- ImportAbout 2 minutes
- ReviewCompare against the current data
<Stepper steps={steps} current={1} orientation="vertical" />Error
- Upload data, completed1,240 rows
- Validate, error12 rows have no email
- ImportAbout 2 minutes
- ReviewCompare against the current data
<Stepper
steps={[
{ label: 'Upload data' },
{ label: 'Validate', description: '12 rows have no email', error: true },
{ label: 'Import' },
]}
current={1}
/>Clickable
- Brand, completed
- Workspace, completed
- Limits, completed
- Sign-in
- Billing
- Invite
const [current, setCurrent] = useState(3);
<Stepper steps={steps} current={current} onStepClick={setCurrent} />Compact
Step 3 of 6
Limits
<Stepper steps={steps} current={2} compact />Customization (slotProps)
| Slot Prop | Props | Description |
|---|---|---|
step | BaseHTMLProps<HTMLLIElement> | Each step |
marker | BaseHTMLProps<HTMLSpanElement> | Each step's number or status marker |
Accessibility
- The steps are an ordered list named "Progress" (translated). The current step has
aria-current="step". - Completed and failed steps add a visually hidden "completed" or "error" after their label, so the state doesn't rely on the marker.
- Clickable steps are buttons named "Go to step n".
- In
compactmode the visual track is hidden from assistive technology; the "Step n of N" text carries the position.