Developer Programs

Learn

Docs

Steps

Components > Miscellaneous > Steps
Use this component to...
Prompt the user for an ordered set of multiple values, one step at a time

Overview

The steps component is a type of Wizard. Both are used to walk the user through a workflow process, one step at a time.

The steps can be used for multi-step workflows that are:

  • Linear: meaning that there’s no branching in the workflow, there is only one path through the process.
  • Short: usually only 5 steps or less.

The steps component displays a horizontal band with a number and a short text label for each step in the workflow. As the user progresses through the workflow, the current step lights up to let the user know where they are in the process. Only the UI elements for the current step display.

You can configure the component to either allow users to click a step header to jump to that step or you can turn off that feature so that users must interact with other elements within each step (say a Next button) in order to move forward or backwards through the workflow.

Regardless of whether you allow users to click step headers to jump to that step, you must also include some action button that allows the user to move to the next step, typically labeled “Next >”. Depending on the nature of the workflow, you may also want to include a “< Back” button to allow users to move backwards through the workflow.

Due to its horizontal layout, the steps component is not suitable for use at mobile size. The accordion group box is a more appropriate option for that screen size.
Here is the second step of an order workflow, labeled “Billing Address”. You can see the billing address fields displayed, as well as Back and Next buttons for moving through the workflow.
Steps component

Development

Web component development

Component reference

p-steps
p-steps
Module: StepsModule - Package: primeng
⚠️ This component requires the use of Angular and will not work in non-Angular applications.

Used to walk the user through a workflow process, one step at a time

View the p-steps reference doc

If you're adding PrimeNG to your solution for the first time, reference their setup documentation. It's important to note that the inclusion of the nova-light theme css is not necessary to work with Responsive UI. Styling for the PrimeNG components is provided by Responsive UI's theming.

Implementation

Include primeng in package.json, where x.y.z is the currently supported version number specified here. Use npm install to install this framework.

Package dependencies
"primeng": "x.y.z",

Begin by importing the StepsModule module into your application.

Import the module
import { StepsModule } from 'primeng/steps';

@NgModule({
    imports: [
        ...
        StepsModule,
        ...
    ]
})

export class AppModule() {}

In the TypeScript, import the MenuItem class. This is used to define each step in the process.

Import MenuItem
import { MenuItem } from 'primeng/api';

Declare an array of MenuItem objects. We’ll use this to define the process steps in a moment. Also declare a number that contains the index of the current step. Initialize that to zero.

Define MenuItem objects
    public stepItems: MenuItem[];
    public stepIndex: number = 0;

Define the steps in the workflow in the ngOnInit method. For each step, define the text label that displays for that step, as well as a handler that sets the stepIndex model property to the appropriate value when the user clicks that step.

Define the steps
ngOnInit() {
    this.stepItems = [{
        label: 'Shipping Address',
        command: (event: any) => {
            this.stepIndex = 0;
        }
    },
    {
        label: 'Billing Address',
        command: (event: any) => {
            this.stepIndex = 1;
        }
    },
    {
        label: 'Payment Method',
        command: (event: any) => {
            this.stepIndex = 2;
        }
    },
    {
        label: 'Shipping',
        command: (event: any) => {
            this.stepIndex = 3;
        }
    },
    {
        label: 'Confirm Order',
        command: (event: any) => {
            this.stepIndex = 4;
        }
    }];
}

The Back and Next buttons in your workflow will also decrement and increment the same stepIndex property used by the steps component.

In the HTML, place a p-steps element where the steps component should go. Bind the model attribute to the stepItems array, bind the activeIndex property to the stepIndex model property, and set readOnly to false if the user can click step headers to switch to that step, or true if the user should not be able to click step headers to switch to that step.

Steps HTML
    <p-steps [model]="stepItems" [activeIndex]="stepIndex" [readonly]="false"></p-steps>

Below the steps component, add a separate div for each step in the process that includes the UI elements for that step. Use *ngIf to include the div for each step, based on the stepIndex property.

HTML for each step
<div *ngIf="stepIndex == 0">
    . . .
</div>

Angular wrapper development

Wrapper reference

p-steps
p-steps
Module: StepsModule - Package: primeng

Used to walk the user through a workflow process, one step at a time

View the p-steps reference doc

If you're adding PrimeNG to your solution for the first time, reference their setup documentation. It's important to note that the inclusion of the nova-light theme css is not necessary to work with Responsive UI. Styling for the PrimeNG components is provided by Responsive UI's theming.

Implementation

Include primeng in package.json, where x.y.z is the currently supported version number specified here. Use npm install to install this framework.

