Stepper
The <nys-stepper> is a reusable web component for use in New York State digital products. It indicates to a user how many steps are in a process. It updates to reflect the user's progress through the form.
Team Information
Provide details about your team. Who are you working with? What is your role?
<div class="nys-grid-row">
<nys-stepper
label="Register for Design System Office Hours"
class="nys-desktop:nys-grid-col-4"
>
<nys-step
label="Personal Details"
></nys-step>
<nys-step
label="Team Info"
selected
></nys-step>
<nys-step
label="Usage Survey"
current
></nys-step>
<nys-step
label="Newsletter Opt-In"
></nys-step>
</nys-stepper>
<div class="nys-desktop:nys-grid-col-8" id="nys-stepper-content">
<div style="padding: 2rem; background-color: #fff;">
<h2>Team Information</h2>
<p>Provide details about your team. Who are you working with? What is your role?</p>
<nys-textinput label="Agency Name" required width="md"></nys-textinput>
<nys-textinput label="Team Name" required width="md"></nys-textinput>
</div>
</div>
</div>
Can't use NYS design System web components in your project? Try using the CSS Variables instead.
Options
Multi Page vs. Single Page Stepper
The nys-stepper can be used in both multi-page and single-page applications.
Multi-Page
- The
hrefshould contain the URL of the page to navigate to when the step is clicked. - You will be responsible for managing the
currentandselectedstates of the steps as the user progresses through the pages. - Be sure to add the
nys-stepperto each page of the multi-page application, since each step will be a separate page load.
Single-Page
- The
hrefshould contain only the inner HTML of the step, not a full page URL. - The
selectedstep will dynamically update as the user clicks on different steps. - You will be responsible for managing the
currentstate of the steps as the user progresses through the steps. - You will need to listen for the
nys-step-clickevent to load the content of the step into a container on the page.
Compact
On small screens, the nys-stepper will render in a compact mode where the progress is indicated by bars rather than complete steps. You can expand to see the names of steps by clicking on "Step x of y"
Actions Slot
- You can add actions to the stepper by using the
actionsslot. The action slot only acceptsnys-buttonand will render at the top of thenys-stepperon desktop and at the end of the stepper on mobile.
Step Options
Each step is represented by a <nys-step> element inside the <nys-stepper>.
Label
href and onClick
Add a href if the content of the step is plain html:
Add an onClick if the content of the step is retrieved from an API or a function needs to be called:
States
Selected
- Represents which step is being displayed to the user.
- The
selectedstep by default will matchcurrentstep ifselectedis not defined. selectedcannot exist on a step later than thecurrentstep, if this is done by mistake it will correct to matchcurrent.
Current
- Represents which step is the user is up to in the stepper's progress.
- This is the last step the user is able to navigate to.
- Users can go back and review past completed steps, therefor
currentandselectedmight not be the same at a given moment. - As the user completes steps, update the
currentflag to the next step, this needs to be done on the user side. - if
currentis not defined, the first step is marked by default.
Previous
- This prop is automatically applied to all steps before the
currentstep and is used to style the steps properly. - Do not add
previousto a step on the implementation side.
Usage
When to use this component
- Use a stepper for linear, ordered forms with more than 2 sections.
- Use a stepper to show progress through a multi-step process.
When to consider something else
- If there are only 1 or 2 sections to a form do not use a stepper.
- Forms that are nonlinear and can be completed in any order should not use a stepper.
Do
- Use a stepper for linear, ordered forms with more than 2 sections.
- Use a stepper to show progress through a multi-step process.
- Ensure that users can navigate back to previous steps to review or change information.
Don't
- Do not use the stepper if there are only 1 or 2 sections to the form.
- Do not use the stepper for forms that are nonlinear and can be completed in any order.
Accessibility
The nys-stepper component includes the following accessibility-focused features:
- Proper ARIA roles and attributes to ensure screen readers can interpret the steps correctly.
- Keyboard navigation support, allowing users to iterate the steps using the keyboard.
- Visual focus indicators to help users navigate the component.
Properties
| Property | Type | Component |
|---|---|---|
id |
String | nys-stepper |
name |
String | nys-stepper |
label |
String | both |
selected |
boolean | nys-step |
current |
boolean | nys-step |
href |
String (URL) | nys-step |
onClick |
JS function | nys-step |
CSS Variables
There are no existing CSS variables for this component. Explore existing options, or propose a new one with a Component Proposal.
Events
The <nys-stepper> component emits the following events:
nys-step-click- Emitted when anys-stepis clicked
You can listen to these events using JavaScript:
Suggest a New Component
Do you have an idea for a new NYS Design System web component? Look through the existing proposals in our GitHub discussions board to see if someone already proposed something similar. If not, feel free to submit one.
Edit this page on GitHub (Permissions required)
Last updated: November 4, 2025