Stepper Components for Multi-Step Forms

Updated 2026-10-28. 5 steppers.

A stepper shows where someone is in a process split into steps, such as sign-up or checkout, and which steps are done. Draw it as an ordered list, mark the current step with aria-current="step", and give finished and failed steps a text status, not only a colour. Each stepper here moves with real Back and Next buttons.

Use the horizontal numbered stepper for three to five short steps on a wide screen, where seeing the whole journey at once reassures people. When each step needs a sentence of explanation, or there are more than five, the vertical stepper gives the labels room and stacks naturally on phones.

A checkout stepper replaces numbers with checkmarks as steps finish, which tells a buyer that their address and delivery choice are saved. The compact dots version is for tight mobile screens and onboarding cards. Reach for the error variant whenever a later step can fail after an earlier one passed, such as a card declined at payment.

Compare them

VariantBuilt withSize (gzipped)Running costBrowser support
Horizontal Numbered Stepper With Back and NextCSS only1.9 KBChanging step updates four list items and runs one scale transition on a 2px line.All current browsers
Checkout Stepper With Completed CheckmarksCSS only1.5 KBStatic bars and text; moving between stages re-renders one small form section.All current browsers
Compact Dots Stepper for MobileCSS only1.7 KBFive 8px dots; the active one stretches with a 300ms width transition on a tiny element.All current browsers
Stepper With an Error StepCSS only1.6 KBNo transitions; state changes swap classes on four list items.All current browsers
Vertical Stepper With Step DescriptionsCSS only1.6 KBNo transitions; each change re-renders four list items and nothing else.All current browsers

Horizontal Numbered Stepper With Back and Next

A four-step shop set-up flow: Account, Shop, Payouts and Review. Numbered circles sit in a row joined by thin lines; finished steps turn solid blue with a tick, the current one gets a blue ring, and the line ahead fills as you press Next. Earlier steps can be clicked to go back, later ones stay locked. On phones the labels shrink but the row still fits.

<div class="hns" data-current="1">
  <ol class="hns-steps">
    <li><button type="button">1<span class="hns-sr"></span></button><span class="hns-label" aria-hidden="true">Account</span></li>
    <li><button type="button">2<span class="hns-sr"></span></button><span class="hns-label" aria-hidden="true">Shop</span></li>
    <li><button type="button">3<span class="hns-sr"></span></button><span class="hns-label" aria-hidden="true">Payouts</span></li>
    <li><button type="button">4<span class="hns-sr"></span></button><span class="hns-label" aria-hidden="true">Review</span></li>
  </ol>
  <div class="hns-body">
    <p class="hns-count"></p>
    <h2 class="hns-title" tabindex="-1"></h2>
    <p class="hns-text"></p>
  </div>
  <div class="hns-nav">
    <button type="button" class="hns-back">Back</button>
    <button type="button" class="hns-next">Next</button>
  </div>
