GhostStepper reference
Package: @ghostvue/themes. Status: experimental (stability policy).
Themed step indicator around @ghostvue/vue GhostStepper: indicator circles in the success, primary and danger tones, connector lines, a focus ring, and labels that collapse to indicators in narrow containers while every trigger keeps its full accessible name. Adds size styling via data-size; behavior, slots and accessibility come from the headless component.
Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
size | 'sm' | 'md' | 'lg' | "md" | No | Trigger min height, label size and indicator size from control.size tokens. Default omits data-size. |
Emits
None declared.
Models
| Prop | Event | Type | Description |
|---|---|---|---|
modelValue | update:modelValue | GhostStepperValue<TStep> | v-model binding for the current step value. |
Slots
| Name | Description |
|---|---|
indicator | Forwarded indicator slot. |
label | Forwarded label slot. |
description | Forwarded description slot. |
separator | Forwarded separator slot. |
Slot props: indicator
None declared.
Slot props: label
None declared.
Slot props: description
None declared.
Slot props: separator
None declared.
Exposed members
| Name | Type | Description |
|---|---|---|
element | HTMLElement | null | Root of the inner headless component. |
focus | (options?: FocusOptions) => void | Delegate focus to the inner stepper. |
blur | () => void | Blur the inner stepper. |
Parts and data attributes
| Attribute | Value | Description |
|---|---|---|
data-part | root | Themed root (headless ghost-stepper). A horizontal stepper is an inline-size query container named ghost-stepper. |
CSS variables
None declared.
Accessibility
Role: navigation. APG pattern: https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/.
Required ARIA attributes: none.
Keyboard
None declared.
Verification
Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.
| Category | Status | Evidence |
|---|---|---|
| Automated keyboard | Not reviewed | No declared key is mapped to a browser test yet. |
| Manual interaction | Not reviewed | No review recorded. |
| Assistive technology | Not reviewed | No review recorded. |
Examples
stepper/booking-wizard
Five-step hotel booking on one useGhostForm: each step validates before moving forward, completed steps stay reachable, and a server error marks the Contact step.
<script setup lang="ts">
import { computed, nextTick, ref, shallowReactive, useTemplateRef } from 'vue'
import { useGhostForm, type StandardSchemaV1 } from '@ghostvue/vue'
import {
GhostButton,
GhostCard,
GhostDatePicker,
GhostDatePickerContent,
GhostDatePickerInput,
GhostDatePickerTrigger,
GhostField,
GhostFieldControl,
GhostFieldError,
GhostFieldLabel,
GhostInput,
GhostNumberInput,
GhostRadioGroup,
GhostRadioGroupItem,
GhostStepper,
type CalendarDate,
} from '@ghostvue/themes'
interface Booking {
checkIn: CalendarDate | null
checkOut: CalendarDate | null
adults: number | null
children: number | null
roomId: string
name: string
email: string
}
const wizard = [
{ value: 'dates', label: 'Dates', fields: ['checkIn', 'checkOut'] },
{ value: 'guests', label: 'Guests', fields: ['adults', 'children'] },
{ value: 'room', label: 'Room', fields: ['roomId'] },
{ value: 'contact', label: 'Contact', fields: ['name', 'email'] },
{ value: 'review', label: 'Review', fields: [] },
] as const
type StepValue = (typeof wizard)[number]['value']
const rooms = [
{ id: 'standard', name: 'Standard queen', price: 129 },
{ id: 'deluxe', name: 'Deluxe king', price: 179 },
{ id: 'suite', name: 'Garden suite', price: 249 },
] as const
// The demo server already holds a booking for this address.
const REGISTERED_EMAIL = 'taken@example.com'
function issuesFor(data: Booking): StandardSchemaV1.Issue[] {
const issues: StandardSchemaV1.Issue[] = []
const add = (path: keyof Booking, message: string) => {
issues.push({ message, path: [path] })
}
if (!data.checkIn) add('checkIn', 'Choose a check-in date.')
if (!data.checkOut) add('checkOut', 'Choose a check-out date.')
else if (data.checkIn && data.checkOut.compare(data.checkIn) < 1) {
add('checkOut', 'Check out at least one night after check-in.')
}
if (data.adults === null || data.adults < 1 || data.adults > 4) {
add('adults', 'Rooms take 1 to 4 adults.')
}
if (data.children === null || data.children < 0 || data.children > 3) {
add('children', 'Rooms take up to 3 children.')
}
if (!data.roomId) add('roomId', 'Choose a room.')
if (!data.name.trim()) add('name', 'Enter the name for the booking.')
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(data.email.trim())) {
add('email', 'Enter an email address for the confirmation.')
}
return issues
}
// Async, like a schema that checks availability: every pass takes a moment,
// so a newer pass can supersede an older one while the user types.
const schema: StandardSchemaV1<Booking, Booking> = {
'~standard': {
version: 1,
vendor: 'example',
async validate(raw) {
const data = raw as Booking
await new Promise((resolve) => setTimeout(resolve, 150))
const issues = issuesFor(data)
return issues.length > 0 ? { issues } : { value: { ...data } }
},
},
}
// Shallow, so the dates stay plain `CalendarDate` objects rather than proxies.
const values = shallowReactive<Booking>({
checkIn: null,
checkOut: null,
adults: 2,
children: 0,
roomId: '',
name: '',
email: '',
})
const current = ref<StepValue>('dates')
const completed = ref(new Set<StepValue>())
const confirmation = ref('')
const heading = useTemplateRef<HTMLHeadingElement>('heading')
const form = useGhostForm({
schema,
values,
async onSubmit({ output, setFieldErrors }) {
await new Promise((resolve) => setTimeout(resolve, 150))
if (output.email.trim().toLowerCase() === REGISTERED_EMAIL) {
// A server error on a step the user already finished: the step turns
// invalid, stays complete and navigable, and the app moves there
// directly (a programmatic move, so no validation runs).
setFieldErrors('email', [
'This email already has a booking. Use another address.',
])
current.value = 'contact'
await nextTick()
emailInput()?.focus()
return
}
const room = rooms.find((option) => option.id === output.roomId)
confirmation.value = `Booked the ${room?.name ?? 'room'} from ${formatDate(output.checkIn)} to ${formatDate(output.checkOut)}. Confirmation sent to ${output.email}.`
},
onInvalid() {
// Mount the first step with an error before the form focuses its control.
const first = wizard.find((step) => isStepInvalid(step.fields))
if (first) current.value = first.value
},
})
function isStepInvalid(fields: readonly (keyof Booking)[]): boolean {
return fields.some((path) => form.isFieldInvalid(path))
}
const steps = computed(() =>
wizard.map((step) => ({
...step,
completed: completed.value.has(step.value),
invalid: isStepInvalid(step.fields),
})),
)
const indexOf = (value: StepValue) =>
wizard.findIndex((step) => step.value === value)
const currentStep = computed(() => wizard[indexOf(current.value)] ?? wizard[0])
const previousValue = computed(() => wizard[indexOf(current.value) - 1]?.value)
const nextValue = computed(() => wizard[indexOf(current.value) + 1]?.value)
function emailInput(): HTMLInputElement | null {
return (
form.element.value?.querySelector<HTMLInputElement>(
'input[name="email"]',
) ?? null
)
}
let request = 0
/**
* The one move function for the stepper, Next and Back. Moving forward
* validates the step being left one field at a time, then decides from the
* form's committed state: a pass superseded by an edit resolves to no
* issues, so the return values alone could let an invalid step through.
*/
async function goTo(target: StepValue): Promise<void> {
const id = ++request
const from = wizard[indexOf(current.value)]
if (from && indexOf(target) > indexOf(current.value)) {
for (const path of from.fields) await form.validateField(path)
if (id !== request) return // a newer move superseded this one
if (form.isPending.value) return
if (isStepInvalid(from.fields)) return
completed.value = new Set(completed.value).add(from.value)
}
current.value = target
confirmation.value = ''
await nextTick()
heading.value?.focus()
}
function formatDate(date: CalendarDate | null): string {
return date?.toString() ?? '—'
}
function selectedRoomName(): string {
return rooms.find((room) => room.id === values.roomId)?.name ?? '—'
}
</script>
<template>
<div class="booking">
<GhostStepper
:steps="steps"
:model-value="current"
aria-label="Booking steps"
@update:model-value="goTo"
/>
<form class="booking__form" v-bind="form.formProps.value">
<GhostCard as="section" aria-labelledby="booking-step-heading">
<template #header>
<h2
id="booking-step-heading"
ref="heading"
class="booking__heading"
tabindex="-1"
>
{{ currentStep.label }}
</h2>
</template>
<div v-if="current === 'dates'" class="booking__fields">
<GhostField name="checkIn" required>
<GhostFieldLabel>Check-in</GhostFieldLabel>
<GhostDatePicker v-model="values.checkIn">
<div class="booking__date">
<GhostFieldControl v-slot="field">
<GhostDatePickerInput v-bind="field" />
</GhostFieldControl>
<GhostDatePickerTrigger aria-label="Choose check-in date" />
</div>
<GhostDatePickerContent />
</GhostDatePicker>
<GhostFieldError />
</GhostField>
<GhostField name="checkOut" required>
<GhostFieldLabel>Check-out</GhostFieldLabel>
<GhostDatePicker v-model="values.checkOut">
<div class="booking__date">
<GhostFieldControl v-slot="field">
<GhostDatePickerInput v-bind="field" />
</GhostFieldControl>
<GhostDatePickerTrigger aria-label="Choose check-out date" />
</div>
<GhostDatePickerContent />
</GhostDatePicker>
<GhostFieldError />
</GhostField>
</div>
<div v-else-if="current === 'guests'" class="booking__fields">
<GhostField name="adults" required>
<GhostFieldLabel>Adults</GhostFieldLabel>
<GhostFieldControl v-slot="field">
<GhostNumberInput
v-bind="field"
v-model="values.adults"
:min="1"
:max="4"
name="adults"
block
/>
</GhostFieldControl>
<GhostFieldError />
</GhostField>
<GhostField name="children">
<GhostFieldLabel>Children</GhostFieldLabel>
<GhostFieldControl v-slot="field">
<GhostNumberInput
v-bind="field"
v-model="values.children"
:min="0"
:max="3"
name="children"
block
/>
</GhostFieldControl>
<GhostFieldError />
</GhostField>
</div>
<div v-else-if="current === 'room'" class="booking__fields">
<GhostField name="roomId" required>
<GhostFieldLabel>Room</GhostFieldLabel>
<GhostFieldControl v-slot="field">
<GhostRadioGroup
v-bind="field"
v-model="values.roomId"
name="roomId"
>
<label
v-for="room in rooms"
:key="room.id"
class="booking__room"
>
<GhostRadioGroupItem :value="room.id" />
{{ room.name }}, ${{ room.price }} a night
</label>
</GhostRadioGroup>
</GhostFieldControl>
<GhostFieldError />
</GhostField>
</div>
<div v-else-if="current === 'contact'" class="booking__fields">
<GhostField name="name" required>
<GhostFieldLabel>Name</GhostFieldLabel>
<GhostFieldControl v-slot="field">
<GhostInput
v-bind="field"
v-model="values.name"
name="name"
autocomplete="name"
block
/>
</GhostFieldControl>
<GhostFieldError />
</GhostField>
<GhostField name="email" required>
<GhostFieldLabel>Email</GhostFieldLabel>
<GhostFieldControl v-slot="field">
<GhostInput
v-bind="field"
v-model="values.email"
type="email"
name="email"
autocomplete="email"
block
/>
</GhostFieldControl>
<GhostFieldError />
</GhostField>
</div>
<div v-else class="booking__fields">
<dl class="booking__summary">
<dt>Dates</dt>
<dd>
{{ formatDate(values.checkIn) }} to
{{ formatDate(values.checkOut) }}
</dd>
<dt>Guests</dt>
<dd>{{ values.adults }} adults, {{ values.children }} children</dd>
<dt>Room</dt>
<dd>{{ selectedRoomName() }}</dd>
<dt>Contact</dt>
<dd>{{ values.name }}, {{ values.email }}</dd>
</dl>
<p class="booking__hint">
This demo server already has a booking for
{{ REGISTERED_EMAIL }}. Use it to see a server error.
</p>
</div>
<template #footer>
<div class="booking__actions">
<p class="booking__status" role="status">{{ confirmation }}</p>
<GhostButton
v-if="previousValue"
variant="ghost"
tone="neutral"
@click="goTo(previousValue)"
>
Back
</GhostButton>
<GhostButton v-if="nextValue" @click="goTo(nextValue)">
Next
</GhostButton>
<GhostButton
v-else
type="submit"
:loading="form.isSubmitting.value"
>
Confirm booking
</GhostButton>
</div>
</template>
</GhostCard>
</form>
</div>
</template>
<style scoped>
.booking {
display: grid;
gap: var(--ghost-space-stack-md);
max-inline-size: 40rem;
}
.booking__heading {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-lg);
font-weight: var(--ghost-type-weight-semibold);
margin: 0;
}
.booking__fields {
display: grid;
gap: var(--ghost-space-stack-md);
}
.booking__date {
align-items: center;
display: flex;
gap: var(--ghost-space-gap-xs);
}
.booking__room {
align-items: center;
display: flex;
gap: var(--ghost-space-gap-sm);
}
.booking__summary {
display: grid;
gap: var(--ghost-space-gap-xs) var(--ghost-space-gap-md);
grid-template-columns: max-content 1fr;
margin: 0;
}
.booking__summary dt {
color: var(--ghost-text-muted);
}
.booking__summary dd {
margin: 0;
overflow-wrap: anywhere;
}
.booking__actions {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm);
justify-content: flex-end;
}
.booking__hint {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
margin: 0;
}
.booking__status {
color: var(--ghost-text-muted);
flex: 1 1 12rem;
font-size: var(--ghost-type-size-sm);
margin: 0;
}
</style>
stepper/basic
Controlled three-step account setup where the stepper, Next and Back all call one goTo function.
Account: step 1 of 3
<script setup lang="ts">
import { computed, ref } from 'vue'
import { GhostButton, GhostStepper } from '@ghostvue/themes'
const setup = [
{ value: 'account', label: 'Account' },
{ value: 'workspace', label: 'Workspace' },
{ value: 'invite', label: 'Invite team' },
] as const
type StepValue = (typeof setup)[number]['value']
const current = ref<StepValue>('account')
const completed = ref(new Set<StepValue>())
const steps = computed(() =>
setup.map((step) => ({
...step,
completed: completed.value.has(step.value),
})),
)
const index = computed(() =>
setup.findIndex((step) => step.value === current.value),
)
/** The stepper, Next and Back all move through this one function. */
function goTo(target: StepValue): void {
const targetIndex = setup.findIndex((step) => step.value === target)
if (targetIndex > index.value) {
completed.value = new Set(completed.value).add(current.value)
}
current.value = target
}
function next(): void {
const step = setup[index.value + 1]
if (step) goTo(step.value)
}
function back(): void {
const step = setup[index.value - 1]
if (step) goTo(step.value)
}
</script>
<template>
<div class="setup">
<GhostStepper
:steps="steps"
:model-value="current"
aria-label="Setup steps"
@update:model-value="goTo"
/>
<p class="setup__panel">
{{ setup[index]?.label }}: step {{ index + 1 }} of {{ setup.length }}
</p>
<div class="setup__actions">
<GhostButton
variant="ghost"
tone="neutral"
:disabled="index === 0"
@click="back"
>
Back
</GhostButton>
<GhostButton :disabled="index === setup.length - 1" @click="next">
Next
</GhostButton>
</div>
</div>
</template>
<style scoped>
.setup {
display: grid;
gap: var(--ghost-space-stack-md);
max-inline-size: 32rem;
}
.setup__panel {
color: var(--ghost-text-default);
margin: 0;
}
.setup__actions {
display: flex;
gap: var(--ghost-space-gap-sm);
justify-content: flex-end;
}
</style>
stepper/vertical
Vertical onboarding checklist with a description under each step and free navigation.
Open task: calendar
<script setup lang="ts">
import { ref } from 'vue'
import { GhostStepper } from '@ghostvue/themes'
const steps = [
{
value: 'profile',
label: 'Complete your profile',
description: 'Add a photo and a display name.',
completed: true,
},
{
value: 'calendar',
label: 'Connect a calendar',
description: 'Sync availability from Google or Outlook.',
},
{
value: 'hours',
label: 'Set working hours',
description: 'Teammates only book you inside these hours.',
},
{
value: 'billing',
label: 'Add billing details',
description: 'Only workspace owners can change billing.',
disabled: true,
},
]
const current = ref('calendar')
</script>
<template>
<div class="onboarding">
<GhostStepper
v-model="current"
:steps="steps"
navigation="free"
orientation="vertical"
aria-label="Onboarding checklist"
/>
<p class="onboarding__status">Open task: {{ current }}</p>
</div>
</template>
<style scoped>
.onboarding {
display: grid;
gap: var(--ghost-space-stack-md);
max-inline-size: 28rem;
}
.onboarding__status {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
margin: 0;
}
</style>
stepper/status-only
Checkout progress header with navigation set to none: the steps are announced but nothing is interactive.
Checkout
- ✓Step 1 of 4, Cart, Completed
- ✓Step 2 of 4, Shipping, Completed
- 3Step 3 of 4, Payment
- 4Step 4 of 4, Confirm
<script setup lang="ts">
import { GhostStepper } from '@ghostvue/themes'
const steps = [
{ value: 'cart', label: 'Cart', completed: true },
{ value: 'shipping', label: 'Shipping', completed: true },
{ value: 'payment', label: 'Payment' },
{ value: 'confirm', label: 'Confirm' },
]
</script>
<template>
<header class="checkout">
<p class="checkout__title">Checkout</p>
<GhostStepper
:steps="steps"
model-value="payment"
navigation="none"
size="sm"
aria-label="Checkout progress"
/>
</header>
</template>
<style scoped>
.checkout {
display: grid;
gap: var(--ghost-space-gap-sm);
max-inline-size: 36rem;
}
.checkout__title {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-lg);
font-weight: var(--ghost-type-weight-semibold);
margin: 0;
}
</style>