- Docs
- Components
- Navigation
Steps
Where a person is in a setup of a few steps: done, current and to come.
- Import
- @qeetrix/react/experimental
- Status
- ExperimentalSince 0.0.6
- Renders
<ol>Server-rendered- Tested
- WCAG 2.2 AAaxe on every pull request
01
Import
// Experimental: from the package's experimental entry, until it's stable.
import { Steps } from "@qeetrix/react/experimental";02
Props
And every native attribute of the element it renders.
| Prop | Type | Default | What it does |
|---|---|---|---|
steps | { label, description?, status? }[] | required | The steps in order; description shows in the vertical layout; status overrides current's state for one step. |
current | number | required | The current step's index, from 0; steps.length once all are done. |
orientation | "horizontal" | "vertical" | "horizontal" | Horizontal for a short wizard; vertical, with descriptions, for a longer setup. |
onStepSelect | (index) => void | — | Done steps become buttons back to themselves. Without it, steps are text. |
messages | object | the provider's | The list's name, "Completed" and "Not started". |
03
Parts
Each part carries a data-slot, for tests and placement.
| data-slot | Element | What it is |
|---|---|---|
steps | <ol> | Named "Progress"; data-orientation. |
step | <li> | data-state: done, current or upcoming. |
step-marker | <span> | The tick or the number, aria-hidden. |
04
With a form per step
Keep current in state; Continue moves on once the step's fields are valid, and Back or a done step goes back.
const [current, setCurrent] = useState(0);
<Steps steps={steps} current={current} onStepSelect={setCurrent} />
<Form onFormSubmit={() => setCurrent(current + 1)}>…</Form>