Skip to content

GhostStepper specification ​

Important

Status: Approved on 2026-12-01 by zprue743 for 0.4.0 (recorded in PR #707). This is the contract the build implements. The build's manifests are listed in the frontmatter, and the usage page documents the shipped API.

Purpose and user problems ​

GhostStepper is a step indicator for multi-step tasks such as a booking wizard, onboarding or checkout. It shows every step in order, says which step is current, which steps are complete, which are still to do and which hold errors, and lets the user move between the steps they are allowed to reach. A screen reader user hears "Step 3 of 5, Guests, current step" instead of a tab.

Today, apps bend GhostTabs into this role: activation-mode="manual", disabled future tabs, an error GhostBadge inside a tab and a GhostProgress above the list. That works, but:

  • Tabs announce as tabs ("tab, selected, 3 of 5"), which promises a set of peer views, not an ordered task with a current position.
  • Arrow keys move between tabs, but a wizard's steps are not peers: the user cannot freely arrow into a step they have not reached.
  • Completed, current, upcoming and invalid states, and the rule for which steps can be reached, are hand-made in every app.
  • Tabs pair each trigger with a tabpanel, so a wizard that renders one form outside the tab panels breaks the tab relationship.

The stepper owns the step list, its states, the reachability rule, step numbering and the accessible text. The app owns the step content, validation and what "complete" means.

Non-goals ​

  • Step panels. The stepper does not render, hide or label step content. Apps render the current step with v-if (see the booking-wizard walkthrough). A content part would duplicate GhostTabs and force a panel structure on apps that render a single form.
  • Validation. The stepper does not validate, block or cancel moves itself. An app that must validate before leaving a step intercepts the controlled v-model (see Async behavior).
  • A dependency on GhostForm. The stepper reads plain step objects. The link to GhostForm is a documented recipe, not an import.
  • Next, Back and Submit buttons. These are ordinary app buttons; the step order is the app's own array.
  • Routing. Syncing the current step with the URL is app-owned.
  • A progress bar. "Step 3 of 5" is announced per step. Apps that also want a bar compose GhostProgress.
  • Branching or nested steps, and step reordering. The step list is flat and in the order given.
  • Changes to GhostTabs or GhostForm.

Public API ​

Shape ​

GhostStepper is a single data-driven component, like GhostPagination, with slots for the parts apps restyle. It takes an ordered steps array. The design decision records why this beats compound parts.

Exports ​

Headless exports from @ghostvue/vue:

  • GhostStepper (generic over the step type)
  • useGhostStepper (the resolved step model, for custom markup)
  • Types: GhostStepperStep, GhostStepperValue, GhostStepperStepState, GhostStepperNavigation, GhostStepperOrientation, GhostStepperStepContext, GhostStepperProps, GhostStepperEmits, GhostStepperSlots, GhostStepperExposed, UseGhostStepperOptions, UseGhostStepperReturn

Themed exports from @ghostvue/themes:

  • GhostStepper, with the same behavior props, the themed size prop and the GhostStepperSize type, styled by ghost-stepper.css in default.css.

Types (exact contracts) ​

ts
/** One step. Extra fields on `TStep` are passed through to slots untouched. */
export interface GhostStepperStep {
  /** Stable, unique, non-empty id. Used for `v-model` and identity. */
  readonly value: string
  /** Visible step name. Part of the trigger's accessible name. */
  readonly label: string
  /** Optional supporting text, linked to the trigger by `aria-describedby`. */
  readonly description?: string
  /** The app considers this step done. Default `false`. */
  readonly completed?: boolean
  /** This step holds errors. Independent of `completed`. Default `false`. */
  readonly invalid?: boolean
  /** The stepper never lets the user move to this step. Default `false`. */
  readonly disabled?: boolean
}

/** Position of a step relative to the current one and its completion. */
export type GhostStepperStepState = 'complete' | 'current' | 'incomplete'

/** Which steps the stepper's own triggers can move to. */
export type GhostStepperNavigation = 'linear' | 'free' | 'none'

export type GhostStepperOrientation = 'horizontal' | 'vertical'

/** Slot props and `useGhostStepper` entries for one step. */
export interface GhostStepperStepContext<TStep extends GhostStepperStep> {
  readonly step: TStep
  /** 0-based index in `steps`. */
  readonly index: number
  /** 1-based position, as announced ("Step {position} of {count}"). */
  readonly position: number
  readonly count: number
  readonly state: GhostStepperStepState
  readonly current: boolean
  readonly completed: boolean
  readonly invalid: boolean
  /** `step.disabled` or the root `disabled` prop. */
  readonly disabled: boolean
  /** The step's trigger can move the user to this step right now. */
  readonly navigable: boolean
}

/** The value type `v-model` carries: the `value` field of the consumer's step type. */
export type GhostStepperValue<TStep extends GhostStepperStep> = TStep['value']

modelValue, defaultValue, the update:modelValue payload and select all use GhostStepperValue<TStep>, so a wizard whose steps are declared as const can bind a literal union (ref<'dates' | 'guests' | …>) with v-model and no cast. With plain GhostStepperStep objects it is string.

Props and configuration ​

GhostStepper (headless and themed) ​

PropTypeDefaultContract
stepsreadonly TStep[]requiredOrdered steps. value must be unique and non-empty. Read, never mutated.
modelValueGhostStepperValue<TStep> | undefinedomittedControlled current step value. Omit for uncontrolled mode.
defaultValueGhostStepperValue<TStep> | undefinedfirst step's valueInitial current step when modelValue is omitted. Read once at setup. When omitted, see uncontrolled.
navigationGhostStepperNavigation'linear'linear: reachable steps follow the linear rule. free: every enabled step is reachable. none: status only; no step is interactive.
orientationGhostStepperOrientation'horizontal'Layout only. Sets data-orientation. Does not change keyboard behavior.
disabledbooleanfalseNo trigger is navigable. States and the current step stay visible and announced. For a stepper unavailable for the whole task, not for a pending move.
ariaLabelstring'Steps'Accessible name of the root landmark (or of the list when navigation is none).
getPositionLabel(position: number, count: number) => string`Step ${p} of ${c}`Visually hidden text that starts each trigger's accessible name. Return text without trailing punctuation; the stepper adds the separator.
completeLabelstring'Completed'Visually hidden status text after the label for a complete, valid step that is not current.
invalidLabelstring'Has errors'Visually hidden status text after the label for any invalid step, including the current one. Takes precedence over completeLabel.

Themed GhostStepper only:

PropTypeDefaultContract
size'sm' | 'md' | 'lg''md'Trigger min height, label size and indicator size from control.size.<size> tokens. Renders data-size for sm and lg; omitted for md.

Native attributes and listeners fall through to the root element. Do not pass aria-* as camelCase props; ariaLabel is the one named prop, as on GhostPagination and GhostBreadcrumb.

v-model contracts ​

v-model binds modelValue / update:modelValue with the current step's value. useControllableState is the write path, as on GhostTabs:

  • Uncontrolled. Omitted modelValue. Local state starts at defaultValue and changes immediately when the user activates a navigable trigger. With no defaultValue, and until the first activation, the current step is the first step of the current steps array, resolved on every render rather than captured at setup. A stepper whose steps arrive after setup ([] first, then fetched) therefore shows step 1 as current once they arrive, with no warning in between.
  • Uncontrolled mode is for steppers whose own triggers are the only navigation. It has no programmatic move: select respects reachability and the exposed API has no goTo. A wizard with Next and Back buttons, validation before a move, or a jump to a server-error step must be controlled.
  • Controlled. A defined modelValue. Activation emits update:modelValue with the target value and does not change local state. The current step changes only when the parent applies the value. A parent that does not apply it (for example, because validation failed) leaves the stepper unchanged.
  • Emits only on user activation. Changing modelValue, steps or any step flag from the parent never emits.
  • Activating the current step does nothing and emits nothing.
  • Unmatched value. When the effective value matches no step (an unknown modelValue, or the current step was removed from steps), no step is current, no trigger has aria-current, and the stepper does not emit to repair it. A development warning names the value. The reachability rule treats the current index as -1.
  • Programmatic moves are never restricted. Reachability governs only the stepper's own triggers. The app may set modelValue to any step, including a disabled one, for example to jump to the step that holds a server error.

Events, callbacks, slots, and exposed methods ​

Events:

EventPayloadTiming
update:modelValue[value: GhostStepperValue<TStep>]Synchronously on activation of a navigable trigger whose step is not current. Never on mount.

Slots. Each receives GhostStepperStepContext<TStep>:

SlotDefault contentNotes
indicatorposition as text; ✓ when completed and not invalid and not current; ! when invalidRendered inside the trigger in an aria-hidden="true" part. Decoration only; state is announced by the status text and aria-current.
labelstep.labelVisible label inside the trigger. Must render text, because it is part of the trigger's accessible name.
descriptionstep.description; the part is not rendered when both the slot and the field are emptyOutside the trigger, referenced by aria-describedby.
separatoremptyRendered after every item except the last, inside the item, aria-hidden="true". The theme draws the connector line on this part.

Exposed instance API (GhostStepperExposed):

  • element: HTMLElement | null, the root element.
  • focus(options?: FocusOptions): void focuses the current step's trigger when it is enabled, otherwise the first enabled trigger. Does nothing when no trigger is enabled, including navigation="none".
  • blur(): void

useGhostStepper ​

For custom markup, useGhostStepper(options) returns the resolved model that GhostStepper renders from. It is the escape hatch when the app needs its own element structure; the accessibility contract below is then the app's job, and the docs page states which attributes to copy.

ts
export interface UseGhostStepperOptions<TStep extends GhostStepperStep> {
  readonly steps: MaybeRefOrGetter<readonly TStep[]>
  readonly modelValue: MaybeRefOrGetter<GhostStepperValue<TStep> | undefined>
  readonly defaultValue?: GhostStepperValue<TStep>
  readonly navigation?: MaybeRefOrGetter<GhostStepperNavigation | undefined>
  readonly disabled?: MaybeRefOrGetter<boolean | undefined>
  readonly onUpdateModelValue?: (value: GhostStepperValue<TStep>) => void
}

export interface UseGhostStepperReturn<TStep extends GhostStepperStep> {
  /** Effective current value, or `undefined` when unmatched. */
  readonly currentValue: ComputedRef<GhostStepperValue<TStep> | undefined>
  /** Index of the current step, or `-1`. */
  readonly currentIndex: ComputedRef<number>
  readonly items: ComputedRef<readonly GhostStepperStepContext<TStep>[]>
  /** Moves to `value` when its step is navigable and not current. Returns whether it did. */
  readonly select: (value: GhostStepperValue<TStep>) => boolean
}

select follows the same rules as activating a trigger: it emits or updates local state only for a navigable, non-current step. It is not a way around reachability; programmatic moves go through modelValue.

State model ​

Step state ​

Each step resolves to exactly one state:

  1. current: its value is the effective current value.
  2. complete: not current and completed is true.
  3. incomplete: everything else. This covers upcoming steps and earlier steps the app has not marked complete.

invalid and disabled are independent flags on top of state. A step can be current and invalid (the user is fixing it), or complete and invalid (a server rejected a value on a step the user already finished).

Reachability ​

A step's trigger is navigable when it is enabled (neither the root nor the step is disabled) and:

  • navigation="free": always.
  • navigation="none": never.
  • navigation="linear": any of these hold, where currentIndex is the current step's index (or -1) and frontier is the index of the first step that is neither completed nor disabled (or steps.length when there is none):
    • its index is at or before currentIndex (go back freely);
    • it is completed (jump to a finished step);
    • its index is frontier (the next step to do, once everything before it is complete).

So on a fresh five-step wizard only step 1 is reachable. After the app marks step 1 complete and moves to step 2, steps 1 and 2 are reachable. If the user goes back to step 1, step 2 stays reachable as the frontier. An incomplete step blocks the steps after it, but a disabled step (for example, an optional step that does not apply) does not block the frontier.

invalid does not affect reachability: the user must be able to reach the step that holds the error.

Loading, empty, disabled, read-only, and error states ​

  • Empty steps. Renders the root and an empty list, and a development warning. No emits.
  • One step. Renders one item with "Step 1 of 1" and no separator.
  • Disabled root. Every trigger renders native disabled; states, the status text and aria-current stay. data-disabled on the root.
  • Disabled step. That trigger renders native disabled even when it is the current step.
  • Read-only / status only. navigation="none". See Semantics.
  • Error. invalid on a step. Rendered as data-invalid, the ! indicator and the invalidLabel status text.
  • Duplicate values. Invalid input. A development warning names the value; the first step with that value is used for the current-step match and select.
  • No loading state. Async validation is the app's (see below).

Async behavior ​

The stepper has no async state. It emits synchronously and renders from props. An app that validates before leaving a step uses the controlled v-model:

vue
<GhostStepper
  :steps="steps"
  :model-value="current"
  @update:model-value="goTo"
/>

goTo may await validation and only then set current. Two moves can overlap (the user activates step 4, then step 1 before step 4's validation settles). The stepper does not order them. The documented recipe keeps a request counter and applies only the latest request, the same "latest wins" rule GhostForm uses for validation. While a move is pending, the stepper keeps showing the old current step, which is correct: the user has not left it.

Do not bind the root disabled prop to a pending move. Disabling every trigger natively would drop keyboard focus from the trigger the user just activated to <body> (see Focus behavior). The latest-wins counter already makes repeat activations safe. disabled is for a stepper that is unavailable for the whole task. The pending guard in the recipe lives inside goTo, so it covers the stepper's triggers and the Next button alike.

Consumer data ​

  • steps is read, never mutated, sorted or copied into internal state. The stepper reads only value, label, description, completed, invalid and disabled. Other fields on TStep reach slots unchanged through context.step, with their type preserved.
  • Identity is value. Description ids are derived from the stepper's useGhostId base and the step's index, not from value, so any string is safe as a value.
  • Reactivity. Every resolved value is a computed over steps and the flags. Replacing the array, or changing a field on a reactive step object, updates the stepper. Mutating a plain, non-reactive object does not.
  • Derived flags are the expected shape. Apps usually map their own state into steps in a computed, for example invalid from GhostForm's fieldErrors (see the walkthrough).

Accessibility contract ​

There is no APG stepper pattern. The structure follows the navigation landmark and list conventions used by GhostPagination and GhostBreadcrumb, with aria-current="step" for the current step.

Semantics and relationships ​

With navigation set to linear or free:

html
<nav aria-label="Steps" data-part="root">
  <ol data-part="list">
    <li data-part="item" data-state="complete">
      <button type="button" data-part="trigger" aria-describedby="…">
        <span data-part="indicator" aria-hidden="true">✓</span>
        <span data-part="position">Step 1 of 5, </span>
        <span data-part="label">Dates</span>
        <span data-part="status">, Completed</span>
      </button>
      <span data-part="description" id="…">Check-in and check-out</span>
      <span data-part="separator" aria-hidden="true"></span>
    </li>
    <li data-part="item" data-state="current">
      <button type="button" data-part="trigger" aria-current="step">…</button>
    </li>
    <li data-part="item" data-state="incomplete">
      <button type="button" data-part="trigger" disabled>…</button>
    </li>
  </ol>
</nav>
  • Root. Native nav named by ariaLabel. Apps with more than one stepper or other nav landmarks give each a distinct name ("Booking steps").
  • List. Native ol; each step is an li. The list gives "list, 5 items" on entry.
  • Trigger. Native button type="button" in every step. Its accessible name is, in order: the position text ("Step 1 of 5"), the label, and the status text when there is one. The position and status parts are visually hidden (not display: none), and their text includes the separating ", " so names never run together.
  • Status text. invalidLabel for any invalid step; otherwise completeLabel for a complete step; otherwise none. A current, valid step carries no status text because aria-current="step" announces it. An incomplete step carries none; the disabled state already says whether it can be reached.
  • Current step. aria-current="step" on the current step's trigger only.
  • Unreachable steps. Native disabled. They leave the Tab order but stay in the accessibility tree, so browse mode still reads them ("unavailable" in NVDA, "dimmed" in VoiceOver). The stepper does not use aria-disabled here, unlike GhostPagination's edge buttons, because a locked step has no action to discover and five focusable dead stops would slow keyboard users down.
  • Description. Rendered outside the trigger and referenced by aria-describedby, so it is announced after the name instead of lengthening it.
  • Indicator and separator. aria-hidden="true".

With navigation="none" (a status display, for example a checkout progress header):

  • The root renders a div, not a landmark, and ariaLabel moves to the ol as aria-label.
  • Each trigger part renders a span with no role, carrying the same position, label and status text. aria-current="step" stays on the current step's span.
  • The description is plain list text after the trigger part. aria-describedby is not used in this mode, because nothing focusable would carry it.
  • Nothing is focusable.
  • Support for aria-current on a role-less element is less consistent than on a button, and this mode has no other "current" signal for a valid step. The build records this mode in the manual screen reader checks. If NVDA with Firefox or VoiceOver with Safari does not announce the current step, the build adds a visually hidden current-step status text in this mode only (a currentLabel prop, default 'Current step', placed like the other status text) and keeps aria-current="step" on the span. That fallback is pre-approved by this spec; it adds one prop and changes no other behavior.

Keyboard interaction ​

The stepper is a list of buttons in a landmark, not a composite widget, so it uses the normal Tab order like GhostPagination. There is no roving tabindex and no arrow-key handling. Arrow keys stay with the screen reader's browse mode and the page.

KeyBehavior
Tab / Shift+TabMoves through the enabled triggers in order, then on through the page.
Enter / SpaceActivates the focused trigger (native button). On the current step, no-op.

Disabled triggers are skipped. With navigation="none", no key does anything.

Focus behavior ​

  • Activation keeps focus. After the user activates a trigger, the stepper does not move focus. The app decides whether to move it into the new step. The documented wizard moves focus to the new step's heading (a tabindex="-1" h2) after every move, from the stepper and from Next and Back, so the user hears where they are. This is a recipe, not stepper behavior.
  • Focus repair. If the trigger that has focus becomes disabled or is removed (for example, the app marks a step incomplete and later steps become unreachable), the stepper moves focus, after the DOM update, to the current step's trigger, or the first enabled trigger when that is disabled. When no trigger is enabled, focus is left to the browser. Focus outside the stepper is never moved. Because that last case drops focus, apps must not bind the root disabled prop to a pending move (see Async behavior); focus stays on the activated trigger while the app validates.
  • Visible focus. Every enabled trigger has a visible focus indicator in the themed recipe (--ghost-focus-ring-* tokens).
  • No focus trapping.

Assistive technology expectations ​

Expected output, to be recorded with real screen readers by the build (see Test plan). NVDA with Firefox, tabbing through a five-step booking wizard on step 3 with step 2 holding a server error:

StepStepper (expected)Tabs workaround (today)
Enter the component"Booking steps navigation landmark, list with 5 items""tab control"
1, complete"Step 1 of 5, Dates, Completed, button""Dates, tab, 1 of 5"
2, complete, invalid"Step 2 of 5, Contact, Has errors, button""Contact 1, tab, 2 of 5" (badge text read as part of name)
3, current"Step 3 of 5, Guests, button, current step""Guests, tab, selected, 3 of 5"
4, incomplete (browse)"Step 4 of 5, Room, button, unavailable""Room, tab, unavailable, 4 of 5"

With navigation="none" (status only), reading the list in browse mode, the expected output for the current step is "Step 3 of 5, Guests, current step" and for a complete step "Step 1 of 5, Dates, Completed". The description is read as the next line of the list item.

VoiceOver with Safari is expected to read the same names with "current step" and "dimmed". The stepper uses no live region: a move is announced through focus (the recipe moves focus to the step heading). Apps that keep focus on the trigger after a move can add their own polite announcement.

Rendering and customization ​

Stable hooks, following existing data-part conventions:

  • Classes: ghost-stepper on the root; part classes ghost-stepper-list, ghost-stepper-item, ghost-stepper-trigger, ghost-stepper-indicator, ghost-stepper-label, ghost-stepper-description, ghost-stepper-separator. The visually hidden position and status parts have data-part only.
  • data-ghost-stepper on the root.
  • data-part: root, list, item, trigger, indicator, position, label, status, description, separator.
  • On the root: data-orientation, data-navigation, data-disabled.
  • On each item and its trigger: data-state (complete | current | incomplete), and when true, data-completed, data-invalid, data-disabled, data-navigable. data-completed lets a theme mark a current step that the user finished before going back.
  • Consumer class and style on the root merge with the part class.
  • The headless component ships only the minimum layout so examples render without a theme: the list is a flex row (horizontal) or column (vertical) with no list markers, and the position and status parts use the visually hidden style from GhostVisuallyHidden.

Themed recipe (@ghostvue/themes):

  • Indicator: a circle sized from control.size.<size>; complete uses the status-success tokens, invalid uses the action-danger tokens, current uses action-primary, incomplete uses the neutral border. Invalid wins over complete and current for the indicator color.
  • Separator: a connector line between indicators, horizontal or vertical following data-orientation; complete steps color the connector after them.
  • Trigger: min-block-size from control.size.<size>.min, so coarse pointers get the 44px minimum from the generated tokens. No fixed pixel sizes.
  • Narrow containers: a horizontal stepper uses a container query. Below a width where the labels no longer fit, non-current labels and descriptions are visually hidden (clip, not display: none), so every step keeps its full accessible name and only indicators and the current label show. No horizontal scrolling.
  • Disabled triggers use --ghost-action-disabled-opacity. Contrast of the indicator number and label text in every state meets pnpm contrast.
  • Logical properties throughout, so dir="rtl" mirrors the horizontal layout with no extra code.

Environment behavior ​

SSR and hydration ​

  • All markup comes from props. Position, count, state, reachability and status text are computed from the steps array, so the server renders "Step 3 of 5" and the right disabled and aria-current attributes. This is why the stepper is data-driven (see Design decision).
  • Description ids come from useGhostId and hydrate without mismatch.
  • No window or document access in setup. The focus-repair watcher runs only on the client after mount.
  • defaultValue is read once at setup on both server and client, so an uncontrolled stepper hydrates on the same step. Without defaultValue, the first step of the current steps is current on both sides.

Mobile and touch ​

  • Triggers are native buttons; tap activates. No gestures.
  • Target size comes from control.size tokens (44px under coarse pointers).
  • The narrow-container rule above keeps a five-step horizontal stepper inside a 390px viewport. Apps with long labels can switch to vertical.
  • No virtual keyboard interaction; the stepper has no text input.

Performance ​

Expected scale is 2 to 10 steps. Resolving states and reachability is one O(n) pass in a computed, recomputed only when steps, a step flag, the current value, navigation or disabled changes. No observers, timers or global listeners. No virtualization.

Composition ​

Reused:

  • useControllableState for the current step (same contract as GhostTabs and GhostPagination).
  • useGhostId for description ids.
  • The GhostVisuallyHidden style for the position and status parts.
  • Themed tokens shared with GhostButton, GhostBadge and the 0.4.0 control sizing work.

Deliberately not reused:

  • GhostTabs and useRovingFocus. Tabs semantics and a single Tab stop with arrow keys are the problem this component replaces.
  • GhostProgress. "Step 3 of 5" is in every trigger's name; a separate progressbar would repeat it. Apps that want a bar compose one.
  • GhostForm. See below.

The stepper never imports GhostForm. The link is app-side code, shown in the walkthrough and the stepper/booking-wizard example.

Entry point. The wizard uses the useGhostForm composable, spread onto a native <form> (the documented "custom form hosts" path). A script-level computed cannot read <GhostForm>'s slot props, and its template ref does not expose fieldErrors. Slot props passed into a handler are also a snapshot that goes stale after an await, because the form replaces its error object on each validation pass. useGhostForm returns fieldErrors as a ComputedRef and the live readers isFieldInvalid(path) and getFieldErrors(path), so both the steps computed and the async goTo read current state. An app that prefers <GhostForm> builds steps and goTo in a child component that receives the slot props; the docs show the composable.

  1. Each app step lists its field paths (fields: ['email', 'phone']).
  2. invalid comes from the form's errors: step.fields.some((path) => form.isFieldInvalid(path)). Only revealed errors count, so steps the user has not reached do not show as invalid early.
  3. Before moving forward, the app calls validateField(path) for each of the current step's paths one after another. Calls must not run in parallel: each call starts a whole-schema validation pass, and a newer pass supersedes an older one.
  4. After the last call settles, the app decides from the form's committed state, not from the return values: it moves only when form.isPending.value is false and no path of the step is invalid (!step.fields.some((path) => form.isFieldInvalid(path))). The last pass that was not superseded commits errors for every revealed path of the step, so this catches an earlier call that was superseded by an edit and resolved to [].
  5. The pending guard is inside goTo, which serves both the stepper's update:modelValue and the Next button, together with the latest-wins request counter from Async behavior.

One GhostForm limitation remains: if the final validateField call is itself superseded and the newer pass is still running, step 4 sees isPending and refuses the move, so the user presses Next again. A validateField result that tells "superseded" apart from "valid" would let the recipe wait instead; that is a GhostForm change, out of scope here, and recorded as a follow-up in Open architectural questions.

Booking-wizard walkthrough ​

Five steps: Dates, Guests, Room, Contact, Review. One form, from useGhostForm, holds all of them. The stepper is controlled. The app keeps a completed set and the current value.

ts
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 form = useGhostForm({ schema, values, onSubmit, onInvalid })
const current = ref<StepValue>('dates')
const completed = ref(new Set<StepValue>())

const steps = computed(() =>
  wizard.map((step) => ({
    ...step,
    completed: completed.value.has(step.value),
    invalid: step.fields.some((path) => form.isFieldInvalid(path)),
  })),
)

const indexOf = (value: StepValue) => wizard.findIndex((s) => s.value === value)
let request = 0

async function goTo(target: StepValue) {
  const id = ++request
  const from = wizard[indexOf(current.value)]
  if (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 (from.fields.some((path) => form.isFieldInvalid(path))) return
    completed.value = new Set(completed.value).add(from.value)
  }
  current.value = target
  await nextTick()
  headings.value[target]?.focus() // tabindex="-1" h2 of the new step
}
vue
<GhostStepper
  :steps="steps"
  :model-value="current"
  aria-label="Booking steps"
  @update:model-value="goTo"
/>

Next calls goTo(nextValue) and Back calls goTo(previousValue); the stepper calls the same function. The StepValue union flows through v-model with no cast because the value type is GhostStepperValue<TStep>.

  1. Start. current is dates. Only step 1 is navigable; steps 2 to 5 are disabled triggers. The server renders the same markup.
  2. Move forward after the step validates. The user fills Dates and presses Next. The app validates checkIn, then checkOut. The form is not pending and neither path is invalid, so it adds dates to completed and sets current to guests, then focuses the Guests heading. The stepper shows step 1 complete ("Completed"), step 2 current, and steps 3 to 5 disabled. If checkOut fails, the app stays on Dates, GhostField shows the error, and step 1 becomes invalid because its path is now revealed. Focus stays on Next.
  3. Go back freely. On Room (steps 1 and 2 complete), the user activates step 1 in the stepper. Going back needs no validation: goTo sees the target index is lower and sets current immediately. Steps 2 and 3 stay reachable: 2 is complete and 3 is the frontier.
  4. Jump to a completed step. On Contact, with steps 1 to 3 complete, the user goes back to Dates, then activates step 3 (Room, complete) in the stepper. The target is ahead, so goTo validates the Dates fields first, then moves to Room. Separately, the frontier case: on Dates with only step 1 complete, step 2 is reachable because it is the first incomplete step, and step 3 is not.
  5. Show which step holds a server error. On Review, the user submits. The server rejects the email. In @submit, the app calls setFieldErrors('email', ['Already registered']). fieldErrors.email now has a message, so step 4 renders invalid (indicator !, status "Has errors", data-invalid) while staying complete and navigable. The app sets current to contact directly (a programmatic move, not through goTo, so no validation runs) and, after nextTick, focuses the email field. A client-side failure on submit works the same way from onInvalid: setting current to the first step with an error in the handler mounts that step before the form moves focus to the first invalid control, because the form calls onInvalid before its nextTick focus step.

Design decision ​

Three shapes were compared against the walkthrough.

  1. Documented Tabs recipe. No new component. Rejected: it keeps tab semantics ("tab, selected"), arrow-key movement across steps the user has not reached, and the hand-made states that prompted the request.
  2. Compound parts (GhostStepper, GhostStepperItem, GhostStepperTrigger, GhostStepperIndicator, …). Flexible, and it matches GhostTabs. Rejected because the core promises need the whole ordered list during render: "Step 3 of 5" needs the count, and the linear rule needs the first incomplete step. Child parts only learn their siblings by registering after setup, so the server would render "Step 1" without "of 5" and every step as reachable, then correct it on the client. That is a hydration mismatch or a flash of wrong state.
  3. Data-driven component with slots (chosen). The ordered steps array gives position, count and reachability deterministically on the server and the client, the wizard already has that array, and slots plus useGhostStepper cover restyling and custom markup. GhostPagination is the precedent.

Test plan ​

Unit (framework-neutral, useGhostStepper):

  • State resolution: current > complete > incomplete; invalid and disabled independent of state.
  • Linear reachability table: fresh wizard; after each completion; going back; a disabled incomplete step does not block the frontier; an invalid step stays reachable; unmatched current value (currentIndex -1).
  • free, none, root disabled and step disabled.
  • select: returns false for the current, disabled or unreachable step, and emits or updates local state otherwise.
  • Duplicate values and empty steps warn in development and do not throw.
  • Uncontrolled with no defaultValue: steps is [] at setup and filled later; the first step becomes current with no warning and no emit.

Vue component (GhostStepper.test.ts):

  • Markup per mode: nav > ol > li > button; navigation="none" renders div > ol[aria-label] > li > span with nothing focusable.
  • Accessible names: position, label and status text, with separators, for every state combination, including custom getPositionLabel, completeLabel and invalidLabel.
  • aria-current="step" only on the current step; native disabled on unreachable and disabled steps; aria-describedby to the description.
  • Controlled and uncontrolled: activation emits update:modelValue once; controlled state does not change until the parent applies it; a parent that rejects the value leaves the stepper unchanged; no emit on mount, on prop changes or on activating the current step.
  • steps updates: insert, remove and reorder steps; remove the current step; replace the array; mutate a reactive step's completed and invalid.
  • Focus repair: the focused trigger becomes disabled, and is removed; focus goes to the current step's trigger, or the first enabled trigger.
  • Slots receive the typed context; separator renders between items only.
  • Exposed focus() targets and element.
  • Consumer class and style merge on the root.
  • SSR: renderToString gives position text, aria-current, disabled and description ids; hydration with expectSsrHydration has no mismatch, including an uncontrolled stepper with defaultValue.
  • navigation="none": the current span keeps aria-current="step", no aria-describedby is rendered, and the description is plain text.

Themed (@ghostvue/themes):

  • size renders data-size for sm and lg only and never reaches the DOM as size.
  • Themed ref reaches the root element.

Browser (tests/e2e/ghost-stepper.spec.ts):

  • Press every documented key: Tab and Shift+Tab visit exactly the enabled triggers in order and skip disabled ones; Enter and Space activate; assert real focus with toBeFocused() and the resulting aria-current.
  • The booking-wizard example end to end: blocked forward move on a validation error, Next after a valid step, going back, jumping to a completed step (on Contact with steps 1 to 3 complete, back to Dates, then to Room), the frontier case (only the first incomplete step is reachable), the server-error step showing data-invalid and its status text, and focus landing on the step heading or the invalid field.
  • Focus stays on the activated trigger while an async move is pending, and is never dropped to <body>.
  • Async edit race: with an async schema, start a forward move, edit a field of the current step to an invalid value while validation runs; the step is not marked complete and the move does not happen.
  • Overlapping async moves: two activations where the first validation resolves last; only the latest move applies.
  • Focus repair with real focus.
  • RTL: horizontal layout mirrors, Tab order follows DOM order.
  • Narrow viewport (390px): no horizontal scroll; hidden labels still in the accessible name.
  • Coarse pointer: every enabled trigger is at least 44px tall.
  • axe with zero violations for every example, in light and dark, including navigation="none".

Type tests (packages/vue/type-tests/GhostStepperConsumer.vue):

  • TStep inference: extra fields such as fields are typed in slot props.
  • steps with a missing value or label fails.
  • navigation, orientation and themed size reject unknown strings.
  • v-model with plain GhostStepperStep objects is string.
  • v-model bound to a literal-union ref (ref<'dates' | 'guests'>) with steps declared as const compiles under vue-tsc with no cast, and the update:modelValue payload and select argument are that union.

Manual assistive-technology checks (planned, not recorded evidence): NVDA with Firefox and VoiceOver with Safari on the booking-wizard example and the status-only example, recording the output for each row of the table and for the navigation="none" lines in Assistive technology expectations. If the status-only check fails to announce the current step, apply the currentLabel fallback from Semantics. These are required before the manifest can move past experimental.

Documentation plan ​

  • docs/components/stepper.md: what it is for, when to use Tabs instead, the reachability rule, accessibility notes and the generated API tables.
  • Examples under examples/stepper/:
    • basic: controlled, three steps, linear, with Next and Back buttons calling one goTo (no validation). Uncontrolled mode is shown only as a navigation="free" snippet, since it has no programmatic move.
    • vertical: vertical orientation with descriptions.
    • status-only: navigation="none" as a checkout progress header.
    • booking-wizard: the five-step useGhostForm walkthrough, including validation before moving forward, the server error and focus moves. This replaces the Tabs workaround.
    • custom-indicator: indicator and label slots.
  • An accessibility section: the heading-focus recipe, naming multiple steppers, and localizing the position and status text.
  • A "From Tabs" note for apps migrating the workaround.
  • Playground section with unique copy.
  • Manifests via pnpm manifests:write, API tables via pnpm docs:api:write.

Compatibility and release impact ​

New, additive public API in @ghostvue/vue (GhostStepper, useGhostStepper and types) and @ghostvue/themes (GhostStepper, GhostStepperSize). Manifests start at experimental. No change to existing components, including GhostTabs and GhostForm. Changeset: minor on both packages. Target release 0.4.0.

Open architectural questions ​

None blocking. Decisions taken in review:

  • Value type. v-model, defaultValue, the emit payload and select use GhostStepperValue<TStep> (TStep['value']), not string, so literal unions bind without a cast.
  • Uncontrolled mode. No programmatic move (no exposed goTo) in 0.4.0. Uncontrolled is scoped to steppers whose triggers are the only navigation; wizards are controlled. An exposed move can be added later without a breaking change.
  • GhostForm follow-up (non-blocking, tracked separately). A way for validateField to report that its pass was superseded, so a wizard using an async schema can wait for the newer pass instead of refusing the move. Until then the recipe decides from committed form state and refuses the move while the form is pending.