StepFlow

StepFlow

HkStepFlow is the container for a multi-step form or wizard body: an optional step header bound to the current step, above a stage that swaps one step's content for the next with a direction-aware slide. The header is the HkTimeline stepper itself, so the "where am I" line and the "go back there" affordance come from the same component the rest of the app uses instead of a second, slightly different one.

  • For the header on its own — a read-only progress row or a selectable stepper with no body attached — use HkTimeline.
  • Two pieces of content that exchange with no step model at all are HkCrossfade; this component is the one that also derives, stages and animates the header alongside the swap.
  • A settings dialog that happens to have steps composes this component rather than re-implementing the swap; the settings surfaces are the place to look when the flow lives inside a sheet.

Import

tsx
1
import { HkStepFlow, type StepFlowSlotProps } from "@celestia-island/hikari";
rust
1
2
use hikari_components::*;          // StepFlow, StepFlowProps, StepFlowSwap, TimelineStep, TimelineCollapse
use hikari_components::prelude::*; // rsx!, VNode, EventHandler

The Rust form is a plain function, StepFlow(StepFlowProps { … }). Every prop has a Rust default, so nothing is required inside rsx! — steps and current_key are required on the Vue side only ([] and "" here); collapse defaults to auto, and the bodies' choreography is host-driven (see the last section).

Header and stage

steps is the flow in order (key, label, and optionally disabled), and current_key names the step on stage. The header derives each step's status from that pair exactly like HkTimeline: steps before the current one are completed, the current one is active and carries aria-current="step", the rest are pending. timeline_clickable makes completed steps selectable and reports the pick through update:modelValue — that is how a user walks back to an earlier step.

hide_timeline drops the header and leaves the stage, for a flow whose steps are named elsewhere. collapse is forwarded to the header untouched; note that the header only ever takes its compact three-cell window form when collapse is always, because auto needs a measurement the flow does not do.

direction drives the slide: a forward move slides the new body in from the leading side, a back move from the trailing side. In TSX the component derives it from its own index history; in the Rust mirror it is a prop you hand in — step_flow_direction_from_keys is the derivation to call.

Account
Profile
Review
Account
Profile
Review

The TSX half shows the flow beside the bare HkTimeline it hosts — same three steps, same current key, so the header the flow renders is visibly the stepper the rest of the app uses. The Rust half is the flow on its second step, with timeline_clickable set so the completed header step takes its button contract; the bare HkTimeline beside it in TSX is the same header the flow draws.

The swap: slide, then morph

A step change plays as two sequential windows. In the slide window the old body slides out while the new one slides in, both drawing the header along with them, and the hosting sheet's height is asked to stay frozen; in the morph window the old node is recycled and the sheet is handed its new height so the fold, if any, sweeps alone. The two windows are separate on purpose: a single concurrent animation kept phone GPUs behind and showed as whole-region flashes.

The stage's data-direction is forward or back and the body classes stage the transition (hk-stepflow-enter-from on the entering body during the slide, hk-stepflow-leave-to on the leaving one). Reduced motion and a stylesheet-less host both settle instantly, with no slide and no timers to outlive.

[D] The Rust mirror is the pure state machine of that choreography and keeps none of Vue's timers, measurements or refs. It takes the whole swap as one value: swap (Some(StepFlowSwap::slide(leaving_key)) opens the slide window, settle() moves to the morph window, None is idle) and it renders the leaving body from leaving_children. The helpers that decide it are exported — step_flow_begin_swap, step_flow_direction_from_keys, step_flow_bodies, step_flow_body_classes — and step_flow_is_complete / step_flow_completed_count answer the "is the flow finished" question for whatever finish affordance the host draws. [D] data-body-id is Vue's monotonic mount counter, but the mirror has no mount identities, so it carries the body's stage ordinal instead (0 for the leaving body, 1 for the current one). [D] The hk-stepflow-swap custom event with the measured height delta has no Rust counterpart: the host owns both the measurement and the sheet.

Account
Profile
Review