Package dependencies
"primeng": "x.y.z",

Begin by importing the StepsModule module into your application.

Import the module
import { StepsModule } from 'primeng/steps';

@NgModule({
    imports: [
        ...
        StepsModule,
        ...
    ]
})

export class AppModule() {}

In the TypeScript, import the MenuItem class. This is used to define each step in the process.

Import MenuItem
import { MenuItem } from 'primeng/api';

Declare an array of MenuItem objects. We’ll use this to define the process steps in a moment. Also declare a number that contains the index of the current step. Initialize that to zero.

Define MenuItem objects
    public stepItems: MenuItem[];
    public stepIndex: number = 0;

Define the steps in the workflow in the ngOnInit method. For each step, define the text label that displays for that step, as well as a handler that sets the stepIndex model property to the appropriate value when the user clicks that step.

Define the steps
ngOnInit() {
    this.stepItems = [{
        label: 'Shipping Address',
        command: (event: any) => {
            this.stepIndex = 0;
        }
    },
    {
        label: 'Billing Address',
        command: (event: any) => {
            this.stepIndex = 1;
        }
    },
    {
        label: 'Payment Method',
        command: (event: any) => {
            this.stepIndex = 2;
        }
    },
    {
        label: 'Shipping',
        command: (event: any) => {
            this.stepIndex = 3;
        }
    },
    {
        label: 'Confirm Order',
        command: (event: any) => {
            this.stepIndex = 4;
        }
    }];
}

The Back and Next buttons in your workflow will also decrement and increment the same stepIndex property used by the steps component.

In the HTML, place a p-steps element where the steps component should go. Bind the model attribute to the stepItems array, bind the activeIndex property to the stepIndex model property, and set readOnly to false if the user can click step headers to switch to that step, or true if the user should not be able to click step headers to switch to that step.

Steps HTML
    <p-steps [model]="stepItems" [activeIndex]="stepIndex" [readonly]="false"></p-steps>

Below the steps component, add a separate div for each step in the process that includes the UI elements for that step. Use *ngIf to include the div for each step, based on the stepIndex property.

HTML for each step
<div *ngIf="stepIndex == 0">
    . . .
</div>

Design

Figma design

Figma design info
You can find this component in the Components - Content Layout page in the Figma UI Kit.
Dev ComponentDesign Component Name
Step barRUI / Layout / Steps / Step Bar
Step

RUI / Layout / Steps / Step

Available values for the State property:

  • Active
  • Inactive

The Steps pattern is very similar to the Wizard pattern design. Both patterns walk the user through a linear series of steps, prompting for a set of inputs for each step.

The Steps pattern displays a series of numbered step headers across the top, acting similar to the step links in the Wizard pattern. Each step header includes a title.

Back/Next buttons display at the top of the display block, enabling the user to move linearly through the Steps component.

The user can optionally click the step headers to jump directly to that step. This isn’t immediately intuitive to some users, so we use Back/Next buttons to provide a familiar, intuitive way for users to move forward and backwards through the process.

First, add a step bar component to the artboard. Size the step bar to fit all of the steps.

Next, add one active step component for the currently active step.

Then add one or more inactive step components for the other steps.

Do not change the width of the active/inactive step components; the corresponding dev components for the step headers have a fixed width and cannot be resized.


Adobe XD design

Adobe XD design info
You can find this component in these artboards in the Adobe XD design samples:
  • Sample App - Steps
Dev ComponentDesign Component Name
Step barJHA / Layout / Steps / Step Bar
Step - activeJHA / Layout / Steps / Step / Active
Step - inactiveJHA / Layout / Steps / Step / Inactive

The Steps pattern is very similar to the Wizard pattern design. Both patterns walk the user through a linear series of steps, prompting for a set of inputs for each step.

The Steps pattern displays a series of numbered step headers across the top, acting similar to the step links in the Wizard pattern. Each step header includes a title.

Back/Next buttons display at the top of the display block, enabling the user to move linearly through the Steps component.

The user can optionally click the step headers to jump directly to that step. This isn’t immediately intuitive to some users, so we use Back/Next buttons to provide a familiar, intuitive way for users to move forward and backwards through the process.

First, add a step bar component to the artboard. Size the step bar to fit all of the steps.

Next, add one active step component for the currently active step.

Then add one or more inactive step components for the other steps.

Do not change the width of the active/inactive step components; the corresponding dev components for the step headers have a fixed width and cannot be resized.


Support options
Have questions on this topic?
Join the Responsive UI team in Microsoft Teams to connect with the community.
See something in this page that needs to change?
Send us feedback on this page.
Last updated Wed Apr 19 2023