Skip to main content
Login

Sign in to access your account

Stepper - National Design System

A stepper shows where the user is in a flow of steps, such as a service application, with the steps done, the current step and the steps to come.

Overview

A stepper is a .nds-stepper of .nds-stepper-step items. Each step has a base with a numbered circle, and content with a title and a description. The script marks each step completed, current or upcoming from the stepper’s data-current, and the line between two circles takes the color of that state. A radial stepper shows only the current step, beside a ring that fills as the user moves on. A static stepper shows an order with no progress, such as a how-it-works row.

Pick another component when:

  • the progress is a percentage, or has no fixed steps: Progress
  • the user opens the parts in any order: Tabs
  • the user pages through one long list: Pagination
  • the steps are dated events, such as a request’s history: Timeline

Markup

Options
Layout
Phone layout
Tablet layout
Size
Type
Icon shape
Icon style
Icon color
Action
Card
More
Preview
Personal Information Identity details and contact information Next: Document Upload
Document Upload Upload the required documents Next: Review
Review Check the details before you submit Next: Submission
Submission Confirmation and next steps
<div class="nds-stepper" id="application-stepper" data-current="2"> <div class="nds-progress-circle"> <svg width="64" height="64" viewBox="0 0 24 24"> <circle class="nds-progress-bg" cx="12" cy="12" r="10" fill="none" stroke-width="3" /> <circle class="nds-progress-track" cx="12" cy="12" r="10" fill="none" stroke-width="3" stroke-dasharray="62.83" stroke-dashoffset="62.83" stroke-linecap="round" /> </svg> <div class="nds-progress-info"> <span class="nds-progress-steps"></span> </div> </div> <div class="nds-stepper-step"> <div class="nds-stepper-base"> <div class="nds-stepper-circle"> </div> </div> <div class="nds-stepper-content"> <div class="nds-stepper-text"> <span class="nds-stepper-title">Personal Information</span> <span class="nds-stepper-description">Identity details and contact information</span> <span class="nds-stepper-next">Next: Document Upload</span> </div> </div> </div> <div class="nds-stepper-step"> <div class="nds-stepper-base"> <div class="nds-stepper-circle"> </div> </div> <div class="nds-stepper-content"> <div class="nds-stepper-text"> <span class="nds-stepper-title">Document Upload</span> <span class="nds-stepper-description">Upload the required documents</span> <span class="nds-stepper-next">Next: Review</span> </div> </div> </div> <div class="nds-stepper-step"> <div class="nds-stepper-base"> <div class="nds-stepper-circle"> </div> </div> <div class="nds-stepper-content"> <div class="nds-stepper-text"> <span class="nds-stepper-title">Review</span> <span class="nds-stepper-description">Check the details before you submit</span> <span class="nds-stepper-next">Next: Submission</span> </div> </div> </div> <div class="nds-stepper-step"> <div class="nds-stepper-base"> <div class="nds-stepper-circle"> </div> </div> <div class="nds-stepper-content"> <div class="nds-stepper-text"> <span class="nds-stepper-title">Submission</span> <span class="nds-stepper-description">Confirmation and next steps</span> </div> </div> </div> </div>

Behavior

Radial

The radial layout shows the current step only, beside a ring. The script fills the ring and writes the step and the count in it, such as “2 / 4”. .nds-stepper-next under the description names the next step. Other layouts hide the ring and the next-step line, so one markup serves every layout.

Responsive Layout

A breakpoint class picks the layout on one screen size: nds-radial-sm on a phone, nds-vertical-md on a tablet. The layout class is the desktop layout, and the layout of a phone or tablet with no breakpoint class: nds-vertical, nds-radial, or none for horizontal. nds-vertical nds-radial-sm nds-radial-md is radial on phones and tablets, and vertical on a desktop. CSS picks the layout, so it changes as soon as the window crosses a breakpoint. The Phone and Tablet buttons on the preview show it at that width. A stepper that is radial on any size needs the ring markup.

Divider Labels

In a vertical stepper, a Divider at the start of a step’s content labels the step: a date, a phase name, or the name of a group of steps. Its line meets the circle and runs on as the separator between steps. A Timeline labels its events this way.

Card

nds-card on a part of the stepper gives that part the Card surface, with its options such as the shadow. On the stepper it makes one card around everything. On every step it puts the circle inside a card. On every step’s content it puts a card beside the circle and keeps the line. Put the class on every step, not on some.

