vael-ui v0.5.7

Navigation & menus

Layout

Stepper

A sequence of steps that shows progress and lets people move between them. Use it for checkouts, sign-up flows and setup wizards.

Install

import { Stepper } from 'vael-ui'

Playground

Usage
<script setup lang="ts">
import { ref } from 'vue'
import { Stepper } from 'vael-ui'

const items = [
  { label: 'Apple', value: 'apple' },
  { label: 'Banana', value: 'banana' },
  { label: 'Cherry', value: 'cherry' },
]
const value = ref(0)
</script>

<template>
  <Stepper :items="items" v-model="value" />
</template>

Props

NameTypeDefaultDescription
itemsRequiredreadonly T[]Steps to show, each with a label and optional description and disabled.
orientation'horizontal' | 'vertical''horizontal'Lays the steps out in a row or a column.
linearbooleantrueBlocks clicks on steps you haven't reached yet, so you can't skip ahead. Every step up to the furthest one reached stays clickable, even after stepping back.
clickablebooleantruefalse renders a display-only progress indicator with no click handling.
motionStepperMotiontrueHow it moves: its parts' appearance, step by step ({ initial: { step: { opacity: 0, y: 4 } }, stagger: 0.06 }), over root, step, circle, connector and content. The built-in transitions are the check swap, circle colors and connector fill; false makes them instant.
uiPartial<Record<'root' | 'step' | 'trigger' | 'circle' | 'content' | 'label' | 'description' | 'connector', UiPartValue>>Class and style overrides for each part.
modelValuenumber0Index of the active step.

Events

NameTypeDescription
change(index: number, item: T)Fires when you click a step and it becomes active.
update:modelValue(value: number)Fires when modelValue changes (v-model).

Slots

NameTypeDescription
item{ item: T; index: number; active: boolean; completed: boolean; disabled: boolean; }Custom label content for each step, replacing the default label and description.
indicator{ item: T; index: number; state: "active" | "completed" | "upcoming"; active: boolean; completed: boolean; disabled: boolean; }Replaces the content inside each step's circle (the number or check mark). The circle itself stays, so its size, border and focus ring still apply; restyle it via ui.circle.

Exposed

NameTypeDescription
elHTMLElement | nullRoot element.
circleElsHTMLElement[]Step circle elements, in order.
connectorElsHTMLElement[]Connector elements, one fewer than steps. Set --ui-stepper-fill (0 to 1) to drive a fill.
labelElsHTMLElement[]Step label elements, in order. Empty when the item slot replaces them.
partsRecord<string, HTMLElement | HTMLElement[] | null>Its elements by part name, for your own animation; a repeated part is an array.

Motion New

Stepper: its parts' appearance and their states, step by step. Each step, circle and line plays its own: current, completed or upcoming (a line is completed once it's filled).

<Stepper
  :motion="{ states: { current: { root: { scale: 1.04 } } } }"
/>
NameTypeDescription
initialexitrootstepcircleconnectorcontentSets where each part comes in from and leaves to: any CSS property, plus x, y and blur. A plain number is px, or degrees for rotate.
statescurrentcompletedupcomingdisabledhoverfocusSets values per part that hold while a state is on. An array is a set of keyframes that plays once as the state turns on, such as a shake on invalid.
enterleave(parts, context) => animationAnimates the parts with GSAP, motion or element.animate(). Return the animation and the component waits for it, and stops it if interrupted.
springdurationeasing{ damping, response } | number | stringTimes all of it: a spring, or a duration in ms with an easing. Never both.
falsebooleanTurns its motion off, for an animation of your own on its exposed elements.

Accessibility

KeyAction
TabShiftTabMoves focus between the steps you can go to.
EnterSpaceGoes to the focused step.
  • Renders an <ol>; the current step has aria-current="step", and completed steps read “Completed” after their label. Connector lines are aria-hidden.
  • Steps are native buttons. With linear, steps you haven’t reached are disabled and can’t take focus.
  • clickable: false renders plain elements; if the row overflows, the list becomes a Tab stop so you can scroll it.