Skip to content

Stepper

alpha

Shows which step of an ordered process someone is on: which ones are done, which one is current, which one has an error, and which one is being validated. By default it’s an indicator; when navigable, it lets people go back to a step already reached or a step with an error.

Navigation · TaishoDS Core, in plain HTML.

Examples

One working example per case. Each example is the HTML of its preview—copy it as is, and with Core’s CSS and JS loaded, it looks and works the same.

New project setup

  1. Project Completed
  2. Plan
  3. Team
  4. Review
html

Navigable

  1. Review
html

Navigable with links

  1. Project Completed
  2. Plan Completed
  3. Review
html

With an error and validating

  1. We couldn’t process the payment.
  2. Review
html

Custom icons and an optional step

  1. Project Completed
  2. Plan
  3. TeamOptional
  4. Review
html

Vertical with descriptions

  1. Queued Completed Ana Torres requested it for Production.
  2. Building Building the main branch.
  3. Ready It goes live in Production.
html

Narrow container

  1. Project Completed
  2. Plan
  3. Team
  4. Review
html

Class reference

Every value of each modifier, with its HTML ready to copy.

Size

sm, md (default), or lg: they change the mark and the label.

  1. Project Completed
  2. Plan
  3. Team
  1. Project Completed
  2. Plan
  3. Team
  1. Project Completed
  2. Plan
  3. Team
html

Orientation

horizontal (a row, the default) or vertical (a column with the connector under the mark).

  1. Project Completed
  2. Plan
  3. Team
  1. Project Completed
  2. Plan
  3. Team
html

States

is-complete, is-invalid, is-loading, is-active (with aria-current), and is-disabled, on the step.

  1. Done Completed
  2. Error Error The payment method is missing.
  3. Validating Validating
  4. Current
  5. Disabled Unavailable
  6. Pending
html

When to use

  • A sign-up, a checkout, or a setup in steps with a fixed order.
  • It helps to know how much is left and where an error is.
  • A process that moves on its own and is followed at a glance (a deployment: Queued, Building, Ready), vertical with descriptions.

When not to use

  • The sections have no order and can be visited in any order → tabs.
  • Only the amount of progress matters, without named steps → progress.
  • It’s the location within a page hierarchy → breadcrumbs.

Do

  • One- or two-word labels, and few steps (3 to 6): in a narrow container only the marks and the summary remain.
  • When the step changes, focus goes to the heading of the content being shown (with tabindex="-1"), after checking the change wasn’t canceled: the component doesn’t move it.
  • The error message goes in the step’s description (stepper-description with aria-describedby), not only in the color.
  • Give the root a width: it compresses based on its container’s width, so inside a flex row or a container that shrinks to its content it needs ts w-full or flex-1.

Don’t

  • Don’t put triggers on steps not reached yet. They’re text, not disabled buttons. The current step keeps its own (Core sets aria-disabled on it) so focus isn’t lost.
  • Don’t use it as a menu for a page with unrelated sections → tabs.

TaishoDS Core

Needs Core’s JS, which hooks in through data-ts-* attributes.

The indicator and steps with links work without JavaScript. With <button data-ts-stepper-trigger>, Core handles choosing another step, the summary, the live region, and compressing to the width.

Core hooks into it through these attributes. They go in the markup, and there’s nothing to initialize.

  • data-ts-stepper
  • data-ts-stepper-step
  • data-ts-stepper-trigger
  • data-ts-value

What it does: A click on the trigger of a step that isn’t the current one emits ts:change ({ component: 'stepper', value, index }, cancelable) before changing anything. If nothing stops it, it moves is-active and aria-current="step" (on the trigger, or on the <li> if there’s none) to that step, and the new current step’s trigger gets aria-disabled="true": it stays, so focus isn’t lost, but it doesn’t activate or, if it’s a link, navigate. It doesn’t touch is-complete or is-invalid, which belong to the app, and it doesn’t move focus: the app moves it to the heading of the step it shows. If the app changes is-active in code, aria-current, the trigger, and the summary follow it (without ts:change), and when a step’s is-complete, is-invalid, is-loading, or is-disabled changes, Core rewrites its hidden text, aria-busy, and the error’s aria-describedby, and the live region announces it (“Plan: error. We couldn’t process the payment.”). While a trigger has focus, the summary says “Go to: Plan”. It measures whether the row fits its container, on init and whenever its width changes: if it doesn’t fit it sets is-compressed (the marks and the summary stay), and if it still doesn’t fit, is-minimal (the summary and the step bar); vertical never compresses. Without JavaScript, the root compresses below a 384 px container.