A card on a step needs no other class. The line goes away, the spacing and the text change to fit, and the content fills the card. In a horizontal stepper, the cards share one height. It works with Dot, nds-reverse and divider labels. The border takes the color of the step state: the primary color for the current and the completed steps, the neutral color for the upcoming ones and on a static stepper. With nds-stroke, the card keeps its own border color in place of the state color.

A stepper with On color gives its cards the translucent white surface and the on-color text. Put nds-oncolor on the stepper only.

Separated

nds-separated hides the line between the steps in every layout. A vertical stepper then spaces its steps for a column with no line, and moves the text down to meet the circle’s center. A card on each step does the same with no class.

Icons

nds-icons on the stepper shows the icon in each circle in place of the number. Write one icon in every .nds-stepper-circle. The step states still color the circle, and a completed step shows a check mark in place of its icon. data-step-text shows nothing with icons.

Static

nds-static makes the stepper a plain list of steps in order, such as a how-it-works row. The script writes no step state, so data-current, the methods and the control buttons change nothing on screen. The line is neutral. Write nds-featured-icon nds-circle nds-outline on every .nds-stepper-circle: each circle is a Featured Icon, so its style and color classes change the look, such as nds-dark or nds-green. The stepper size still sets the circle size. Inside a status, such as an info Alert, the circles take that status color. A dot takes no featured icon classes. With nds-oncolor, the circles are light and a color class changes nothing. nds-dark then gives a white fill, like a completed step.

Step Action

A row of buttons in a step goes in nds-stepper-action, under the text. In a vertical stepper, nds-end on the row moves it to the end of the step’s first row, beside the title and the description. The column is as wide as its buttons, up to 40% of the step. A phone stacks the row under the text.

Step Controls

A button with data-stepper-control moves the stepper on every click, with no check. Use it only where nothing can refuse the move: a Back button, a walkthrough, or a Start Over button with goto. data-stepper-target names the stepper. Without it, the button moves the stepper it sits in, or else the first stepper on the page. The Back and Next buttons under the preview work this way.

Checked Moves

When something can refuse the move, such as validation or a request, call NDS.Stepper.next(id) from the code that gets the answer. Every form step is this case: the stepper never validates and never sends a request. A submit button with data-stepper-control inside a form is left to the form, so the stepper does not move and does not stop the submit. The example under API moves the stepper only when the step is valid.

Completion

next() on the last step completes the flow. It moves data-current one past the last step, marks every step completed, and writes completed in the stepper’s data-state. previous() then makes the last step current again. To show a finished flow at page load, write that same data-current. In the radial layout, the last step stays in view with a full ring.

Built-in Features

  • Auto-initialization

    The script starts every nds-stepper on the page. There is nothing to call.

  • Automatic State Management

    Write data-current and the script marks every step completed, current or upcoming. Write a new number later and the steps change with it.

  • Automatic Numbers

    CSS numbers the circles in order, and a completed step shows a check mark. data-step-text on a circle shows other text in place of the number.

  • Placeholders Before Start

    Until the script starts, each step shows as a skeleton in its final layout. A radial stepper shows its first step, so it never shows empty.

  • Step Change Events

    The stepper fires nds:stepper:change after every move, with the current step, the step count and the percent done.

  • Programmatic Control

    A script moves a stepper with NDS.Stepper.next(id), NDS.Stepper.prev(id) and NDS.Stepper.goTo(id, step).

Best Practices

  • Give the stepper an id. Control buttons and the JavaScript methods find the stepper by its id.
  • Keep a title to 2 to 4 words. Put the rest in the description.
  • Keep a horizontal stepper to 3 to 5 steps, so every title fits its column. A radial stepper reads best with 3 to 6 steps.
  • A horizontal stepper has no room on a phone. Add nds-radial-sm and the ring markup, so a phone shows the radial layout.
  • Move a form step with NDS.Stepper.next(), not data-stepper-control. Validation or a request can refuse the move.
  • Give every control button type="button". Inside a form, a button with no type is a submit button, and the stepper leaves it to the form.
  • Write .nds-stepper-next in every radial step except the last.
  • Put nds-card on every step or on every step’s content. A stepper with some cards and some plain steps does not line up.
  • Put one main button in an action with nds-end. A row of buttons wraps inside its narrow column.
  • To change the layout after load, change the class on the stepper. CSS alone sets the layout, so the change shows at once.
  • Use nds-static for a list that explains an order. A flow the user moves through keeps the step states.
  • Give a circle icon aria-hidden="true". The step title names the step.
  • Name the current step in the page as well, such as in the form heading. A screen reader hears the current step, but not which steps are completed or upcoming.

