Stepper

Stepper

Stepper is the Rust-only step bar: total numbered circles joined by connector lines, with the state of each step derived from current — earlier steps read as done, the one at current reads as active, the rest are still to come. It is a count, not a list: the bar renders no labels, no descriptions and no buttons of its own.

This page documents a legacy migration surface. Stepper settled in the Rust crate before the component pages existed, and packages/vue/src ships no HkStepper — the nearest Vue component is HkStepFlow, which owns the whole wizard (a step list plus the animated body swap) rather than a bare bar. Treat Stepper's shape as frozen; a new surface that only needs a progress indicator should draw its own numbered row, or use the Vue step flow when it needs the wizard.

  • Its deprecated sibling Steps is documented here too: it is a thin alias that forwards current, the length of its steps list and the direction to Stepper, and drops everything else; it is documented in "Steps, the deprecated alias" below.
  • Stepper is a progress read-out; the content of each step is the host's own markup, usually a Section or a card beside the bar.
  • A ratio with a filled track is ProgressBar; one step's state that is not a position in a sequence belongs in a Badge.

Import

rust
1
2
use hikari_components::*;          // Stepper, StepperDirection
use hikari_components::prelude::*; // StepperProps, rsx!, VNode

Stepper is a plain function, Stepper(StepperProps { … }). Inside rsx! every prop may be omitted: current defaults to 0, total to 5, direction to StepperDirection::Horizontal and class to "". StepperProps is in the prelude; StepperDirection is not, so a host that names the enum takes it from hikari_components — although an enum value written inside rsx! needs no import at all. The same split holds for the alias: StepsProps is in the prelude, StepData / StepStatus / StepsDirection are not.

Horizontal bar

The default direction lays the steps out in a flex row; each step carries a div.hk-step-number holding its 1-based index, and a connector is drawn after every step but the last. With current: 0 and the default total, the first circle is active and the other four are pending.

Rust
1
2
3
4
5

Current step and the state names

current is a zero-based index into total steps. The component's class names read backwards from the screen: a step before current gets hk-step-pending, the step at current gets hk-step-active, and a step after it gets hk-step-finished. The active circle is the emphasized one in both the builder bundle (stepper.scss, a bordered primary circle) and the compiled style registry (stepper.rs, a filled primary circle); the other two tones are quieter, so the name of the class is the only thing that says which side of the current step a circle sits on.

An index at or past total matches no step, so a bar with current: 9 of five looks the same as one with current: 5 — nothing is active and every circle is in the after-state; clamp the value before passing it.

Rust
1
2
3
4
5
1
2
3
4
5

Vertical bar and host classes

direction: StepperDirection::Vertical switches the bar to a column, gives each step a full-width row and draws the connector as a positional rule down from the previous circle instead of a line between them. class is appended after the component's own classes, so a host can retarget one instance without forking the sheet; there is no style prop.

Rust
1
2
3
4
1
2
3
4

Steps, the deprecated alias

Steps used to be a second, independent step-bar implementation with its own per-step data (StepData), its own direction enum (StepsDirection) and its own StepStatus. It is now a thin alias: it builds a Stepper and passes current, total: steps.len(), the direction and class through, and ignores everything the count-based bar cannot express — each entry's title, description, icon and status, plus StepsProps' own style and on_change. A bar drawn with Steps is therefore the same drawing as a Stepper with the length of that list; the labels a page wants belong beside the bar.

Both the alias and both of its types carry #[deprecated] notes. The #[component] macro re-emits only the function signature, so the note on Steps itself never reaches rustc — the warning a consumer sees comes from the deprecated StepsProps / StepData / StepsDirection types, which every call has to build. The removal condition written into the source is that the four items go once nothing references them.

Rust
1
2
3
1
2
3

API

Rust

Props — Stepper

PropTypeDefaultDescription
currentusize0—
totalusize5—
directionStepperDirectionStepperDirection::Horizontal—
classString""—

Props — Steps

PropTypeDefaultDescription
currentusize0—
directionStepsDirectionStepsDirection::Horizontal—
stepsVec<StepData>[]—
classString""—
styleString""—
on_changeOption<Callback<usize, ()>>None—

Accessibility

  • The bar is a run of plain divs: no list, no group role, no names. A screen reader reads the step numbers as loose text ("1", "2", …) with no indication of which one is current, so the position has to be stated in the host's own text — a line beside the bar such as "Step 2 of 5: Review" is the portable fix.
  • Nothing in the bar is focusable and nothing is clickable, so it adds no stop to the Tab order and gives no keyboard path to a step. Moving between steps is the host's content and the host's concern.
  • The state is carried by the hk-step-* class names and the circle tone only; there is no icon and no visually-hidden label that distinguishes done from upcoming, so colour is the sole channel — keep the accompanying prose explicit rather than relying on the tint.
  • Steps renders exactly the bar Stepper renders, so it inherits every point above; the per-step title / status it accepts are never shown, and can therefore not carry the meaning either.

Related components

  • HkStepFlow — the Vue wizard: the step list plus the body that swaps between steps.
  • ProgressBar — the ratio read-out when a single filled track says more than a numbered row.
  • Section — the block that usually holds a step's content beside the bar.
  • Layout — the legacy page frame, when a step bar heads a form page.