Skip to content

Machine-translated – improvements welcome. Suggest an improvement

Step bar

Schrittleiste is the bar above a flow in steps (#1515): number and name per step, a tick on finished steps, the current one highlighted. The setup assistant, “Create package” and “Install package” all use exactly this component.

What it is for

For a flow in several steps that you go through in order (assistant). With only one step there is no bar. Different content to switch between freely are Tabs.

Rules:

  • A flow in steps uses this bar, never one of its own. With only one step there is no bar.
  • The buttons stay at the bottom in the same place: “Back” on the left, on the right the main button naming the next step (“Next: Permissions”), in the last step the action itself (“Install”).
  • Forward, the bar only jumps to steps that have already been shown and with nothing missing before them.

Matching patterns in the pattern catalogue: C3 · Assistants step by step with Back, C12 · Main button at the bottom, C14 · Kinds of buttons: fixed, the same everywhere (principle 6: disabled with a reason).

How to use it

With How it works
Mouse A click on a finished step leads back there (klick). A click on a locked step shows the reason below the bar. Forward goes with the main button at the bottom (“Next: Permissions”).
Keyboard Tab reaches the clickable and locked steps as buttons; Enter or Space trigger them. Steps that can't be clicked are not a stop.
Touch Clickable steps have the touch area of a button.

What it means

Tick – this step is done. Highlighted – you are here. Number without tick – still to come. A locked step says on click why it can't go on there yet (principle 6). “Done” is not a step of its own.

States

State How it comes about How it looks
current aktiv highlighted, aria-current="step"
done erledigt (by default all before the current one) tick instead of number
clickable klick(i) returns an action as a button, leads to the step
locked gesperrt(i) returns a reason on click the reason below the bar
at the start aktiv={0} first step highlighted, none done

“Step bar” section of the pattern page: in the middle of a flow and at the start

“Step bar” section, dark

Accessibility

Screen readers announce the bar as “Step 2 of 3: Permissions”. The current step carries aria-current="step"; the numbers are decoration only (aria-hidden). The reason of a locked step appears as role="status" below the bar and is announced.

Code

import { Schrittleiste } from '../bausteine';

<Schrittleiste
  schritte={['Origin', 'Permissions', 'Settings']}
  aktiv={aktiv}
  klick={(i) => (i < aktiv ? () => setAktiv(i) : null)}
  gesperrt={(i) => (i > aktiv ? t('pakete.ablauf.gesperrt', { name: schritte[aktiv] }) : null)}
/>
Property Meaning
schritte Names of the steps, one short word each; “done” is not a step of its own
aktiv Index of the current step (from 0), with aria-current="step"
erledigt Which steps get a tick; by default all before the current one
klick What a click on step i does, or null (not clickable). Usually finished steps lead back
gesperrt Why step i is locked – shown below the bar on click (principle 6)

Files and tests

  • Component: web/src/bausteine/schrittleiste/Schrittleiste.tsx, look: .assistent-schritte in web/src/stile/gemeinsam-seiten.css
  • Pattern page: web/src/bausteine/schrittleiste/muster.tsx
  • Steps of “Install package”: web/src/werkbank/paket-ablauf/schritte.ts, test web/test/paket-ablauf-schritte.test.ts