Stepper
The challenge builder's stepper (.stepper): one bar per step, done and current bars raspberry, labels "1. Basics". Every step is a button (go back or jump ahead, as the mock allows); the current one has aria-current="step".
import { Stepper } from '@ergasti/bricks';Examples
What changes
Old value, new value, a worked example and a note about when it applies; changed turns the arrow on.
Code
import { ChangePreview } from '@ergasti/bricks';
function Preview() {
return (
<div style={{ maxWidth: 480 }}>
<ChangePreview from="8% of sale" to="10% of sale" changed example={<>On an EGP 1,000 order, the creator earns <b>EGP 100</b>.</>} note="Applies to orders placed after you save. Orders already placed keep the old rate." />
</div>
);
}Stepper
Numbered steps for a builder; finished steps are buttons when you pass onStep.
Code
import { useState } from 'react';
import { Stepper } from '@ergasti/bricks';
function Steps() {
const [step, setStep] = useState(1);
return <Stepper steps={['Basics', 'Type & goal', 'Who can join', 'Reward']} current={step} onStep={setStep} />;
}Nothing changed yet, and an invalid value
changed={false} greys the arrow while the new value equals the old; error replaces the worked example with why the new value cannot be saved.
Code
import { ChangePreview } from '@ergasti/bricks';
function States() {
return (
<div style={{ display: 'grid', gap: 16, maxWidth: 480 }}>
<ChangePreview from="8% of sale" to="8% of sale" changed={false} />
<ChangePreview from="8% of sale" to="120% of sale" changed error="A commission cannot be more than 100% of the sale." />
</div>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key prEditing, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
none | No changes yet. | مفيش تغييرات لسه. |
was | Was | كان |
now | Now | دلوقتي |
steps | Steps | الخطوات |
step | Step {i} of {n} | خطوة {i} من {n} |
done | done | خلصت |
Design guidance
How the BRICKS design system uses Stepper. Written in docs/content/components/Stepper.md; the props above are read from the code, which wins where the two disagree.
The challenge builder's step bar: one bar per step with a numbered label, done and current steps raspberry; use it above a multi-step PR form.
Stepper is the mock's .stepper. Each step is a thin bar with "1. Basics" under it. With onStep every step is a button, so PR can go back or jump ahead as the mock allows; without it the steps are text. The current step has aria-current="step", done steps say "(done)" to screen readers, and "Step 2 of 4" is announced politely on change.
Anatomy
- Nav:
<nav aria-label="Steps" class="kit-pr-stepper">. - List:
<ol>, flex, 6px gap, one equal<li>per step. - Step: a
<button>(withonStep) or<span>: a 5px bar (--track, raspberry when done or current), then "1. Basics" (13px / 600,--ink-3; current in--ink). - Live text: hidden "Step 2 of 4".
Variants
| Prop | Value | Effect |
|---|---|---|
onStep | given | Steps are buttons |
| omitted | Steps are text (not clickable) |
States
| State | Look |
|---|---|
Done (i < current) | Raspberry bar, "(done)" for AT |
| Current | Raspberry bar, ink label, aria-current="step" |
| Upcoming | Track bar, muted label |
| Focus-visible | focus ring on the button |
| Phone (≤600px) | only the current step's label shows; bars stay |
| Touch (≤1024px) | each step is a 44px target |
Usage
import { useState } from 'react';
import { Stepper } from '@ergasti/bricks';
export function Steps() {
const [step, setStep] = useState(1);
return <Stepper steps={['Basics', 'Type & goal', 'Who can join', 'Reward']} current={step} onStep={setStep} />;
}// Challenge builder: stepper, the step's form, and the summary beside it
<Stepper steps={['Basics', 'Type & goal', 'Who can join', 'Reward']} current={step} onStep={setStep} />
<div style={{ display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) 360px', gap: 24 }}>
<Card>{step === 1 && <ChoiceGroup label="Challenge type" value={type} onChange={setType} options={typeOptions} />}</Card>
<ChallengeSummary {...summary} layout="flat" />
</div>Where it appears
- PR Portal › Affiliate programs › Challenges › challenge builder (steps 1-4).
Guidelines
Do
- Keep labels to one or two words.
- Let PR jump back freely; validate before moving forward.
Don't
- Don't use it for more than five steps.
- Don't use it as page tabs; use
PillTabs.
RTL and Arabic
Bars run right to left; the step number stays dir="ltr" ("1.").
Tokens
--track, --rasp, --ink, --ink-3, --focus-ring, --radius-xs, --min-touch-target.
Accessibility
A labelled nav with an ordered list; current step aria-current="step"; done steps announced; the position is read politely on change; 44px targets on touch tiers (≤1024px).
Found in the source
- Roles in the markup:
alert. - ARIA attributes set:
aria-live,aria-hidden,aria-current,aria-label.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
ChallengeSummary: the builder's side summary.ChoiceGroup: the builder's choices.PillTabs(kit): page tabs.
See also: PrIcon · useLanguage · ChangePreview · BulkAction · DecisionsCard
Source
src/pr/Editing.tsx (line 58) on GitHub.