Svelte Component

Steppers

Divide and present content in sequenced steps.

typescript
import { Stepper, Step } from '@skeletonlabs/skeleton';
Source Page Source

Demo

Get Started!

This example Stepper will teach you how to use this component. Tap next to proceed to the next step.

Create a set of Steps within the Stepper, then use the on:complete event to detect when all steps are complete. Since horizontal space may be limited on small screens, we recommend no more than five steps at max.

Event Handlers

Complete Event

typescript
function onCompleteHandler(e: Event): void { console.log('event:complete', e); }
html
<Stepper on:complete={onCompleteHandler}>...</Stepper>

Next, Step and Previous

Events are fired when the next or previous steps are pressed, step fires for both cases.

typescript
function onStepHandler(e: {step: number, state: {current: number, total: number}}): void {
	console.log('event:step', e); 
}
html
<Stepper on:next={onNextHandler} on:step={onStepHandler} on:back={onBackHandler}>...</Stepper>
TIP: e.state.current contains the step shown to the user after navigation, e.step contains the step where navigation occured.

Locked State

Each Step can have a locked property set, when set to TRUE this locks progression for that step. For example, you can lock a step until a form within it becomes valid.

typescript
let lockedState: boolean = true;
html
<Step locked={lockedState}>...</Step>