Stepper
A sequence of steps to complete an action.
Basic Example
<script>
import { Stepper, StepperItem, StepperLink, StepperNext, StepperPrev, StepperSteps } from '$lib/index.js';
</script>
<Stepper>
<StepperSteps>
<StepperLink item="intro">Intro</StepperLink>
<StepperLink item="details">Details</StepperLink>
<StepperLink item="summary">Summary</StepperLink>
</StepperSteps>
<StepperItem name="intro">Intro</StepperItem>
<StepperItem name="details">Details</StepperItem>
<StepperItem name="summary">Summary</StepperItem>
<StepperPrev>Prev</StepperPrev>
<StepperNext>Next</StepperNext>
</Stepper>
API Reference
<Stepper />
| Property | Type | Description |
|---|---|---|
step | string | The current active step. |
disabled | boolean | Disables the entire component tree. |
orientation | Orientation | Which direction in which the stepper is being used. This will change the direction of the arrow keys used when keyboard navigating. |
onStepChange | (activeStep: string) => void | Fires when the `step` property has changed. |
onPrevStep | (activeStep: string) => void | Fires when the stepper has gone back a previous step. |
onNextStep | (activeStep: string) => void | Fires when the stepper has gone forward a step. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
| State | Type | Description |
|---|---|---|
previousStep | string | undefined | The previously active step. |
previousStepIndex | number | The index of the previously active step. |
currentStep | string | undefined | The active step. |
currentStepIndex | number | The index of the active step. |
disabled | boolean | True if the component is disabled. |
isFirstStep | boolean | True if the step index is 0. |
isLastStep | boolean | True if the step index is the last. |
<StepperSteps />
| Property | Type | Description |
|---|---|---|
ref | E | The reference to the underlying element. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
custom | Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]> | Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it. |
| State | Type | Description |
|---|---|---|
currentStepIndex | number | The index of the active step. |
<StepperLink />
| Property | Type | Description |
|---|---|---|
item | string | The unique ID of the `<StepperItem />` to jump to. |
skipCanDoNext | boolean | Skips checking if the step to jump to is available. This means if step 2 and 3 has a canDoNext check, pressing step 4 will redirect to step 2. |
disabled | boolean | Disables the button, stopping events from firing. |
ref | E | The reference to the underlying element. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
custom | Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]> | Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it. |
| State | Type | Description |
|---|---|---|
currentStepIndex | number | The index of the related item. |
active | boolean | True if the list is currently active. |
itemName | string | The name of the related item. |
<StepperItem />
| Property | Type | Description |
|---|---|---|
name | string | The unique ID of the stepper. |
canGoNext | () => boolean | This condition must be met to move to the next step. |
ref | E | The reference to the underlying element. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
custom | Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]> | Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it. |
| State | Type | Description |
|---|---|---|
index | number | The index of the item. |
name | string | The unique name of the item. |
<StepperPrev />
| Property | Type | Description |
|---|---|---|
disabled | boolean | Disables the button, stopping events from firing. |
ref | E | The reference to the underlying element. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
custom | Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]> | Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it. |
| State | Type | Description |
|---|---|---|
disabled | boolean | True if: - Parent `<Stepper />` component is disabled. - `disabled` prop is true. - The current step index is 0. |
canGoPrev | boolean | True if the current step index is not 0. |
<StepperNext />
| Property | Type | Description |
|---|---|---|
disabled | boolean | Disables the button, stopping events from firing. |
ref | E | The reference to the underlying element. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
custom | Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]> | Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it. |
| State | Type | Description |
|---|---|---|
disabled | boolean | True if: - Parent `<Stepper />` component is disabled. - `disabled` prop is true. - The current step index is 0. |
canGoNext | boolean | True if: - `canGoNext` function is given and passed. - Will return value of the `disabled` prop if `canDoNext` is not passed. |