Skip to the content
Konstruktor UI

Navigation

Stepper

Where a person is in a task of several steps. .kui-stepper around an ordered list; each step is done, current, waiting or has an error. On a phone only the current step's name shows, as “Step 2 of 4”.

CSS only

Examples

Horizontal, in a checkout

Done steps are links back to that step. The current one has aria-current="step". Narrow the window under 640 pixels to see the short form.

HTML
<nav class="kui-stepper" aria-label="Registration steps">
  <ol>
    <li data-state="done"><span class="kui-stepper__label"><a href="#stepper-1">Company</a><span class="kui-visually-hidden">, done</span></span></li>
    <li aria-current="step"><span class="kui-stepper__label">Address</span></li>
    <li><span class="kui-stepper__label">Bank account</span></li>
    <li><span class="kui-stepper__label">Review and send</span></li>
  </ol>
  <p class="kui-stepper__status">Step 2 of 4: Address</p>
</nav>

Vertical, with an error

.kui-stepper--vertical lays the steps down a column, for a guide or a side panel. A step that needs fixing has data-state="error"; say what is wrong in its name.

HTML
<nav class="kui-stepper kui-stepper--vertical" aria-label="Tax return steps">
  <ol>
    <li data-state="done"><span class="kui-stepper__label"><a href="#stepper-v1">Lični podaci</a><span class="kui-visually-hidden">, done</span></span></li>
    <li data-state="done"><span class="kui-stepper__label"><a href="#stepper-v2">Prihodi iz radnog odnosa</a><span class="kui-visually-hidden">, done</span></span></li>
    <li data-state="error"><span class="kui-stepper__label"><a href="#stepper-v3">Prihodi od zakupa</a><span class="kui-visually-hidden">, needs fixing:</span> the amount for March is missing</span></li>
    <li aria-current="step"><span class="kui-stepper__label">Olakšice i odbici</span></li>
    <li><span class="kui-stepper__label">Pregled i slanje</span></li>
  </ol>
</nav>

States

Every state

Waiting: an outlined circle with the step's number. Current (aria-current="step"): the accent ring and strong text. Done (data-state="done"): a filled circle with a tick and a filled line to the next step. Error (data-state="error"): a red circle with an exclamation mark. Each state is also said in words for screen readers.

  1. Done, finished
  2. Error, needs fixing
  3. Current
  4. Waiting
  5. Unterschriftsberechtigung

Step 3 of 5: Current

HTML
<div class="kui-stepper" role="group" aria-label="Every state">
  <ol>
    <li data-state="done"><span class="kui-stepper__label">Done<span class="kui-visually-hidden">, finished</span></span></li>
    <li data-state="error"><span class="kui-stepper__label">Error<span class="kui-visually-hidden">, needs fixing</span></span></li>
    <li aria-current="step"><span class="kui-stepper__label">Current</span></li>
    <li><span class="kui-stepper__label">Waiting</span></li>
    <li><span class="kui-stepper__label">Unterschriftsberechtigung</span></li>
  </ol>
  <p class="kui-stepper__status">Step 3 of 5: Current</p>
</div>

Classes and attributes

.kui-stepper
The stepper: a nav when done steps are links, else a div with role="group" and an aria-label.
ol > li
One step. The number comes from a CSS counter.
li[aria-current="step"]
The current step.
li[data-state="done"], li[data-state="error"]
A finished step, or a step that needs fixing.
.kui-stepper__label
The step’s name; may hold a link back to the step.
.kui-stepper__status
“Step 2 of 4: Address”, shown in place of the names under 640 pixels.
--vertical
Steps down a column, with their names beside the circles at every width.

Keyboard

Tab
Moves through the links to steps that can be visited again.
Enter
Opens that step.

Accessibility

  • The current step carries aria-current="step".
  • The tick and the exclamation mark are drawn by CSS; write “done” and “needs fixing” as visually hidden words in the label so screen readers hear the state.
  • Steps that cannot be visited yet are not links.
  • The list is ordered, so a screen reader says “3 of 5”.
  • On a phone the other steps’ names stay in the page for screen readers; only the eye sees “Step 2 of 4”.

Do and do not

Do

  • Use three to six steps.
  • Name each step by what the person does there.
  • Let a person go back to a done step without losing what they entered.

Do not

  • Do not use a stepper for a form of one screen.
  • Do not let a person jump ahead to a step that needs an earlier one.
  • Do not show an error state without saying what is wrong.