Molecules · Stepper
Stepper
Shows where someone is in a flow of several steps. Finished steps get a check mark on the signal colour, the current one takes the neutral selected look (a selected surface with a 2px signal underline), and the rest wait as outlines.
- Best for
- Showing where someone is in a flow of two to five steps.
- Not for
- Sections that are equally important: use Tabs. Also not for a single step.
This page as Markdown, a plain-text copy for a coding agent (an AI tool that writes code).
Examples
Checkout
Shipping, completed
Payment, current
Review, not started
Check the manifest
Code
tsx
const CHECKOUT_STEPS: Step[] = [ { label: 'Shipping' }, { label: 'Payment' }, { label: 'Review', description: 'Check the manifest' },]<div className="w-full"> <Stepper steps={CHECKOUT_STEPS} current={1} label="Checkout progress" /></div>Complete
Shipping, completed
Payment, completed
Review, completed
Check the manifest
Code
tsx
const CHECKOUT_STEPS: Step[] = [ { label: 'Shipping' }, { label: 'Payment' }, { label: 'Review', description: 'Check the manifest' },]<div className="w-full"> <Stepper steps={CHECKOUT_STEPS} current={3} label="Checkout progress" /></div>Vertical, with descriptions
Ordered, completed
Paid on 12 October
Packed, completed
At the Brasov depot
Shipped, current
With the courier
Delivered, not started
Code
tsx
const SHIPMENT_STEPS: Step[] = [ { label: 'Ordered', description: 'Paid on 12 October' }, { label: 'Packed', description: 'At the Brasov depot' }, { label: 'Shipped', description: 'With the courier' }, { label: 'Delivered' },]<div className="w-full max-w-xs"> <Stepper steps={SHIPMENT_STEPS} current={2} orientation="vertical" label="Shipment progress" /></div>Live: move through the steps with Back and Continue
Shipping, current
Payment, not started
Review, not started
Check the manifest
Code
tsx
const CHECKOUT_STEPS: Step[] = [ { label: 'Shipping' }, { label: 'Payment' }, { label: 'Review', description: 'Check the manifest' },]function LiveStepper() { const [current, setCurrent] = useState(0) return ( <div className="flex flex-col gap-6 w-full"> <Stepper steps={CHECKOUT_STEPS} current={current} label="Checkout progress" /> <div className="flex gap-3"> <Button variant="secondary" size="sm" disabled={current === 0} onClick={() => setCurrent(c => Math.max(0, c - 1))} > Back </Button> <Button size="sm" disabled={current >= CHECKOUT_STEPS.length} onClick={() => setCurrent(c => Math.min(CHECKOUT_STEPS.length, c + 1))} > Continue </Button> </div> </div> )}<LiveStepper />Anatomy
| Part | What it is |
|---|---|
| List | An ol (numbered list element) named by label. |
| Marker | A 28px (pixel) square. Done: signal fill with a check. Current: the neutral selected surface and a 2px signal underline, with its number, without leading zeros, because dimmed zeros can't keep enough contrast against the surface. Upcoming: an outline with the two-digit number, leading zero included. |
| Connector | A 2px line that turns the signal colour once the step before it is done. Horizontal: hidden when the steps stack, below the sm breakpoint (the small-screen width). Vertical: always shown, running down between the markers. |
| Label | In a monospaced font, with its status spelled out in words for screen readers. |
| Description | Optional, under the label. The vertical layout gives it the most room. |
Props
- stepsStep[]
- Required. { label: string; description?: string }.
- currentnumber
- Counts from 0. steps.length means every step is complete.
- labelstringDefault 'Progress'
- The list's accessible name, the name screen readers announce.
- orientation'horizontal' | 'vertical'Default 'horizontal'
- Horizontal runs in a row from sm up and stacks below it. Vertical is a column at every width, with connectors.
- classNamestring
- Merged with the root classes. If two Tailwind utilities clash, the later one wins.
- refRef<HTMLOListElement>
- Passed through to the root ol.
Keyboard
| Keys | Result |
|---|---|
| Not interactive. Put Back and Continue buttons in the flow itself. |
Do and don't
Do
- Keep it to five steps or fewer.
- Name steps for what happens in them: 'Shipping', not 'Step 1'.
- Label the list after the flow: 'Checkout progress'.
- Use vertical beside other content, or when steps have descriptions, like a shipment on an order page.
Don't
- Don't make steps clickable so people can skip ahead.
- Don't use a Stepper for equally important sections. That's what Tabs is for.
- Don't show a Stepper for a single step.