Attribute What it does
data-ts-stepperOn the <ol class="ts stepper" role="list">: the root. It takes an aria-label.
data-ts-stepper-step, data-ts-valueOn each <li class="ts stepper-step">: the step and its value, which travels in ts:change. It carries aria-posinset and aria-setsize, so screen readers say “2 of 4” without counting the last <li>.
data-ts-stepper-triggerOn the <button class="ts stepper-trigger"> of each step already reached or with an error: it makes it selectable. Steps not reached yet are text. An <a class="ts stepper-trigger" href> doesn’t take it: it navigates on its own.
ts stepper-optionalInside stepper-label: “Optional” under the label.
data-stepper-state, data-stepper-markThe hidden state text (“Completed”, “Unavailable”…) and the four marks in stepper-indicator (pending, complete, invalid, loading): CSS shows the one for the class’s state. A custom icon goes inside the pending mark.
data-stepper-summary, data-stepper-liveOn the last <li>: the visible summary (with aria-hidden="true", in data-stepper-summary-text, plus the step bar) and the live region (role="status") that announces state changes.
is-stickyOn the root: it sticks to the top while scrolling, below another sticky bar (--ts-sticky-top), and publishes its height in --ts-sticky-offset. So focus isn’t covered, put ts scroll-pt-sticky on <html>. Inside a container with its own scroll, it sticks there and doesn’t add to the page’s height.

From the CDN, without a build, load taisho.stepper.css along with taisho.base.css. Also load:

  • taisho.icon.css
  • taisho.progress.css
  • taisho.spinner.css

For how Core works in general, see Behavior.

Stop the change and move focus

With unsaved changes, cancel ts:change: the step doesn’t change and a role="status" region says why. If the change goes ahead, the app shows the step’s content and, after checking that nothing canceled it (queueMicrotask), moves focus to its heading: the Stepper doesn’t move focus. It’s the same pattern as the “Stop the change” example of the Svelte version.

html

Theme tokens

Values you change from the theme, in themes.<theme>.components[…]. When a value has two, the second is for compact density.

Variable Type Factory value
--ts-stepper-mark-size-smlengthvar(--ts-sizing-20) / var(--ts-sizing-18)
--ts-stepper-mark-sizelengthvar(--ts-sizing-24) / var(--ts-sizing-20)
--ts-stepper-mark-size-lglengthvar(--ts-sizing-28) / var(--ts-sizing-24)
--ts-stepper-connector-widthlengthvar(--ts-sizing-2)
--ts-stepper-connector-colorcolorvar(--color-gray-200)
--ts-stepper-connector-color-completecolorvar(--color-gray-1000)
--ts-stepper-fillcolorvar(--color-primary-solid)
--ts-stepper-fill-textcolorvar(--color-primary-solid-contrast)
--ts-stepper-ringcolorvar(--ts-stepper-fill, var(--color-primary-solid))

Accessibility

  • It’s an <ol> with an explicit role="list" (Safari drops list semantics from an <ol> without bullets) and an aria-label. Each step carries aria-posinset and aria-setsize, so it’s announced as “2 of 4”. The last <li> holds the summary and the live region: the list counts one more item (a screen reader may say “list, 5 items”), a limit of <ol>, which only accepts <li> children.
  • The current step carries aria-current="step" on its trigger if it has one, otherwise on the <li>. Core keeps exactly one, also when the app changes is-active in code.
  • State doesn’t rely on color or the icon. Each step carries hidden text (data-stepper-state) saying “Completed”, “Error”, “Validating”, or “Unavailable”. The mark is aria-hidden and holds all four (number, check, cross, and Spinner); CSS shows the one for the state. When the app changes is-complete, is-invalid, is-loading, or is-disabled in code, Core rewrites the hidden text, aria-busy, and the error message’s aria-describedby. The current step adds a ring with a gap, so it stands out among many completed steps without relying on the fill.
  • A step with an error links its message (stepper-description) with aria-describedby, on the trigger if it has one and on the step otherwise. A step being validated carries aria-busy="true".
  • State changes are announced: a polite live region (role="status") says “Plan: error. We couldn’t process the payment.”, “Plan: validating.”, or “Plan: completed.” when the app changes the step’s class. The initial state isn’t announced.
  • As an indicator it has no Tab stops. When navigable, steps already reached and steps with an error are native links or buttons (one stop each, no roving), so you can go back to the furthest step; steps not reached yet are text. The current step keeps its trigger with aria-disabled="true": focus isn’t lost when you choose it, it doesn’t activate, and if it’s a link, it doesn’t navigate.
  • Changing steps doesn’t move focus. The app moves it to the heading of the content it shows (with tabindex="-1"), after checking that nothing canceled the change.
  • When the row doesn’t fit its container, the labels become sr-only: they’re no longer visible but are still read, and the visible summary (“Step 2 of 4 · Plan”) is aria-hidden because it repeats what the list says. While a trigger has focus, the summary says which step it leads to (“Go to: Plan”). If it still doesn’t fit, the steps become sr-only and the summary and the step bar remain; the step that receives focus shows again.
  • The trigger is as tall as a small control (32 px; 28 px in compact density), above the 24 px WCAG 2.5.8 asks for. With forced-colors: active, the current and completed steps paint with Highlight, the current one adds a separate Highlight outline, a step with an error gets a 2 px border, and pending connectors use GrayText.

Verification

What was actually tested. Anything that wasn’t tested says so—we’d rather say “not verified” than claim too much.

  • axe WCAG 2.2 A + AA in a real browser, in light and dark mode, before every release.
  • keyboard Adds no keys of its own—it uses the browser’s native behavior.
  • screen reader Not verified with a screen reader. Test it in your own combination of components, not just here, where each one appears alone and on its happy path.