Skip to content
Mosaic
On this page

Stepper

Shows how far the user is through a fixed number of steps: a label, the current step over the total, and one segment per step. Steps are 1-based; value and max floor to whole numbers of at least 1, and value clamps to max.

Use for

  • progress through a multi-step flow, such as step 2 of 3
  • segments that jump back to an earlier step

Practices

GuidancePractice
DoPass localized label, countLabel and stepLabel. The defaults are English.
DoKeep the current step in the flow's machine and pass it as value. See Multi-step flows (mosaic guides inspect controllers).

API reference

Stepper

Renders a div with the text (cl-stepper-text, holding cl-stepper-label and cl-stepper-count) and the segments (cl-stepper-segments). Each segment is a cl-stepper-segment with data-state of complete, current or upcoming. Carries data-value and data-max.

Slot: cl-stepper

PropTypeDescription
valuenumberThe current step, from 1.
maxnumberThe number of steps.
onValueChange(value: number) => voidMakes each segment a button that calls this with its step. The current one gets aria-current='step'. Without it the segments are aria-hidden.
labelstringText before the count.Default: 'Step'
countLabelstringThe count, with {step} and {total} filled in.Default: '{step} of {total}'
stepLabelstringEach segment button's accessible name, with {step} filled in.Default: 'Step {step}'

Examples

Read-only

TSX
<Stepper value={1} max={3} />

Navigable

TSX
<Stepper value={step} max={3} onValueChange={setStep} />