API

Other Classes

Class Element Effect
nds-horizontal-sm, nds-vertical-sm, nds-radial-sm .nds-stepper The layout on a phone: narrower than 600px. See Responsive Layout under Behavior
nds-horizontal-md, nds-vertical-md, nds-radial-md .nds-stepper The layout on a tablet: 600px to 959px
nds-md .nds-stepper.nds-radial The 64px ring. It is the default, so it needs no class
nds-stepper-action div in .nds-stepper-content A row of buttons in a step. Each button keeps its own width
nds-row .nds-stepper-content The parts of the step side by side, from the start edge, such as a Date Tile beside the text
nds-reverse .nds-stepper in a vertical layout The last step on top. Write the steps oldest first. For a Timeline

Data Attributes

Attribute Element Effect
data-current .nds-stepper The current step, from 1. Write it at page load: without it, step 1 is current. The script watches it: write a new number and the steps change, and nds:stepper:change fires. Code that holds the step number, such as a framework view, can drive the stepper this way. A number one past the last step shows every step completed. A static stepper ignores it
data-total .nds-stepper The number of steps. The script writes it when it starts. After you add or remove steps, write the new count in it, and the script reads the steps again
data-state .nds-stepper The script writes completed when next() runs on the last step, or when data-current is past it. It removes it when the stepper moves back. Write loading yourself to show the skeleton: it works the same as nds-loading
data-state .nds-stepper-step The script writes completed, current or upcoming on each step from data-current. It colors the circle and the border of a card on the step or its content. The script writes none on a static stepper. Do not write it yourself
aria-current="step" .nds-stepper-step The script writes it on the current step, so screen readers hear it. No step has it when all are completed, or on a static stepper
data-step-text .nds-stepper-circle Text in place of the step number, such as a letter. A completed step shows its check mark. A dot and nds-icons show no text
data-stepper-control button next, previous or goto. The click moves the stepper. See Step Controls under Behavior
data-stepper-target button with data-stepper-control The id of the stepper the button moves
data-stepper-value button with data-stepper-control="goto" The step number to go to

CSS Custom Properties

Set these on .nds-stepper. The size classes set --stepper-size too, so set it in the stepper’s style to win over them.

Property Default Controls
--stepper-size 32px Circle diameter, or ring diameter in the radial layout
--stepper-gap from the layout Space between steps. Unset, it is --stepper-indicator-gap in a row (1.2 times with nds-lg, 1.5 times with nds-xl), 1.5 circles in a column, half a circle in a column of cards on the content, var(--spacing-xl) in a column with no line (a card on each step has none), and a spacing token that grows with the size in the radial layout
--stepper-indicator-gap var(--spacing-md) The space between steps in a row, before the size classes scale it
--stepper-text-padding var(--spacing-xl) Space between the circle and the step content
--gap var(--spacing-xl) Space between the parts of a step’s content: a label divider, the text, a list, a row of buttons
--stepper-content-width var(--paragraph-max-width) The widest a step’s content gets. Set none for a step that holds a table or a wide image. With a card on the step the default is none, so the content fills the card
--divider-lift calc(var(--stepper-size) / 4) Moves a label divider down, so its line meets the middle of the circle. 0 by default with nds-dot, nds-separated, or a card on a step or on its content. Set 0 to leave the divider where it falls
--stepper-card-lift calc(var(--stepper-size) / 4) How far a card on the content rises in a column, so its first line meets the circle. var(--stepper-size) with nds-dot. Set it when the content starts with something taller or shorter than a title
--stepper-action-width 40% The widest the action column gets with nds-end, as a share of the step. A row of buttons wraps inside it
--stepper-title-FS, --stepper-title-LH set by the size class Title font size and line height in the radial layout. The text does not grow with the ring, so set them for a large title beside a small ring. Set both
--stepper-description-FS, --stepper-description-LH set by the size class Font size and line height of the description and the next-step line in the radial layout

Tokens

Set a token at :root, or on a wrapper to reach every stepper inside it. Give a token with a Dark mode value a dark override too: see Tokens.

Source: the stepper group in _sass/tokens/_components.scss.

