Checkout Stepper
Multi-step progress indicator for checkout flows.
<div class="flex items-center w-full max-w-lg overflow-x-auto">
<div class="flex items-center gap-2">
<span class="w-8 h-8 rounded-full bg-indigo-600 text-white text-sm font-bold flex items-center justify-center">1</span>
<span class="text-sm font-bold text-slate-900 dark:text-white hidden sm:inline">Cart</span>
</div>
<div class="flex-1 h-0.5 bg-indigo-600 mx-2"></div>
<div class="flex items-center gap-2">
<span class="w-8 h-8 rounded-full bg-indigo-600 text-white text-sm font-bold flex items-center justify-center">2</span>
<span class="text-sm font-bold text-slate-900 dark:text-white hidden sm:inline">Shipping</span>
</div>
<div class="flex-1 h-0.5 bg-slate-300 mx-2"></div>
<div class="flex items-center gap-2">
<span class="w-8 h-8 rounded-full bg-slate-300 text-slate-500 text-sm font-bold flex items-center justify-center">3</span>
<span class="text-sm font-semibold text-slate-400 hidden sm:inline">Payment</span>
</div>
</div>Free to use in personal and commercial projects. No attribution required.
Variants
Same component, different looks. Preview each one live and copy the code you like.
All complete
Show the all-complete state on order confirmation pages.
Four steps
Add a fourth step for longer flows like onboarding or applications.
Error state
Use the red error step when a stage fails, like a declined payment.
About this checkout stepper
Checkout steppers answer the visitor's silent question: "how much longer is this going to take?" The pattern is Cart > Shipping > Payment, with completed steps filled, the current step highlighted, and upcoming steps grayed. Every major e-commerce flow uses a stepper component because it measurably reduces abandonment.
This snippet shows three states in one row: completed (indigo fill), current (indigo fill, bold label), and upcoming (gray). The connecting bars fill with indigo up to the current step. On mobile, the labels hide and only the numbered circles show, which keeps it compact.
For completed steps, swap the number for a checkmark SVG. If your flow allows going back, wrap completed steps in buttons. Keep step labels to one word each: Cart, Shipping, Payment, Done.
Multi-step flows have a hidden abandonment driver: at step two, users imagine ten more steps and quit. The stepper removes that uncertainty by laying out the full journey from cart to payment, completed stages filled in and upcoming ones grayed out, so the end is always in sight. Making the total visible measurably reduces drop-off, which is why every major checkout uses one.
The row is flex items-center w-full. Each step is a w-8 h-8 rounded-full circle holding its number; connectors are flex-1 h-0.5 bars that fill bg-indigo-600 up to the current step and stay bg-slate-300 beyond it. Three states come from classes alone: completed is bg-indigo-600 text-white, current adds a bold label, upcoming is bg-slate-300 text-slate-500. On mobile the labels hide with hidden sm:inline and the numbered circles carry the pattern alone.
Swap numbers for checkmark SVGs on completed steps; a check reads as done faster than a number. Keep labels to one word each. If users can go back, wrap completed steps in real buttons with hover states; future steps must never look clickable, or users will try and feel the interface lied to them.
The trust-breaking mistake is marking a step complete because the user visited it, when its data was never actually validated. The stepper then claims Shipping is done while the review page shows address errors, and the user's mental model of the flow collapses. Derive step state from validated data, not from page visits.
Where to use it
- ✓ E-commerce checkout flows
- ✓ Multi-step onboarding
- ✓ Form wizards
- ✓ Account setup sequences
Customization tips
Use checkmarks instead of numbers for completed steps. On mobile, hide labels with hidden sm:inline to save space. For more than 4 steps, consider a compact progress bar instead of labeled circles.
Design notes
When to use
Use it for checkout flows, multi-step onboarding, and form wizards to answer how much longer this takes. Showing Cart, Shipping, and Payment with completed steps filled measurably reduces abandonment. On mobile the labels hide and numbered circles keep it compact.
What to avoid
Do not use it for more than four or five steps; a long stepper overwhelms and a simple progress bar serves better. Do not let users click into future steps they cannot validly reach yet.
Accessibility
Mark the current step with aria-current set to step so screen readers announce position. Completed steps need text or checkmark meaning, not just color, and the step count should still be perceivable when labels hide on mobile.
Frequently asked questions
How many steps should a checkout stepper have?
Three to four. Cart, shipping, payment, confirmation covers it. More steps increase abandonment, so combine where possible.
Should stepper steps be clickable?
Completed steps, yes, so users can go back and edit. The current step is where they are. Future steps should not be clickable.
Stepper vs progress bar, which is better?
Steppers name each stage, which orients users better for complex flows. Plain progress bars suit simple linear processes like file uploads.
How do I mark stepper steps as completed with a checkmark?
Give finished steps a completed class that swaps the step number for a check SVG and fills the circle with your success color. Keep the number visible for the current step and muted for upcoming ones. Update the classes in JavaScript as the user advances through the form.
How do I connect stepper steps with a progress line?
Draw a track line behind the step circles and overlay a fill line whose width equals (currentStep - 1) / (totalSteps - 1) * 100%. Transition the fill width so it animates as the user moves forward or back. The line should sit at the vertical center of the circles.
Should I use aria-current on stepper steps?
Yes. Put aria-current="step" on the current step's element inside a nav with an aria-label like "Checkout progress". Screen readers then announce which step the user is on. Mark completed steps with visually hidden text like "completed" rather than relying on color alone.