Stepper
Address
Add your address here
Shipping
Set your preferred shipping method
Checkout
Confirm your order
Features
- Can be controlled or uncontrolled.
- Supports horizontal/vertical orientation.
- Supports linear/non-linear activation.
- Full keyboard navigation.
Installation
Install the component from your command line.
$ npm add reka-uiAnatomy
Import all parts and piece them together.
<script setup>
import { StepperDescription, StepperIndicator, StepperItem, StepperRoot, StepperTitle, StepperTrigger } from 'reka-ui'
</script>
<template>
<StepperRoot>
<StepperItem>
<StepperTrigger />
<StepperIndicator />
<StepperTitle />
<StepperDescription />
<StepperSeparator />
</StepperItem>
</StepperRoot>
</template>API Reference
Root
Contains all the stepper component parts.
| Prop | Default | Type |
|---|---|---|
as | 'div' | AsTag | ComponentThe element or component this component should render as. Can be overwrite by |
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | |
defaultValue | 1 | numberThe value of the step that should be active when initially rendered. Use when you do not need to control the state of the steps. |
dir | 'ltr' | 'rtl'The reading direction of the combobox when applicable. | |
linear | true | booleanWhether or not the steps must be completed in order. |
modelValue | numberThe controlled value of the step to activate. Can be bound as | |
orientation | 'horizontal' | 'vertical' | 'horizontal'The orientation the steps are laid out. Mainly so arrow navigation is done accordingly (left & right vs. up & down). |
| Emit | Payload |
|---|---|
update:modelValue | [payload: number]Event handler called when the value changes |
| Slots (default) | Payload |
|---|---|
modelValue | number | undefinedCurrent step |
totalSteps | numberTotal number of steps |
isNextDisabled | booleanWhether or not the next step is disabled |
isPrevDisabled | booleanWhether or not the previous step is disabled |
isFirstStep | booleanWhether or not the first step is active |
isLastStep | booleanWhether or not the last step is active |
goToStep | Go to a specific step |
nextStep | Go to the next step |
prevStep | Go to the previous step |
| Data Attribute | Value |
|---|---|
[data-orientation] | "vertical" | "horizontal" |
[data-linear] | Present when linear |
Item
The step item component.
| Prop | Default | Type |
|---|---|---|
as | 'div' | AsTag | ComponentThe element or component this component should render as. Can be overwrite by |
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | |
completed | false | booleanShows whether the step is completed. |
disabled | false | booleanWhen |
step* | numberA unique value that associates the stepper item with an index |
| Slots (default) | Payload |
|---|---|
state | 'active' | 'completed' | 'inactive'The current state of the stepper item |
| Data Attribute | Value |
|---|---|
[data-state] | "active" | "inactive" | "completed" |
[data-disabled] | Present when disabled |
[data-orientation] | "vertical" | "horizontal" |
Trigger
The trigger that toggles the step.
| Prop | Default | Type |
|---|---|---|
as | 'button' | AsTag | ComponentThe element or component this component should render as. Can be overwrite by |
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. |
| Data Attribute | Value |
|---|---|
[data-state] | "active" | "inactive" | "completed" |
[data-disabled] | Present when disabled |
[data-orientation] | "vertical" | "horizontal" |
Indicator
The indicator for the step.
| Prop | Default | Type |
|---|---|---|
as | 'div' | AsTag | ComponentThe element or component this component should render as. Can be overwrite by |
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. |
Title
An accessible title to be announced when the stepper trigger is focused.
If you want to hide the title, wrap it inside our Visually Hidden utility like this <VisuallyHidden asChild>.
| Prop | Default | Type |
|---|---|---|
as | 'h4' | AsTag | ComponentThe element or component this component should render as. Can be overwrite by |
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. |
Description
An optional accessible description to be announced when the stepper trigger is focused.
If you want to hide the description, wrap it inside our Visually Hidden utility like this <VisuallyHidden asChild>. If you want to remove the description entirely, remove this part and pass aria-describedby="undefined" to StepperTrigger.
| Prop | Default | Type |
|---|---|---|
as | 'div' | AsTag | ComponentThe element or component this component should render as. Can be overwrite by |
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | |
completed | false | booleanShows whether the step is completed. |
disabled | false | booleanWhen |
step* | numberA unique value that associates the stepper item with an index |
| Slots (default) | Payload |
|---|---|
state | 'active' | 'completed' | 'inactive'The current state of the stepper item |
Examples
Vertical
You can create vertical steps by using the orientation prop.
<script setup>
import { StepperDescription, StepperIndicator, StepperItem, StepperList, StepperRoot, StepperTitle } from 'reka-ui'
</script>
<template>
<StepperRoot
:default-value="1"
orientation="vertical"
>
<StepperList aria-label="stepper example">
<StepperItem>
<StepperIndicator />
<StepperTitle />
<StepperDescription />
</StepperItem>
<StepperItem>
<StepperIndicator />
<StepperTitle />
<StepperDescription />
</StepperItem>
</StepperList>
</StepperRoot>
</template>Accessibility
Keyboard Interactions
| Key | Description |
|---|---|
Tab | When focus moves onto the steps, focuses the first step . |
ArrowDown | Moves focus to the next step depending on orientation. |
ArrowRight | Moves focus to the next step depending on orientation . |
ArrowUp | Moves focus to the previous step depending on orientation . |
ArrowLeft | Moves focus to the previous step depending on orientation . |
EnterSpace | Selects the focused step. |
