Stepper

A sequence of steps to complete an action.

Preview
Code

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 />

PropertyTypeDescription
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.

StateTypeDescription
previousStepstring | undefinedThe previously active step.
previousStepIndexnumberThe index of the previously active step.
currentStepstring | undefinedThe active step.
currentStepIndexnumberThe index of the active step.
disabledbooleanTrue if the component is disabled.
isFirstStepbooleanTrue if the step index is 0.
isLastStepbooleanTrue if the step index is the last.

<StepperSteps />

PropertyTypeDescription
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.

StateTypeDescription
currentStepIndexnumberThe index of the active step.
PropertyTypeDescription
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.

StateTypeDescription
currentStepIndexnumberThe index of the related item.
activebooleanTrue if the list is currently active.
itemNamestringThe name of the related item.

<StepperItem />

PropertyTypeDescription
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.

StateTypeDescription
indexnumberThe index of the item.
namestringThe unique name of the item.

<StepperPrev />

PropertyTypeDescription
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.

StateTypeDescription
disabledbooleanTrue if: - Parent `<Stepper />` component is disabled. - `disabled` prop is true. - The current step index is 0.
canGoPrevbooleanTrue if the current step index is not 0.

<StepperNext />

PropertyTypeDescription
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.

StateTypeDescription
disabledbooleanTrue if: - Parent `<Stepper />` component is disabled. - `disabled` prop is true. - The current step index is 0.
canGoNextbooleanTrue if: - `canGoNext` function is given and passed. - Will return value of the `disabled` prop if `canDoNext` is not passed.