The Rust half is mid-slide and therefore shows both bodies on the stage — the leaving one first, staged with hk-stepflow-leave-to. The TSX half has no equivalent prop: Vue mounts and retires its two bodies itself, along with the measurements and timers that close the windows, so its stage is only ever observed at rest. That is also why the swap has no interaction demo on this page: every state worth showing is a mid-transition frame, and those are exactly what the Rust props control.

Sticky header and the host's share

sticky_header pins the header to the top of the scroll host, riding the scroll-pin contract: the header takes hk-scroll-pin, data-side="top" and a data-strategy of bleed (the default) or offset. Vue picks offset by itself when the nearest scroll host declares data-pad-cover; [D] the Rust mirror takes that choice as the controlled sticky_strategy prop.

[D] The scroll-pin stylesheet itself is not mirrored in this wave, so the Rust header emits the markers but the pin behaves flush unless the host ships that layer. [D] Focus handling also stays with the host: Vue blurs the leaving body's focused field before the first animated frame (a focused input made Android's autofill panel strobe through the whole slide) while deliberately keeping focus on a timeline step that drove the change, and that needs document.activeElement plus a live DOM walk the mirror does not reach for.

API

Vue

Props

NameTypeDefaultRequired
stepsArray as PropType<TimelineStep[]>—✓
modelValueString—✓
hideTimelineBooleanfalse—
timelineClickableBooleanfalse—
stickyHeaderBooleanfalse—
collapseString as PropType<TimelineCollapse>"auto"—

Emits

EventPayload
update:modelValuestring

Rust

Props — StepFlow

PropTypeDefaultDescription
stepsVec<TimelineStep>[]The flow's steps, in order (Vue: required steps).
current_keyString""The step currently on stage (Vue: required modelValue).
hide_timelineboolfalseVue: hideTimeline — render the bodies without the header.
timeline_clickableboolfalseVue: timelineClickable — completed header steps become selectable.
sticky_headerboolfalseVue: stickyHeader — pin the header to the scroll host's top.
collapseTimelineCollapseTimelineCollapse::AutoVue: collapse, forwarded to the header timeline (default auto).
sticky_strategyStepFlowPinStrategyStepFlowPinStrategy::BleedVue's pinStrategy ref, as a controlled prop (see the file header).
directionStepFlowDirectionStepFlowDirection::ForwardDirection of the last navigation (Vue: its own direction ref; derive it with step_flow_direction_from_keys).
swapOption<StepFlowSwap>NoneThe swap in flight (Vue: swap + swapPhase); None is idle.
leaving_childrenOption<Element>NoneBody content for the step sliding out — Vue's keyed slot of the leaving step.
childrenElement(empty)Body content for the current step — Vue's keyed slot of modelValue.
on_changeOption<EventHandler<String>>NoneFired when the header timeline selects a completed step (Vue: emit ("update:modelValue", key)).
classString""Vue attribute fallthrough onto the root <div>.

Accessibility

  • The header is a real HkTimeline: the active step carries aria-current="step", and when timeline_clickable is set every enabled step is a role="button" with tabindex="0" that answers Enter and Space as well as a click. A step that is not completed yet stays out of the tab order, so the keyboard path only ever walks steps the user may return to.
  • The step bodies are plain <div>s with no landmark of their own. Because the body is remounted on a change, announce the change yourself if the flow matters to assistive tech — the header's aria-current moves, but nothing announces "step two of four" automatically.
  • Do not make the flow a form that submits on Enter unless the Enter is scoped to the body: a timeline step is a button, and a stray Enter on one would navigate rather than submit.
  • A swap takes focus away from the body: Vue blurs the focused field in the leaving body before the first animated frame, so a keyboard user who was typing inside a step loses that field on navigation. Keep the confirmation inside the body's own button rather than relying on Enter in a field, and move focus deliberately (to the new step's first field) when the flow continues. Under reduced motion the slide is removed and the swap settles instantly, so that blur is the only thing left of the transition.
  • A step whose body is remounted is a fresh subtree; if you return focus into it programmatically, do it after the swap settles rather than during the slide.

Related components

  • HkTimeline — the header this component hosts, and the right pick when there is no body to swap.
  • HkCrossfade — the in-place dissolve used when two views exchange with no step model.
  • ScrollPin — the whitespace contract sticky_header rides.
  • SectionCard — the titled panel a step flow usually sits above.