4.76.0

Stepper

Displays sequential steps

Demo

const stepItems = [{ "label": "First step with a name which is so long that it wraps", "completed": true, "substeps": [ { "label": "Substep 1 with a long label that wraps", "completed": true }, { "label": "Substep 2", "completed": true } ] }, { "label": "Second", "completed": true }, { "label": "Third", "active": true, "substeps": [ { "label": "Substep 1 with a long label that wraps", "completed": true }, { "label": "Substep 2", "completed": false } ] }, { "label": "Fourth", "substeps": [ { "label": "Substep 1", "completed": false }, { "label": "Substep 2", "completed": false } ] }]; const stepper = document.getElementById("stepper1"); stepper.stepItems = stepItems; const stepper2 = document.getElementById("stepper2"); stepper2.stepItems = stepItems; const stepper3 = document.getElementById("stepper3"); stepper3.stepItems = stepItems; const workflowStepItems = [{ "label": "First step", "completed": true }, { "label": "Second", "completed": true }, { "label": "Third", "active": true }, { "label": "Fourth" }]; const stepper4 = document.getElementById("stepper4"); stepper4.stepItems = workflowStepItems;

API

Tag

Name Description
<s-stepper> Custom Element

Attributes

Name Value Required Description
stepitems String

Stringified JSON array of step item objects. Each item can include an optional substeps array. See Guidelines and Substeps.

vertical Boolean attribute

Displays the steps vertically.

simplified Boolean attribute

Displays the simplified stepper variant.

workflow Boolean attribute

Displays the workflow stepper variant: the vertical steps, indented between Started and Complete markers.

startlabel String

Label for the start marker of the workflow stepper, replacing Started.

endlabel String

Label for the end marker of the workflow stepper, replacing Complete.

i18n string

A stringified JSON object which defines a list of localized strings. The keys must be one of the string IDs defined below.

Properties

Name Value Required Description
stepItems String

Stringified JSON array of step item objects. Each item can include an optional substeps array. See Guidelines and Substeps.

vertical Boolean attribute

Displays the steps vertically.

simplified Boolean attribute

Displays the simplified stepper variant.

workflow Boolean attribute

Displays the workflow stepper variant: the vertical steps, indented between Started and Complete markers.

startLabel String

Label for the start marker of the workflow stepper, replacing Started.

endLabel String

Label for the end marker of the workflow stepper, replacing Complete.

i18n object

A JSON object which defines a list of localized strings. The keys must be one of the string IDs defined below.

Demo

API

Tag

Name
<SStepper>

Props

Name Value Required Description
stepItems Array

Array of step item objects. Each item can include an optional substeps array. See Guidelines and Substeps.

vertical Boolean

Displays the steps vertically.

simplified Boolean

Displays the simplified stepper variant.

workflow Boolean

Displays the workflow stepper variant: the vertical steps, indented between Started and Complete markers.

startLabel String

Label for the start marker of the workflow stepper, replacing Started.

endLabel String

Label for the end marker of the workflow stepper, replacing Complete.

i18n object

A JSON object which defines a list of localized strings. The keys must be one of the string IDs defined below.

Skylab React links

General information about using our React package

i18n Strings

ID Description Default value
"stepper.slash" Separator between the current step number and the step count in the simplified stepper. /
"stepper.currentStep" Text for screen readers that marks the active step. Current step
"stepper.completed" Text for screen readers that marks a completed step or substep. completed
"stepper.started" Label for the start marker of the workflow stepper. Started
"stepper.complete" Label for the end marker of the workflow stepper. Complete

Typescript

Exported types

export type SubstepItem = { label: string; completed?: boolean; }; // Object provided (in array) to stepItems prop export type StepItem = { label: string; completed?: boolean; active?: boolean; substeps?: SubstepItem[]; };

Guidelines

Creating steps

The individual step items within the Stepper component are set via an array of objects.

const stepItems = [ { "label": string, // required "active": boolean, // gives active styling to item "completed": boolean, // gives completed styling to item "substeps": [ // optional; see Substeps below { "label": string, "completed": boolean }, ], }, ]; const stepper = document.querySelector("s-stepper"); stepper.stepItems = stepItems;

Substeps

Any step can include a substeps array. Each substep is an object with a required label and an optional completed flag. Completed substeps show a check in the marker.

The substeps list is only visible for steps that are completed or active. For steps that are still upcoming, substeps stay in the DOM but are hidden so the flow stays uncluttered.

The simplified variant shows only the current step label and count; it does not render substeps.

To pass the step items to the s-stepper component, you can either set the stepItems property equal to your array of objects, as in the code sample above, or you can stringify your array and set the stepitems attribute.

Workflow

The workflow variant shows the progress of a workflow. It lays the steps out vertically, indented between Started and Complete markers that are joined by a track. Don't include substeps in a workflow stepper; keep each step a single item. If simplified is also set, the simplified variant is shown.

To label the markers for your workflow, such as Draft and Filed, set startlabel and endlabel with localized text. These take precedence over the stepper.started and stepper.complete i18n strings, which exist only to translate the default labels.

Design

Design resources can be found on the Skylab design documentation site: skylab.avalara.com