Skip to content

feat: add Stepper component - #46

Merged
max-wells merged 7 commits into
rust-ui:mainfrom
dexterhere:feat/stepper
Jul 24, 2026
Merged

feat: add Stepper component#46
max-wells merged 7 commits into
rust-ui:mainfrom
dexterhere:feat/stepper

Conversation

@dexterhere

Copy link
Copy Markdown
Contributor

Summary

Adds a Stepper component for multi-step workflows (onboarding, checkout, setup wizards) — scope and API discussed and approved in # before implementation.

  • Stepper / StepperItem / StepperTrigger / StepperIndicator / StepperTitle / StepperDescription / StepperSeparator — compound component anatomy matching the approved proposal
  • use_stepper hook (app_crates/registry/src/hooks/use_stepper.rs) owns all navigation state — current_index, can_go_prev/can_go_next, go_next/go_prev/go_to, and per-step StepState derivation — exposed via StepperContext and consumed through provide_context/expect_context, mirroring use_pagination.rs/TabsCtx
  • StepState (Completed/Active/Pending/Disabled) and StepperOrientation (Horizontal/Vertical) as enums, not strings
  • StepperIndicator styling via the variants! macro (StepperIndicatorVariant), not hand-rolled tw_merge! branching
  • Horizontal and vertical orientation, controlled current-step state, clickable native <button> triggers with aria-current="step", disabled steps, custom titles/descriptions, custom indicator content via children
  • 3 demos: default (shows all three step states at once), controlled (external Previous/Next buttons reading StepperContext from outside StepperTrigger), vertical
  • Docs page (public/docs/components/stepper.md) following tabs.md's structure, plus a changelog entry

Per the discussion, this covers the initial scope only — controlled component + both orientations. Advanced states (validation, optional steps, error states, content panels) are intentionally deferred to a follow-up.

Notes for review

  • public/registry/* and app/src/__registry__/* are untouched — these are regenerated by build_registry, which isn't part of this PR.
  • No e2e spec added yet (following the pattern of other recently-added components in this cycle) — happy to add one if you'd like it in this PR rather than a follow-up.

Test plan

  • cargo check clean across registry and app
  • cargo clippy clean (zero warnings in any Stepper file)
  • cargo fmt && leptosfmt — no diff
  • Manually verified in browser: all four StepState visual states render correctly, checkmark/number swap on completion, direct trigger-click navigation (go_to), external Previous/Next controls (go_next/go_prev) with correct disabled-state binding at both ends, horizontal separator aligns through the indicator center, vertical orientation layout

The horizontal StepperSeparator used a flat mt-4 offset, which landed
near the title text instead of the indicator circle. Switched to
self-center (horizontal-only) so the connecting line runs through the
indicator's actual vertical center, confirmed via live bounding-box
inspection in the browser. Also imports StepperContext directly instead
of using the fully-qualified path at each call site.
…ariants

demo_stepper shows all three step states at a glance via a non-zero
default_step. demo_stepper_controlled adds external Previous/Next buttons
that read StepperContext from outside StepperTrigger, proving the context
is available to any descendant of Stepper. demo_stepper_vertical exercises
the vertical orientation with the same anatomy.
Follows tabs.md's structure (frontmatter, Installation, Components,
Usage, Examples, See Also). References StaticStepper/StaticInstallStepper/
StaticStepperControlled/StaticStepperVertical, wired up once build_registry
regenerates the registry.
…ment

The earlier import cleanup used a targeted replace that only matched
variables named `ctx`, missing StepperTrigger's `stepper_ctx` — still had
the fully-qualified StepperContext path. Also adds a doc comment to
StepperOrientation, which was inconsistent with StepState already having
one.
@max-wells
max-wells merged commit 77b11f8 into rust-ui:main Jul 24, 2026
@max-wells

Copy link
Copy Markdown
Contributor

Thanks for the contribution, @dexterhere! Merged 🎉 The Stepper component looks great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants