Controlled
Use the step and onStepChange props to control state programmatically.
Orientation
Using the orientation prop to control the layout.
Direction
Set the text direction (ltr or rtl) using the dir prop.
Anatomy
Here’s an overview of how the Steps component is structured in code:
import { Steps } from '@skeletonlabs/skeleton-react';
export default function Anatomy() {
return (
<Steps>
<Steps.List>
<Steps.Item>
<Steps.Trigger>
<Steps.Indicator />
</Steps.Trigger>
<Steps.Separator />
</Steps.Item>
</Steps.List>
<Steps.Content />
<Steps.PrevTrigger />
<Steps.NextTrigger />
</Steps>
);
}<script lang="ts">
import { Steps } from '@skeletonlabs/skeleton-svelte';
</script>
<Steps>
<Steps.List>
<Steps.Item>
<Steps.Trigger>
<Steps.Indicator />
</Steps.Trigger>
<Steps.Separator />
</Steps.Item>
</Steps.List>
<Steps.Content />
<Steps.PrevTrigger />
<Steps.NextTrigger />
</Steps>API Reference
Root
| Prop | Default | Type |
|---|---|---|
ids | — | ElementIds | undefined The custom ids for the stepper elements |
step | — | number | undefined The controlled value of the stepper |
defaultStep | — | number | undefined The initial value of the stepper when rendered. Use when you don't need to control the value of the stepper. |
onStepChange | — | ((details: StepChangeDetails) => void) | undefined Callback to be called when the value changes |
onStepComplete | — | VoidFunction | undefined Callback to be called when a step is completed |
linear | — | boolean | undefined If `true`, the stepper requires the user to complete the steps in order |
orientation | "horizontal" | "horizontal" | "vertical" | undefined The orientation of the stepper |
count | — | number | undefined The total number of steps |
isStepValid | () => true | ((index: number) => boolean) | undefined Whether a step is valid. Invalid steps block forward navigation in linear mode. |
isStepSkippable | () => false | ((index: number) => boolean) | undefined Whether a step can be skipped during navigation. Skippable steps are bypassed when using next/prev. |
onStepInvalid | — | ((details: StepInvalidDetails) => void) | undefined Called when navigation is blocked due to an invalid step. |
dir | "ltr" | "ltr" | "rtl" | undefined The document's text/writing direction. |
getRootNode | — | (() => ShadowRoot | Node | Document) | undefined A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. |
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Provider
| Prop | Default | Type |
|---|---|---|
value | — | StepsApi<PropTypes> |
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Context
| Prop | Default | Type |
|---|---|---|
children | — | (steps: StepsApi<PropTypes>) => ReactNode |
List
| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Item
| Prop | Default | Type |
|---|---|---|
index | — | number |
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Trigger
| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"button">) => Element) | undefined Render the element yourself |
Indicator
| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Separator
| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Content
| Prop | Default | Type |
|---|---|---|
index | — | number |
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
PrevTrigger
| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"button">) => Element) | undefined Render the element yourself |
NextTrigger
| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"button">) => Element) | undefined Render the element yourself |
Root
| Prop | Default | Type |
|---|---|---|
ids | — | ElementIds | undefined The custom ids for the stepper elements |
step | — | number | undefined The controlled value of the stepper |
defaultStep | — | number | undefined The initial value of the stepper when rendered. Use when you don't need to control the value of the stepper. |
onStepChange | — | ((details: StepChangeDetails) => void) | undefined Callback to be called when the value changes |
onStepComplete | — | VoidFunction | undefined Callback to be called when a step is completed |
linear | — | boolean | undefined If `true`, the stepper requires the user to complete the steps in order |
orientation | "horizontal" | "horizontal" | "vertical" | undefined The orientation of the stepper |
count | — | number | undefined The total number of steps |
isStepValid | () => true | ((index: number) => boolean) | undefined Whether a step is valid. Invalid steps block forward navigation in linear mode. |
isStepSkippable | () => false | ((index: number) => boolean) | undefined Whether a step can be skipped during navigation. Skippable steps are bypassed when using next/prev. |
onStepInvalid | — | ((details: StepInvalidDetails) => void) | undefined Called when navigation is blocked due to an invalid step. |
dir | "ltr" | "ltr" | "rtl" | undefined The document's text/writing direction. |
getRootNode | — | (() => ShadowRoot | Node | Document) | undefined A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. |
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
Provider
| Prop | Default | Type |
|---|---|---|
value | — | () => StepsApi<PropTypes> |
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
Context
| Prop | Default | Type |
|---|---|---|
children | — | Snippet<[() => StepsApi<PropTypes>]> |
List
| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
Item
| Prop | Default | Type |
|---|---|---|
index | — | number |
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
Trigger
| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"button">]> | undefined Render the element yourself |
Indicator
| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
Separator
| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
Content
| Prop | Default | Type |
|---|---|---|
index | — | number |
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
PrevTrigger
| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"button">]> | undefined Render the element yourself |
NextTrigger
| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"button">]> | undefined Render the element yourself |