FRENVersion française

Input

Stepper

Assistant étape par étape

Demo

Loading demo…

A flow split into numbered steps, with an indicator showing where you are. It makes a long form less daunting: one thing at a time, and you know what is left.

Story

Did you know

The English word "wizard" comes from Microsoft, which named its guided flows after magicians in the early 1990s. Apple always said "Assistant", and French kept that word.

Timeline

  1. 1991Microsoft Publisher introduces "PageWizards".
  2. 1990sSetup wizards (Next › Next › Finish) become second nature.
  3. 2010sE-commerce checkouts split payment into visible steps.

Vocabulary

Names

FR
Assistant étape par étape, assistant, tunnel, indicateur d'étapes, formulaire en plusieurs étapes
EN
Stepper, wizard, multi-step form, progress tracker, step indicator

Common uses

  • Checkout: Cart › Shipping › Payment
  • Onboarding and sign-up
  • Long administrative forms
  • Software installers

Often paired with

The components it usually sits with, by page type, in reading order.

Code

<ol class="stepper">
  <li aria-current="step">Cart</li>
  <li>Shipping</li>
  <li>Payment</li>
</ol>
<p class="sr-only" aria-live="polite" id="status"></p>
<button id="back" disabled>Back</button>
<button id="next">Next</button>

<script>
  const steps = [...document.querySelectorAll('.stepper li')]
  const [status, back, next] = ['#status', '#back', '#next'].map((s) => document.querySelector(s))
  let current = 0

  function go(i) {
    current = i
    steps.forEach((li, j) => {
      li.classList.toggle('done', j < current)
      if (j === current) li.setAttribute('aria-current', 'step')
      else li.removeAttribute('aria-current')
    })
    status.textContent = `Step ${current + 1} of ${steps.length}: ${steps[current].textContent}`
    back.disabled = current === 0
    next.disabled = current === steps.length - 1
  }

  back.addEventListener('click', () => go(current - 1))
  next.addEventListener('click', () => go(current + 1))
</script>

Good to know

  • Keep what people typed when they go back (in state or sessionStorage).
  • Give each step its own URL so the browser Back button works.
  • Validate each step before moving on. An error found at the very end sends people back through everything.
  • End with a summary that links back to each step with "Change", before the final submit.

Accessibility

Must have

  • An ordered list <ol> for the indicator, and aria-current="step" on the current step: that value exists for exactly this case.
  • Each step has a real heading (<h2>). When the step changes, move focus to it (tabindex="-1") so people start from the top.

Often forgotten

  • Announce the change: "Step 2 of 3: Shipping", through the focused heading or an aria-live="polite" region. One or the other, not both.
  • A completed step is not shown by a check mark or color alone: add hidden text such as "(completed)".
  • If each step has its own URL, update document.title too (WCAG 2.4.2).

Nice to have

  • Completed steps become links so people can jump back to them.
  • On error, show a summary at the top of the step with links to each invalid field, and move focus to it.

Who uses it