Reka UI logoReka
backdrop
Components

Stepper

Alpha
A set of steps that are used to indicate progress through a multi-step process.

Address

Shipping

Checkout

Step 2 of 0

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.

sh
$ npm add reka-ui

Anatomy

Import all parts and piece them together.

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

Data AttributeValue
[data-orientation]"vertical" | "horizontal"
[data-linear]Present when linear

Item

The step item component.

Data AttributeValue
[data-state]"active" | "inactive" | "completed"
[data-disabled]Present when disabled
[data-orientation]"vertical" | "horizontal"

Trigger

The trigger that toggles the step.

Data AttributeValue
[data-state]"active" | "inactive" | "completed"
[data-disabled]Present when disabled
[data-orientation]"vertical" | "horizontal"

Indicator

The indicator for the step.

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

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.

Examples

Vertical

You can create vertical steps by using the orientation prop.

vue
<script setup>
import { StepperDescription, StepperIndicator, StepperItem, StepperRoot, StepperTitle } from 'reka-ui'
</script>

<template>
  <StepperRoot
    :default-value="1"
    orientation="vertical"
  >
    <StepperItem>
      <StepperIndicator />
      <StepperTitle />
      <StepperDescription />
    </StepperItem>
    <StepperItem>
      <StepperIndicator />
      <StepperTitle />
      <StepperDescription />
    </StepperItem>
  </StepperRoot>
</template>

With controls

You can add additional controls for the stepper using buttons and access the typed component instance using useTemplateRef.

vue
<script setup lang="ts">
const stepper = useTemplateRef('stepper')
</script>

<template>
  <StepperRoot
    ref="stepper"
    :default-value="1"
  >
    <StepperItem>
      <StepperIndicator />
      <StepperTitle />
      <StepperDescription />
    </StepperItem>
    <StepperItem>
      <StepperIndicator />
      <StepperTitle />
      <StepperDescription />
    </StepperItem>
  </StepperRoot>

  <div class="flex gap-2 justify-between mt-4">
    <button
      :disabled="!stepper?.hasPrev()"
      @click="stepper?.prevStep()"
    >
      Prev
    </button>

    <button
      :disabled="!stepper?.hasNext()"
      @click="stepper?.nextStep()"
    >
      Next
    </button>
  </div>
</template>

Accessibility

Keyboard Interactions

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