TokenPreviewValue
--stepper-button-completed
var(--colors-primary-600)
Dark mode var(--colors-primary-500)
--stepper-button-completed-hovered
var(--colors-primary-700)
Dark mode var(--colors-primary-600)
--stepper-button-current
var(--colors-primary-600)
Dark mode var(--colors-primary-500)
--stepper-button-current-hovered
var(--colors-primary-700)
Dark mode var(--colors-primary-600)
--stepper-button-upcoming
var(--colors-neutral-300)
Dark mode var(--colors-neutral-600)
--stepper-button-upcoming-hovered
var(--colors-neutral-400)
Dark mode var(--colors-neutral-600)
--stepper-button-background
var(--background-default)
Dark mode var(--colors-neutral-800)
--stepper-text-primary
var(--text-display)
Dark mode var(--colors-neutral-100)
--stepper-text-secondary
var(--text-primary-paragraph)
Dark mode var(--colors-neutral-300)
--stepper-text-tertiary
var(--text-secondary-paragraph)
Dark mode var(--colors-neutral-400)
--stepper-line-completed
var(--colors-primary-600)
Dark mode var(--colors-primary-500)
--stepper-line-current
var(--colors-neutral-300)
Dark mode var(--colors-neutral-600)
--stepper-line-upcoming
var(--colors-neutral-300)
Dark mode var(--colors-neutral-600)

It also reads these shared tokens. A change to one also changes other components.

Source: the var() reads in _sass/components/_stepper.scss.

TokenPreviewValue
--background-surface-oncolor
Read by background-color, --date-tile-bg, border-color, --progress-color
var(--colors-base-white)
--background-neutral-light
Read by --date-tile-bg

var(--colors-neutral-100)
Dark mode var(--colors-alpha-white-10)
--background-primary
Read by background-color
var(--colors-primary-600)
--text-oncolor-primary
Read by --date-tile-color, color, --card-text-color
var(--colors-base-white)
--text-oncolor-secondary
Read by color
var(--colors-alpha-white-80)
--text-oncolor-tertiary
Read by color
var(--colors-alpha-white-70)
--progress-background-neutral
Read by --progress-color

var(--colors-neutral-700)
Dark mode var(--colors-neutral-200)

JavaScript

The NDS.Stepper script loads after the page shows. Until it loads, each call loads it and returns a promise of the result, so await a call whose result you use.

A stepper in the page starts by itself. The instance is on the element as el.ndsStepper, and NDS.Stepper.getInstance(idOrEl) returns it. It is there once the component starts: code that runs at page load waits for NDS.init.ready.

Method Effect
NDS.Stepper.init() Starts every .nds-stepper that has not started
NDS.Stepper.create(el) Starts one stepper, such as one added after load, and returns its instance
NDS.Stepper.destroy(idOrEl) The same as instance.destroy()
NDS.Stepper.getInstance(idOrEl) Returns the instance of the stepper with that id, or on that element. null when there is none
NDS.Stepper.next(idOrEl), NDS.Stepper.prev(idOrEl) Moves one step. On the last step, next() completes the flow
NDS.Stepper.goTo(idOrEl, step) Moves to a step number. One past the last step completes the flow. Returns false for any other number outside the steps
NDS.Stepper.control(idOrEl, action, value) What a control button calls. action is next, previous or goto, and value is the step for goto
instance.next(), instance.prev(), instance.goTo(step) The same moves on one instance
instance.current, instance.total, instance.progress The current step, the number of steps, and the percent done. current is one past the last step when the flow is completed
instance.destroy() Removes the instance. The stepper keeps its look, and a later init() or create() starts it again
Event Fired on Detail
nds:stepper:change .nds-stepper, and bubbles currentStep, totalSteps, progressPercentage. currentStep is one past the last step when the flow is completed, the same number data-current takes. Fires after every move, and after a script writes data-current or data-total. It does not fire when the stepper starts
// Continue: move only when the step on screen is valid. // The button sits in the form. validate() skips the fields in a hidden step. document.getElementById('continue-button').addEventListener('click', function (e) { if (NDS.Form.validate(e.currentTarget).valid) NDS.Stepper.next('application-stepper'); }); // Change something outside the stepper with the step document.getElementById('application-stepper').addEventListener('nds:stepper:change', function (e) { console.log('Step', e.detail.currentStep, 'of', e.detail.totalSteps); }); // Last step: move only when the request succeeds. The form has data-ajax, // so Forms validates it, stops the POST and fires nds:form:valid. document.getElementById('application-form').addEventListener('nds:form:valid', function () { sendApplication().then(function () { NDS.Stepper.next('application-stepper'); }); });

The full API is in the banner of _js/nds-stepper.js.

Last Modified Date: 20/11/2026 - 04:53 PM
Was this page useful?
60% of users said Yes from 2843 Feedbacks