</div>
<style>
  .hns { --hns-accent: #2563eb; width: calc(100% - 32px); max-width: 42rem; box-sizing: border-box; margin: 48px auto; padding: 28px; border: 1px solid #dbeafe; border-radius: 16px; background: #fff; font-family: ui-sans-serif, system-ui, sans-serif; color: #0f172a; }
  .hns button:focus-visible { outline: 2px solid var(--hns-accent); outline-offset: 2px; }
  .hns-steps { display: flex; margin: 0; padding: 0; list-style: none; }
  .hns-steps li { position: relative; display: flex; flex-direction: column; align-items: center; }
  .hns-steps li { flex: 1; }
  .hns-steps li:not(:last-child)::before { content: ""; position: absolute; top: 16px; left: calc(50% + 20px); right: calc(-50% + 20px); height: 2px; background: #e2e8f0; }
  .hns-steps li:not(:last-child)::after { content: ""; position: absolute; top: 16px; left: calc(50% + 20px); right: calc(-50% + 20px); height: 2px; background: var(--hns-accent); transform: scaleX(0); transform-origin: left; transition: transform .5s ease-out; }
  .hns-steps li.is-done::after { transform: scaleX(1); }
  .hns-steps button { position: relative; z-index: 1; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f1f5f9; color: #475569; font: 600 14px ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
  .hns-steps button:disabled { cursor: default; }
  .hns-steps .is-done button { background: var(--hns-accent); color: #fff; }
  .hns-steps [aria-current] button { background: #fff; color: #1d4ed8; box-shadow: 0 0 0 2px var(--hns-accent); }
  .hns-label { margin-top: 8px; font-size: 13px; font-weight: 500; color: #475569; }
  [aria-current] > .hns-label { color: #0f172a; }
  .hns-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .hns-body { min-height: 96px; margin-top: 32px; }
  .hns-count { margin: 0; font-size: 14px; font-weight: 500; color: #1d4ed8; }
  .hns-title { margin: 4px 0 0; font-size: 20px; outline: none; }
  .hns-text { margin: 8px 0 0; color: #475569; }
  .hns-nav { display: flex; justify-content: space-between; margin-top: 24px; padding-top: 20px; border-top: 1px solid #f1f5f9; }
  .hns-nav button { height: 44px; padding: 0 18px; border: 0; border-radius: 8px; font: 500 14px ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
  .hns-back { background: none; color: #334155; }
  .hns-back:disabled { opacity: .4; cursor: not-allowed; }
  .hns-next { background: var(--hns-accent); color: #fff; font-weight: 600 !important; }
  @media (prefers-reduced-motion: reduce) { .hns-steps li::after { transition: none; } }
</style>
<script>
  (function () {
    var steps = [
      ["Account", "Create your account", "Use the email you check most. We send order alerts and payout notices there."],
      ["Shop", "Name your shop", "Pick a name and a short description. You can change both later from Settings."],
      ["Payouts", "Connect a bank account", "Sales are paid out every Friday. We only need your account and sort code."],
      ["Review", "Check and open your shop", "Look over your details. When you open the shop, your first product page goes live."]
    ];
    document.querySelectorAll(".hns").forEach(function (root) {
      var items = root.querySelectorAll(".hns-steps li"), current = Number(root.dataset.current), last = steps.length - 1;
      function render(focus) {
        items.forEach(function (li, i) {
          var btn = li.querySelector("button"), done = i < current, now = i === current;
          li.classList.toggle("is-done", done);
          if (now) li.setAttribute("aria-current", "step"); else li.removeAttribute("aria-current");
          btn.disabled = i > current;
          btn.firstChild.textContent = done ? "✓" : String(i + 1);
          li.querySelector(".hns-sr").textContent = ", " + steps[i][0] + (done ? ", completed" : now ? ", current step" : ", not started");
        });
        root.querySelector(".hns-count").textContent = "Step " + (current + 1) + " of " + steps.length;
        root.querySelector(".hns-title").textContent = steps[current][1];
        root.querySelector(".hns-text").textContent = steps[current][2];
        root.querySelector(".hns-back").disabled = current === 0;
        root.querySelector(".hns-next").textContent = current === last ? "Open shop" : "Next";
        if (focus) root.querySelector(".hns-title").focus();
      }
      function go(i) { current = Math.max(0, Math.min(last, i)); render(true); }
      items.forEach(function (li, i) { li.querySelector("button").addEventListener("click", function () { go(i); }); });
      root.querySelector(".hns-back").addEventListener("click", function () { go(current - 1); });
      root.querySelector(".hns-next").addEventListener("click", function () { go(current + 1); });
      render(false);
    });
  })();
</script>

With reduced motion: The connecting lines switch from grey to blue at once instead of filling.

Running cost: Changing step updates four list items and runs one scale transition on a 2px line.

  • Edit `steps` to rename stages and change the text under the row; the circles and lines follow the array length.
  • Recolour through `bg-blue-600`, `ring-blue-600` and `text-blue-700`, or `--hns-accent` in the plain version.
  • Change how fast the connecting line fills with `duration-500` on the inner span.
  • Replace the panel text with your real form fields and call `go(current + 1)` only after the fields validate.

Full page for Horizontal Numbered Stepper With Back and Next

Checkout Stepper With Completed Checkmarks

A four-part checkout drawn as segments across the top: Bag, Address, Delivery and Payment. Finished segments turn rose with a checkmark and a one-line summary of what was saved, and pressing one jumps back to edit it. The Delivery stage holds three radio options, and the main button names the next stage so buyers know what comes after.

<div class="ccs" data-current="2">
  <nav aria-label="Checkout progress">
    <ol class="ccs-steps">
      <li><button type="button"><i aria-hidden="true"></i><b>Bag</b><span class="ccs-sr"></span><small>2 items, $86.00</small></button></li>
      <li><button type="button"><i aria-hidden="true"></i><b>Address</b><span class="ccs-sr"></span><small>18 Orchard Row, Bristol</small></button></li>
      <li><button type="button"><i aria-hidden="true"></i><b>Delivery</b><span class="ccs-sr"></span><small>Standard, 3 to 4 days</small></button></li>
      <li><button type="button"><i aria-hidden="true"></i><b>Payment</b><span class="ccs-sr"></span><small></small></button></li>
    </ol>
  </nav>
  <p class="ccs-now" aria-live="polite"></p>
  <div class="ccs-nav">
    <button type="button" class="ccs-back">Back</button>
    <button type="button" class="ccs-next">Continue</button>
  </div>
</div>
<style>
  .ccs { --ccs-accent: #e11d48; width: calc(100% - 32px); max-width: 42rem; box-sizing: border-box; margin: 48px auto; padding: 28px; border: 1px solid #ffe4e6; border-radius: 16px; background: #fff; font-family: ui-sans-serif, system-ui, sans-serif; color: #0f172a; }
  .ccs button:focus-visible { outline: 2px solid var(--ccs-accent); outline-offset: 2px; }
  .ccs-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
  .ccs-steps button { display: block; width: 100%; min-width: 0; padding: 0 0 4px; border: 0; background: none; text-align: left; font: inherit; color: #475569; cursor: pointer; }
  .ccs-steps button:disabled { cursor: default; }
  .ccs-steps i { display: block; height: 4px; border-radius: 999px; background: #e2e8f0; }
  .ccs-steps b { display: block; margin-top: 8px; font-size: 14px; }
  .ccs-steps small { display: none; overflow: hidden; margin-top: 2px; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; color: #475569; }
  .ccs-steps .is-done i { background: var(--ccs-accent); }
  .ccs-steps .is-done b, .ccs-steps [aria-current] b { color: #0f172a; }
  .ccs-steps .is-done b::before { content: "\2713  "; color: var(--ccs-accent); }
  @media (min-width: 640px) { .ccs-steps .is-done small { display: block; } }
  .ccs-steps [aria-current] i { background: #fda4af; }
  .ccs-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ccs-now { margin: 32px 0 0; font-size: 18px; font-weight: 600; }
  .ccs-nav { display: flex; justify-content: space-between; margin-top: 24px; }
  .ccs-nav button { height: 44px; padding: 0 20px; border: 0; border-radius: 999px; font: 600 14px ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
  .ccs-back { background: none; color: #334155; }
  .ccs-back:disabled { opacity: .4; }
  .ccs-next { background: var(--ccs-accent); color: #fff; }
</style>
<script>
  (function () {
    document.querySelectorAll(".ccs").forEach(function (root) {
      var items = root.querySelectorAll(".ccs-steps li"), current = Number(root.dataset.current), last = items.length - 1;
      function name(i) { return items[i].querySelector("b").textContent; }
      function render() {
        items.forEach(function (li, i) {
          var done = i < current, now = i === current;
          li.classList.toggle("is-done", done);
          if (now) li.setAttribute("aria-current", "step"); else li.removeAttribute("aria-current");
          li.querySelector("button").disabled = !done;
          li.querySelector(".ccs-sr").textContent = done ? ", done, edit" : "";
        });
        root.querySelector(".ccs-now").textContent = "Step " + (current + 1) + ": " + name(current);
        root.querySelector(".ccs-back").disabled = current === 0;
        root.querySelector(".ccs-next").textContent = current === last ? "Pay $86.00" : "Continue to " + name(current + 1).toLowerCase();
      }
      items.forEach(function (li, i) { li.querySelector("button").addEventListener("click", function () { current = i; render(); }); });
      root.querySelector(".ccs-back").addEventListener("click", function () { current = Math.max(0, current - 1); render(); });
      root.querySelector(".ccs-next").addEventListener("click", function () { current = Math.min(last, current + 1); render(); });
      render();
    });
  })();
</script>

With reduced motion: Nothing animates; segments change colour and checkmarks appear in place.

Running cost: Static bars and text; moving between stages re-renders one small form section.

  • Change the stage list and summaries in `stages`; summaries hide on phones to keep the row on one line.
  • Swap the delivery `options` for your carriers and prices.
  • Recolour the finished bars and checkmarks from `bg-rose-600` and `text-rose-600`.

Compact Dots Stepper for Mobile

A five-screen onboarding card for a habit app sized for a phone. A row of small dots tracks progress, with the current one stretched into a violet pill and finished ones in a lighter tint, backed by a plain Step 2 of 5 label. The picture area changes colour with each screen, and Back hides itself on the first step.

<div class="cds-stage">
  <div class="cds" data-current="1">
    <div class="cds-art" aria-hidden="true"><span class="cds-num">2</span></div>
    <div class="cds-body">
      <ol class="cds-dots" aria-label="Step 2 of 5">
        <li><i></i><span class="cds-sr">Pick one small habit</span></li>
        <li><i></i><span class="cds-sr">Choose a time</span></li>
        <li><i></i><span class="cds-sr">Get a nudge</span></li>
        <li><i></i><span class="cds-sr">Look back weekly</span></li>
        <li><i></i><span class="cds-sr">You are set</span></li>
      </ol>
      <p class="cds-count"></p>
      <h2 class="cds-title"></h2>
      <p class="cds-text"></p>
      <div class="cds-nav"><button type="button" class="cds-back">Back</button><button type="button" class="cds-next">Next</button></div>
    </div>
  </div>
</div>
<style>
  .cds-stage { display: flex; justify-content: center; padding: 40px 16px; background: #2e1065; font-family: ui-sans-serif, system-ui, sans-serif; }
  .cds { --cds-accent: #6d28d9; display: flex; flex-direction: column; width: 100%; max-width: 340px; height: 520px; overflow: hidden; border-radius: 32px; background: #fff; color: #0f172a; }
  .cds button:focus-visible { outline: 2px solid var(--cds-accent); outline-offset: 2px; }
  .cds-art { display: grid; place-items: center; height: 224px; background: linear-gradient(135deg, var(--cds-a, #ddd6fe), var(--cds-b, #fae8ff)); }
  .cds-num { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 24px; background: rgba(255,255,255,.7); color: #4c1d95; font-size: 36px; font-weight: 700; }
  .cds-body { display: flex; flex: 1; flex-direction: column; padding: 20px 24px 24px; }
  .cds-dots { display: flex; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
  .cds-dots i { display: block; width: 8px; height: 8px; border-radius: 999px; background: #e2e8f0; transition: width .3s, background-color .3s; }
  .cds-dots .is-done i { background: #a78bfa; }
  .cds-dots [aria-current] i { width: 24px; background: var(--cds-accent); }
  .cds-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cds-count { margin: 16px 0 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--cds-accent); }
  .cds-title { margin: 4px 0 0; font-size: 20px; }
  .cds-text { margin: 8px 0 0; font-size: 14px; line-height: 1.6; color: #475569; }
  .cds-nav { display: flex; justify-content: space-between; margin-top: auto; }
  .cds-nav button { height: 44px; padding: 0 22px; border: 0; border-radius: 999px; font: 600 14px ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
  .cds-back { background: none; color: #334155; }
  .cds-back:disabled { visibility: hidden; }
  .cds-next { background: var(--cds-accent); color: #fff; }
  @media (prefers-reduced-motion: reduce) { .cds-dots i { transition: none; } }
</style>
<script>
  (function () {
    var screens = [
      ["Pick one small habit", "Two minutes of stretching beats an hour you never start.", "#ddd6fe", "#fae8ff"],
      ["Choose a time", "Tie it to something you already do, like the first coffee.", "#bae6fd", "#ede9fe"],
      ["Get a nudge", "One quiet reminder a day. No streak guilt.", "#fde68a", "#ffe4e6"],
      ["Look back weekly", "Sunday evening, see what stuck and drop what did not.", "#a7f3d0", "#ccfbf1"],
      ["You are set", "Your first check-in is tomorrow morning.", "#c4b5fd", "#e0e7ff"]
    ];
    document.querySelectorAll(".cds").forEach(function (root) {
      var dots = root.querySelectorAll(".cds-dots li"), current = Number(root.dataset.current), last = screens.length - 1;
      function render() {
        var s = screens[current];
        dots.forEach(function (li, i) {
          li.classList.toggle("is-done", i < current);
          if (i === current) li.setAttribute("aria-current", "step"); else li.removeAttribute("aria-current");
        });
        root.querySelector(".cds-dots").setAttribute("aria-label", "Step " + (current + 1) + " of " + screens.length);
        root.querySelector(".cds-count").textContent = "Step " + (current + 1) + " of " + screens.length;
        root.querySelector(".cds-title").textContent = s[0];
        root.querySelector(".cds-text").textContent = s[1];
        root.querySelector(".cds-num").textContent = current + 1;
        root.querySelector(".cds-art").style.setProperty("--cds-a", s[2]);
        root.querySelector(".cds-art").style.setProperty("--cds-b", s[3]);
        root.querySelector(".cds-back").disabled = current === 0;
        root.querySelector(".cds-next").textContent = current === last ? "Start" : "Next";
      }
      root.querySelector(".cds-back").addEventListener("click", function () { current = Math.max(0, current - 1); render(); });
      root.querySelector(".cds-next").addEventListener("click", function () { current = current === last ? 0 : current + 1; render(); });
      render();
    });
  })();
</script>

With reduced motion: The active dot changes width at once rather than stretching.

Running cost: Five 8px dots; the active one stretches with a 300ms width transition on a tiny element.

  • Edit `screens`; `tint` is the pair of gradient classes behind the number on each screen.
  • Make the active dot longer with `w-6`, or use `w-2` for all dots and rely on colour alone.
  • Swap the numbered tile for an illustration or photo per screen in the `h-56` area.

Stepper With an Error Step

A domain transfer tracked in four steps where the payment step has failed. Two finished steps show teal ticks and what was done, the failed one turns red with a warning mark, the bank's reason and a Use another card button. Fixing it turns the step amber and ready to pay, and a replay button brings the error back for testing.

<div class="ses" data-current="2" data-failed="true">
  <h2>Transfer quietharbour.studio</h2>
  <ol>
    <li><span class="ses-dot" aria-hidden="true">1</span><div><p class="ses-name">Unlock domain<span class="ses-sr"></span></p><p class="ses-done">Lock removed at your old registrar</p></div></li>
    <li><span class="ses-dot" aria-hidden="true">2</span><div><p class="ses-name">Auth code<span class="ses-sr"></span></p><p class="ses-done">Code accepted</p></div></li>
    <li><span class="ses-dot" aria-hidden="true">3</span><div><p class="ses-name">Payment<span class="ses-sr"></span></p><p class="ses-done">One year added on transfer</p>
      <div class="ses-err" role="alert"><p>Your card ending 0732 was declined by the bank.</p><button type="button" class="ses-fix">Use another card</button></div>
      <div class="ses-cur"><p>Visa ending 4410 is ready to charge $14.</p><button type="button" class="ses-pay">Pay and continue</button></div>
    </div></li>
    <li><span class="ses-dot" aria-hidden="true">4</span><div><p class="ses-name">Confirm transfer<span class="ses-sr"></span></p><p class="ses-done">Takes up to five days</p></div></li>
  </ol>
  <button type="button" class="ses-replay">Replay the declined payment</button>
</div>
<style>
  .ses { width: calc(100% - 32px); max-width: 36rem; box-sizing: border-box; margin: 48px auto; padding: 28px; border: 1px solid #fef3c7; border-radius: 16px; background: #fff; font-family: ui-sans-serif, system-ui, sans-serif; color: #0f172a; }
  .ses button:focus-visible { outline: 2px solid #d97706; outline-offset: 2px; }
  .ses h2 { margin: 0; font-size: 18px; }
  .ses ol { margin: 24px 0 0; padding: 0; list-style: none; }
  .ses li { display: flex; gap: 12px; margin-bottom: 12px; padding: 12px; border-radius: 12px; }
  .ses li p { margin: 2px 0 0; font-size: 14px; color: #475569; }
  .ses .ses-name { margin: 0; font-weight: 600; color: #475569; }
  .ses-dot { display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: #f1f5f9; color: #475569; font-size: 12px; font-weight: 700; }
  .ses-done, .ses-err, .ses-cur { display: none; }
  .ses li.is-done .ses-done { display: block; }
  .ses li.is-done .ses-dot { background: #0d9488; color: #fff; }
  .ses li.is-done .ses-name, .ses li.is-current .ses-name { color: #0f172a; }
  .ses li.is-error { background: #fef2f2; box-shadow: inset 0 0 0 1px #fecaca; }
  .ses li.is-error .ses-dot { background: #dc2626; color: #fff; }
  .ses li.is-error .ses-name { color: #991b1b; }
  .ses li.is-error .ses-err { display: block; }
  .ses li.is-error .ses-err p { color: #b91c1c; }
  .ses li.is-current { background: #fffbeb; box-shadow: inset 0 0 0 1px #fde68a; }
  .ses li.is-current .ses-dot { background: #f59e0b; color: #fff; }
  .ses li.is-current .ses-cur { display: block; }
  .ses-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ses li button, .ses-replay { height: 40px; margin-top: 8px; padding: 0 12px; border: 0; border-radius: 8px; font: 600 14px ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
  .ses-fix { background: #dc2626; color: #fff; }
  .ses-pay { background: #f59e0b; color: #451a03; }
  .ses-replay { background: none; color: #334155; font-weight: 500 !important; }
</style>
<script>
  (function () {
    document.querySelectorAll(".ses").forEach(function (root) {
      var items = root.querySelectorAll("li"), current = Number(root.dataset.current), failed = root.dataset.failed === "true";
      function render() {
        items.forEach(function (li, i) {
          var st = i < current ? "done" : i === current ? (failed ? "error" : "current") : "todo";
          li.className = "is-" + st;
          if (i === current) li.setAttribute("aria-current", "step"); else li.removeAttribute("aria-current");
          li.querySelector(".ses-dot").textContent = st === "done" ? "✓" : st === "error" ? "!" : String(i + 1);
          li.querySelector(".ses-sr").textContent = { done: ", completed", error: ", has an error", current: ", current step", todo: ", not started" }[st];
        });
      }
      root.querySelector(".ses-fix").addEventListener("click", function () { failed = false; render(); root.querySelector(".ses-pay").focus(); });
      root.querySelector(".ses-pay").addEventListener("click", function () { current = Math.min(current + 1, items.length - 1); render(); });
      root.querySelector(".ses-replay").addEventListener("click", function () { current = 2; failed = true; render(); });
      render();
    });
  })();
</script>

With reduced motion: Nothing animates; the red step and its message simply appear and clear.

Running cost: No transitions; state changes swap classes on four list items.

  • Change the failing step with the starting `useState(2)` value and pass your real error message into the alert text.
  • Use the same pattern for a warning that does not block, by styling it amber and leaving later steps reachable.
  • Recolour finished ticks from `bg-teal-600`; keep red reserved for errors so it keeps its meaning.

Vertical Stepper With Step Descriptions

A garden design commission tracked as four stages down a cream card on deep green. Finished stages keep their description and turn the rail green, the current stage shows its text with an action button and Back, and later stages show only their titles. When the last step is done a short message offers to start over.

<div class="vsd-wrap">
  <div class="vsd" data-current="1">
    <p class="vsd-kicker">Commission #2081</p>
    <h2>Your garden, step by step</h2>
    <ol>
      <li><span class="vsd-dot" aria-hidden="true">1</span><div><h3>Site visit<span class="vsd-sr"></span></h3><p>We walk the garden with you, measure it and note soil, light and drainage.</p><div class="vsd-act"><button type="button" class="vsd-next">Visit booked</button></div></div></li>
      <li><span class="vsd-dot" aria-hidden="true">2</span><div><h3>Concept sketches<span class="vsd-sr"></span></h3><p>Two hand-drawn layouts with planting moods. Pick one or mix them.</p><div class="vsd-act"><button type="button" class="vsd-next">Approve a concept</button><button type="button" class="vsd-back">Back</button></div></div></li>
      <li><span class="vsd-dot" aria-hidden="true">3</span><div><h3>Planting plan<span class="vsd-sr"></span></h3><p>A scaled plan with every plant named, plus a cost for materials.</p><div class="vsd-act"><button type="button" class="vsd-next">Approve the plan</button><button type="button" class="vsd-back">Back</button></div></div></li>
      <li><span class="vsd-dot" aria-hidden="true">4</span><div><h3>Build and planting<span class="vsd-sr"></span></h3><p>Our crew builds the hard landscaping first, then plants in a single week.</p><div class="vsd-act"><button type="button" class="vsd-next">Mark as finished</button><button type="button" class="vsd-back">Back</button></div></div></li>
    </ol>
  </div>
</div>
<style>
  .vsd-wrap { padding: 48px 16px; background: #022c22; font-family: ui-sans-serif, system-ui, sans-serif; }
  .vsd { --vsd-accent: #047857; max-width: 32rem; margin: 0 auto; padding: 28px; box-sizing: border-box; border-radius: 16px; background: #f6f3ea; color: #022c22; }
  .vsd button:focus-visible { outline: 2px solid var(--vsd-accent); outline-offset: 2px; }
  .vsd-kicker { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .15em; text-transform: uppercase; color: #065f46; }
  .vsd h2 { margin: 4px 0 0; font: 400 24px ui-serif, Georgia, serif; }
  .vsd ol { margin: 24px 0 0; padding: 0; list-style: none; }
  .vsd li { position: relative; display: flex; gap: 16px; padding-bottom: 24px; }
  .vsd li:last-child { padding-bottom: 0; }
  .vsd li:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 36px; bottom: 4px; width: 2px; border-radius: 2px; background: rgba(6,78,59,.15); }
  .vsd li.is-done::before { background: var(--vsd-accent); }
  .vsd-dot { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; box-sizing: border-box; border: 2px solid rgba(6,78,59,.2); border-radius: 50%; font-size: 14px; font-weight: 600; color: rgba(6,78,59,.7); }
  .is-done .vsd-dot { border: 0; background: var(--vsd-accent); color: #fff; }
  [aria-current] .vsd-dot { border: 0; background: #022c22; color: #f6f3ea; }
  .vsd h3 { margin: 4px 0 0; font-size: 15px; color: #57534e; }
  .is-done h3, [aria-current] h3 { color: #022c22; }
  .vsd li p { margin: 4px 0 0; font-size: 14px; line-height: 1.6; color: #44403c; }
  .vsd li:not(.is-done):not([aria-current]) p, .vsd li:not([aria-current]) .vsd-act { display: none; }
  .vsd-act { display: flex; gap: 8px; margin-top: 12px; }
  .vsd-act button { height: 40px; padding: 0 16px; border: 0; border-radius: 999px; font: 600 14px ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
  .vsd-next { background: #065f46; color: #fff; }
  .vsd-back { background: none; color: #064e3b; font-weight: 500 !important; }
  .vsd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
</style>
<script>
  (function () {
    document.querySelectorAll(".vsd").forEach(function (root) {
      var items = root.querySelectorAll("li"), current = Number(root.dataset.current);
      function render() {
        items.forEach(function (li, i) {
          var done = i < current, now = i === current;
          li.classList.toggle("is-done", done);
          if (now) li.setAttribute("aria-current", "step"); else li.removeAttribute("aria-current");
          li.querySelector(".vsd-dot").textContent = done ? "✓" : String(i + 1);
          li.querySelector(".vsd-sr").textContent = done ? ", completed" : now ? ", current step" : ", upcoming";
        });
      }
      items.forEach(function (li, i) {
        li.querySelector(".vsd-next").addEventListener("click", function () { current = Math.min(i + 1, items.length - 1); render(); items[current].querySelector(".vsd-next").focus(); });
        var back = li.querySelector(".vsd-back");
        if (back) back.addEventListener("click", function () { current = i - 1; render(); items[current].querySelector(".vsd-next").focus(); });
      });
      render();
    });
  })();
</script>

With reduced motion: Nothing animates; steps change state and the rail colour updates in place.

Running cost: No transitions; each change re-renders four list items and nothing else.

  • Edit `steps`; `action` is the label on the button that completes each stage.
  • Show descriptions for upcoming steps too by removing the `(now || done)` condition around the paragraph.
  • Change the card and page colours, `bg-[#f6f3ea]` and `bg-emerald-950`, together to keep the contrast.

Performance notes

A stepper redraws a handful of list items when the step changes, so it costs next to nothing. The connecting lines fill with a scale transform rather than a width change, which keeps the fill smooth while the form below it is busy validating.

Keep the form state in one place above the stepper and pass the current index down; the stepper itself should only display. That way a re-render of one field does not rebuild the whole progress bar, and you can save progress between visits without touching the stepper code.

Questions

How do I make a stepper accessible?

Use an ol so the order is announced, set aria-current="step" on the current item, and include hidden text such as Completed or Has an error next to each step label. Move focus to the new step heading when Next is pressed so screen reader users know the content changed.

Should people be able to click back to earlier steps?

Yes for completed steps, so someone can fix a typo without pressing Back several times. Steps ahead of the current one should stay unclickable until the earlier ones are valid.

How many steps should a multi-step form have?

As few as the task allows. Group related fields so each step has one clear purpose, and if you find yourself past five or six steps, a vertical stepper or a summary page usually reads better than a long horizontal row.

What is the difference between a stepper and a progress bar?

A progress bar shows how much is done as an amount. A stepper names each stage, so people know what is coming next and can go back to a specific one. Long forms often use both: a stepper on desktop and a thin bar on phones.

How do I show a failed step?

Change that step's marker to a warning icon in a red tone, add an error message in text near the label, and keep later steps disabled. The error variant here does this and clears it when the step is fixed.

Also in the gallery: React Stepper and Multi-Step Form Components, Booking Steps Push Up With a Filling Progress Bar.

More collections: React Tab Components: 5 Accessible Tab Styles, React Sidebar Components With Tailwind, Hamburger Menu in HTML and CSS: 5 Menus to Copy. All timelines and steppers. Build your site free to have a full site built around them.

Product

Who It's For

Features

Resources

Company

View Sitemap