# Stepper

> Progress through steps: the line fills, and each finished step draws its own tick.

Category: Feedback · Free · Updated 2026-10-20 · Live demo: https://www.motionkitui.com/components/stepper

## When to use it

Checkout and onboarding flows, multi-step forms and order tracking.

## How it works

A track line sits behind the step dots, and its fill grows to the current step. Each completed step draws its own tick with pathLength, and the current step gets aria-current="step", so screen readers know where you are.

## Installation

```bash
npx shadcn@latest add https://www.motionkitui.com/r/stepper.json
```

Or copy `components/motionkit/stepper.tsx` below. Requires react, motion and Tailwind CSS v4. Free for personal projects; commercial use needs MotionKit Plus (https://www.motionkitui.com/pricing).

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `steps` | `string[]` |  | Step labels in order. |
| `current` | `number` |  | Index of the step in progress. |
| `color` | `string` | `"#0E7C86"` | Colour for completed steps and the line. |

## Accessibility

- **Keyboard: Not applicable.** Shows progress only. Your own Next and Back buttons handle navigation.
- **Screen readers: Pass.** An ordered list. The current step has aria-current="step" and finished steps say "completed".
- **Reduced motion: Pass.** With reduced motion on, the line and ticks appear instantly.
- **Colour contrast: Pass.** Labels 7.7:1, tick on a done step 4.95:1.

## Source

```tsx
"use client";

import { motion, useReducedMotion } from "motion/react";

type StepperProps = {
  steps: string[];
  /** Index of the step in progress. Earlier steps show as done. */
  current: number;
  /** Colour for completed steps and the progress line. */
  color?: string;
  className?: string;
};

export function Stepper({ steps, current, color = "#0E7C86", className = "" }: StepperProps) {
  const reduceMotion = useReducedMotion();
  const spring = reduceMotion ? { duration: 0 } : { type: "spring" as const, bounce: 0.15, duration: 0.6 };
  const progress = steps.length > 1 ? Math.min(current, steps.length - 1) / (steps.length - 1) : 0;

  return (
    <div className={`relative ${className}`}>
      {/* track and fill sit behind the dots, between the first and last centres */}
      <div aria-hidden className="absolute left-4 right-4 top-4 h-0.5 -translate-y-1/2 rounded-full bg-white/10">
        <motion.div
          className="h-full origin-left rounded-full"
          style={{ backgroundColor: color }}
          initial={false}
          animate={{ scaleX: progress }}
          transition={spring}
        />
      </div>
      <ol className="relative flex justify-between">
        {steps.map((step, index) => {
          const done = index < current;
          const active = index === current;
          return (
            <li key={step} aria-current={active ? "step" : undefined} className="flex w-8 flex-col items-center">
              <motion.span
                initial={false}
                animate={{
                  backgroundColor: done ? color : "#141B1B",
                  borderColor: done || active ? color : "rgba(255,255,255,0.12)",
                  scale: active && !reduceMotion ? 1.08 : 1,
                }}
                transition={spring}
                className="relative flex size-8 items-center justify-center rounded-full border-2 text-xs font-medium text-[#F6F1E8]"
              >
                {done ? (
                  <svg viewBox="0 0 24 24" className="size-4" fill="none" stroke="#fff" strokeWidth={3} strokeLinecap="round" strokeLinejoin="round">
                    <motion.path
                      d="M5 12.5 10 17 19 7"
                      initial={{ pathLength: reduceMotion ? 1 : 0 }}
                      animate={{ pathLength: 1 }}
                      transition={{ duration: 0.35, ease: "easeOut", delay: reduceMotion ? 0 : 0.15 }}
                    />
                  </svg>
                ) : (
                  index + 1
                )}
              </motion.span>
              <span className={`mt-2 whitespace-nowrap text-xs ${active ? "text-[#F6F1E8]" : "text-[#94A9A7]"}`}>
                {step}
                {done && <span className="sr-only"> (completed)</span>}
              </span>
            </li>
          );
        })}
      </ol>
    </div>
  );
}
```
