Skip to content
OAIT Design System

Design system / Components

Stepper

The step header of in-app flows of three or more steps: "Step 2 of 4", the step's heading, and a segmented bar, with Continue and Back ending each step.

When to use

  • Flows of three or more steps done in order, one step per screen: Tamakkan's assessment (Language, Profile, Assessment, Results), the Games demo walkthrough (eight steps), multi-step setup and import flows (D-CSN-20).

When not to use

  • Two-step flows and one-question-per-screen sign-in: keep one step per card, without a stepper, and still move focus to each new heading (Global ID's pattern; D-CSN-20, authentication).
  • "How it works" on a marketing page: the steps row, a numbered list of three or four bare steps (D-CSN-19).
  • The progress of one task in percent (a profile, an upload): the progress bar, with the value in words.
  • Moving between views or sections the person can visit in any order: tabs.

Anatomy

  1. Container (.oa-stepper): the step's <form novalidate>, holding the header, the step's content, and its actions, 24px apart.
  2. Header (__header): count, title, and bar, 8px apart; the bar 8px further down.
  3. Count (__count): "Step 2 of 4", label-md, on-surface-variant.
  4. Title (__title): the step's heading, headline-md; the page's h1 (or the form card's h2), [tabindex="-1"] so it takes focus when the step changes, [aria-describedby] the count.
  5. Bar (__bar): one segment per step, [aria-hidden="true"] because the count says it.
  6. Segment (__segment): 4px tall, 4px apart, full corners; done and current primary-ink, upcoming surface-container-highest; the current one carries [aria-current="step"].
  7. Step content: the step's fields or question.
  8. Actions (__actions, mixed with .oa-actions--page): Continue (the filled lg button, the one main action) first, Back (a text or outlined md button) after it.

Variants

Variant Use for Key tokens
First step No Back; Continue alone (the flow's way out stays in the shell) --color-primary-ink on the first segment
Middle step Continue and Back done and current --color-primary-ink, upcoming --color-surface-container-highest
Last step Continue's label names what the step finishes (D-BCP-21) every segment --color-primary-ink

Sizes

Size Height Padding Type style Icon size
Count 20px line — label-md (14/20 600) —
Title 36px line 8px below the count headline-md (28/36 600) —
Bar 4px 16px below the title; segments 4px apart — —
Continue 56px (--size-button-lg) 28px inline label-lg none
Back 48px (--size-button-md) 24px inline label-lg none

Tokens

Part Property Token
Stepper gap between header, content, and actions --space-stack-loose
Header gap --space-stack-tight; bar --space-2 more
Count text --color-on-surface-variant, --text-label-md
Title text --color-on-surface, --text-headline-md
Segment height, gap, shape 4px (component constant), --space-1, --radius-full
Segment done and current --color-primary-ink (bg-primary-ink)
Segment upcoming --color-surface-container-highest
Actions gap --space-3 (.oa-actions--page)
Continue fill, label --color-primary, --color-on-primary
Back label --color-primary-ink

States

State What changes
Upcoming segment surface-container-highest.
Done and current segments primary-ink; the current one is [aria-current="step"], the done ones are those before it.
Title focused After a step change the title takes focus; the ring shows only when the browser shows focus-visible.
Continue loading [aria-busy="true"] with [aria-disabled="true"], a spinner in the label color, and a progress label with "…"; colors and focus stay (button, D-CAI-06).
Step with errors Continue checks the step; on errors the step stays, the first invalid field takes focus, and each field shows its message (canonical §10.4).
Disabled Never: Continue stays enabled and checks on press, rather than going gray on invalid input (D-CAI-06).

Behavior

  • Changing step. Continue checks the step, then shows the next one: the count, the title, and the bar update together, and focus moves to the new title (title.focus()), so a screen reader hears where the person is (canonical §13).
  • Back returns to the previous step with its answers kept; on the first step there is no Back.
  • Layout. Below 640px Continue is full width and first, Back full width under it; from 640px Continue sits at the inline start and Back after it, 12px apart, both in reading order (.oa-actions--page, canonical §10.1, §10.18).
  • Words carry it. The bar is decoration; "Step 2 of 4" is the information, in the DOM, before the title.
  • Motion. None: segments change with the step and nothing slides between steps; there are no page or view transitions (canonical §7.5).

Accessibility

  • The count is text; the title is a heading (h1 for a full-page flow, h2 inside a form card) with [tabindex="-1"] and [aria-describedby] pointing at the count, so focusing it reads "Profile, Step 2 of 4".
  • The bar is [aria-hidden="true"]; never role="img" or role="progressbar" beside a visible count.
  • Continue is the form's submit button (type="submit"); Back is type="button".
  • Keyboard: Tab reaches the step's fields, then Continue, then Back; Enter in a field submits the step.
  • Contrast: the count on-surface-variant on surface 8.88:1 light and 10.87:1 dark; the title on-surface 16.30:1 and 14.32:1. The segments are decorative; done ones are still 6.79:1 light, 10.85:1 dark.
  • Forced colors: done segments draw in Highlight, upcoming ones in GrayText.

RTL and languages

  • The bar fills from the inline start: from the right in Arabic (canonical §14.2).
  • Western digits in every language, isolated left to right inside Arabic: الخطوة <bdi dir="ltr">2</bdi> من <bdi dir="ltr">4</bdi> (D-TYP-12).
  • The buttons follow the direction: in Arabic Continue sits at the right. Never mirror with row-reverse.
  • French runs longer: the title wraps (balanced); button labels never truncate.

Content

Part Rule English Arabic French
Count "Step {n} of {total}", plural-safe through the message catalog Step 2 of 4 الخطوة 2 من 4 Étape 2 sur 4
Title The step's subject, short, no full stop Profile البيانات Profil
Main button Continue on every step but the last Continue متابعة Continuer
Back Back, never "Previous" Back رجوع Retour
  • Never "Next step", "Proceed", or "Submit" (canonical §12.3). The last step's button names what it does, verb first.
  • Tamakkan's steps: Language, Profile, Assessment, Results · اللغة، البيانات، الاختبار، النتائج · Langue, Profil, Questionnaire, Résultats.

Do and don't

Do Don't
Show "Step 2 of 4" in words above the title. Rely on the bar, numbered bullets, or color to say where the person is.
Move focus to the new title on every step change. Leave focus on a Continue button that is now somewhere else.
Keep Continue enabled and check on press. Gray out Continue until the step is valid.
Use one step per card for two-step flows. Add a stepper to a flow of two steps.
Put Continue first, in reading order. Reorder the buttons with row-reverse or the order property.

Code

HTML (reference CSS)

A middle step (in a product the title is the page's h1):

<form class="oa-stepper" novalidate>
  <div class="oa-stepper__header">
    <p class="oa-stepper__count" id="an-st-count">Step 2 of 4</p>
    <h2 class="oa-stepper__title" id="an-st-title" tabindex="-1" aria-describedby="an-st-count">Profile</h2>
    <div class="oa-stepper__bar" aria-hidden="true">
      <span class="oa-stepper__segment"></span>
      <span class="oa-stepper__segment" aria-current="step"></span>
      <span class="oa-stepper__segment"></span>
      <span class="oa-stepper__segment"></span>
    </div>
  </div>
  <p class="oa-text-body-lg">Answer as honestly as possible to receive accurate results.</p>
  <div class="oa-stepper__actions oa-actions oa-actions--page">
    <button class="oa-btn oa-btn--filled oa-btn--lg" type="submit"><span class="oa-btn__label">Continue</span></button>
    <button class="oa-btn oa-btn--text" type="button"><span class="oa-btn__label">Back</span></button>
  </div>
</form>

The first step:

<form class="oa-stepper" novalidate>
  <div class="oa-stepper__header">
    <p class="oa-stepper__count" id="an-st1-count">Step 1 of 4</p>
    <h2 class="oa-stepper__title" id="an-st1-title" tabindex="-1" aria-describedby="an-st1-count">Choose your language</h2>
    <div class="oa-stepper__bar" aria-hidden="true">
      <span class="oa-stepper__segment" aria-current="step"></span>
      <span class="oa-stepper__segment"></span>
      <span class="oa-stepper__segment"></span>
      <span class="oa-stepper__segment"></span>
    </div>
  </div>
  <div class="oa-stepper__actions oa-actions oa-actions--page">
    <button class="oa-btn oa-btn--filled oa-btn--lg" type="submit"><span class="oa-btn__label">Continue</span></button>
  </div>
</form>

Arabic:

<div dir="rtl" lang="ar">
  <form class="oa-stepper" novalidate>
    <div class="oa-stepper__header">
      <p class="oa-stepper__count" id="an-sta-count">الخطوة <bdi dir="ltr">2</bdi> من <bdi dir="ltr">4</bdi></p>
      <h2 class="oa-stepper__title" id="an-sta-title" tabindex="-1" aria-describedby="an-sta-count">البيانات</h2>
      <div class="oa-stepper__bar" aria-hidden="true">
        <span class="oa-stepper__segment"></span>
        <span class="oa-stepper__segment" aria-current="step"></span>
        <span class="oa-stepper__segment"></span>
        <span class="oa-stepper__segment"></span>
      </div>
    </div>
    <p class="oa-text-body-lg">أجب بأكبر قدر من الصدق لتحصل على نتيجة دقيقة.</p>
    <div class="oa-stepper__actions oa-actions oa-actions--page">
      <button class="oa-btn oa-btn--filled oa-btn--lg" type="submit"><span class="oa-btn__label">متابعة</span></button>
      <button class="oa-btn oa-btn--text" type="button"><span class="oa-btn__label">رجوع</span></button>
    </div>
  </form>
</div>

Tailwind CSS v4

<form class="flex flex-col gap-stack-loose" novalidate>
  <div class="flex flex-col gap-stack-tight">
    <p id="step-count" class="text-label-md text-on-surface-variant">Step 2 of 4</p>
    <h1 id="step-title" tabindex="-1" aria-describedby="step-count" class="text-headline-md text-balance text-on-surface">Profile</h1>
    <div aria-hidden="true" class="mt-2 flex gap-1">
      <span class="h-1 flex-1 rounded-full bg-primary-ink"></span>
      <span class="h-1 flex-1 rounded-full bg-primary-ink"></span>
      <span class="h-1 flex-1 rounded-full bg-surface-container-highest"></span>
      <span class="h-1 flex-1 rounded-full bg-surface-container-highest"></span>
    </div>
  </div>
  <!-- the step's fields -->
  <div class="flex flex-col gap-3 sm:flex-row sm:items-center">
    <!-- Continue: the filled lg button; Back: the text md button (button.md) -->
    <button type="submit">Continue</button>
    <button type="button">Back</button>
  </div>
</form>

React

Prop (Stepper) Type Default Description
step number — The current step, from 1
total number — The number of steps, 3 or more
title string — The step's heading
headingLevel 1 | 2 1 h1 for a full-page flow, h2 inside a form card
onContinue () => void | Promise<void> — Checks the step and moves on; while it runs, Continue shows its loading state
onBack () => void — Leave it out on the first step
continueLabel string 'Continue' Name the result on the last step
children ReactNode — The step's content

The component moves focus to the title whenever step changes and builds the count from the catalog (t('stepper.count', { step, total })).

<Stepper step={2} total={4} title={t('stepProfile')} onContinue={saveProfile} onBack={() => setStep(1)}>
  <TextField label={t('labelName')} autoComplete="name" />
</Stepper>