Directory
- Welcome
Stepper Component
The Stepper component provides a visual representation of progress through a sequence of steps, perfect for multi-step forms, wizards, and progress tracking.
Key Features
-
Multiple Layouts: Horizontal and vertical orientations
-
Visual Variants: Numbers, checkmarks, or mixed indicators
-
Interactive Navigation: Click-to-navigate between steps
-
Accessibility: ARIA labels and keyboard navigation support
Basic Usage
Create a simple horizontal stepper:
<Stepper steps={4} currentStep={2} />
Variants
Vertical Layout
<Stepper steps={3} labels currentStep={2} mode="vertical" />
Checkmark Style
<Stepper steps={4} currentStep={3} variant="checkmarks" />
With Custom Labels
steps
prop is not required if labels
prop is an array. If labels
is set to true
, the labels will be generated as “Step 1”, “Step 2”, etc.
<Stepper currentStep={2} labels={['Introduction', 'Sign Up', 'Confirmation']} />
Overflow Behavior
overflow
prop can be set to scroll
or wrap
. If scroll
is set, the stepper will allow horizontal scrolling. If wrap
is set, the stepper will allow wrapping to next line.
<Stepper currentStep={2} labels={['Introduction', 'Sign Up', 'More Steps', 'Another Step', 'Confirmation']} overflow="scroll" />
<Stepper currentStep={2} labels={['Introduction', 'Sign Up', 'More Steps', 'Another Step', 'Confirmation']} overflow="wrap" />
Navigation
It is recommended to use either sequential or disabled navigation so that the user will not skip over any steps.
Free Navigation
User can click any step to navigate to it.
<Stepper steps={3} currentStep={2} navigation="free" />
Sequential Navigation
User can only navigate back to previous steps.
<Stepper steps={3} currentStep={2} navigation="sequential" />
Disabled Navigation
User cannot navigate to any step.
<Stepper steps={3} currentStep={2} navigation="none" />
Stepper Component Props API
Prop | Type | Default | Description |
---|---|---|---|
steps | number | Total number of steps | |
currentStep | number | 1 | Current active step |
mode | "horizontal" | "vertical" | horizontal | Layout orientation |
variant | "numbers" | "checkmarks" | "mixed" | numbers | Visual style of step indicators |
labels | boolean | string[] | false | Show step labels or custom labels |
navigation | "free" | "sequential" | "none" | none | Navigation mode: free allows clicking any step, sequential only allows previous steps, none disables clicking |
overflow | "scroll" | "wrap" | wrap | Overflow behavior: scroll allows horizontal scrolling, wrap allows wrapping to next line |
Stepper Component Functions API
Function | Type | Description |
---|---|---|
next() | void | Navigate to next step |
previous() | void | Navigate to previous step |
goToStep(step: number) | void | Navigate to specific step |
get: currentStep | number | Current active step |
get: totalSteps | number | Total number of steps |
Stepper Component Events
// Listen for step changesstepper.addEventListener(StepperEventNames.StepChange, (event) => { const { currentStep, totalSteps } = event.detail; console.log('Current step:', currentStep);});
Custom Event Listeners
Click on any step to see events…
Limited Time Launch Sale
Create intuitive multi-step processes with our AstroJS starter template. Get started now!
GET 60% OFF!