Stepper
VStepper shows the steps of a process and where the reader stands. Render the content of each step yourself from the same v-model.
Usage
- Shipping
- Payment
- Review
The account form goes here.
Examples
States
Steps before the current one are completed and those after it upcoming. completed overrides this for a step, error wins over every state and disabled takes a step out of reach.
- ShippingCompleted
Non-linear
By default only the steps already reached are buttons. nonLinear makes every step one; set completed on the steps that are done.
Text under the circles
textPosition="bottom" centres the title and description under each circle. The steps then share the width equally.
- Check duplicatesMerge or skip
- Done
Vertical
orientation="vertical" lays the steps down a column, for a sidebar. Below 36rem, a horizontal stepper keeps only the title of the current step on screen, and hideText keeps only the circles.
- Check duplicatesMerge or skip
- Done
API
Props
| Prop | Type | Default |
|---|---|---|
steps | StepperStep[] | none |
Steps in order: value, title, and optional description, icon, error, completed and disabled. | ||
orientation | StepperOrientation'horizontal' | 'vertical' | 'horizontal' |
| Layout direction. | ||
nonLinear | boolean | false |
| Makes every step that is not disabled a button. By default, only the steps already reached are. | ||
textPosition | StepperTextPosition'end' | 'bottom' | 'end' |
| Where the title and description sit: beside the circle, or centred under it. Horizontal stepper only. | ||
hideText | boolean | false |
| Keeps only the circles on screen. Titles and descriptions stay readable by assistive technology. | ||
label | string | none |
| Accessible name of the list of steps. Defaults to the library dictionary. | ||
v-model | ItemValue | none |
| Value of the current step. The first step is current when it is unset. | ||
Slots
| Slot | Type |
|---|---|
indicator | StepperIndicatorSlotProps |
Content of the circle of a step. Receives step, index and state. | |
Types
Types used in the API tables. Import exported types from vectis-ui.
export interface BuiltinIcon {
name: string
paths: readonly [string] | readonly [string, string]
}export type IconRender =
| { path: string; viewBox?: string }
| { component: Component; props?: Record<string, unknown> }
| { src: string }
| { text: string; class?: string }
| { class: string }export type IconSource = string | BuiltinIcon | IconRender
export type ItemValue = string | number
export interface StepperIndicatorSlotProps {
step: StepperStep
index: number
state: StepperStepState
}export interface StepperStep {
value: ItemValue
title: string
description?: string
icon?: IconSource
error?: boolean
completed?: boolean
disabled?: boolean
}export type StepperStepState = 'completed' | 'active' | 'error' | 'upcoming'
CSS variables
| Token | Value |
|---|---|
--vectis-control-size-stepper-indicator | 2rem |
--vectis-control-size-stepper-connector-min | 1.5rem |