Stage rail
A thin row of segments that shows how far a run has got.
Plan: done
Build: done
Verify: in progress
Review: not started
Ship: not started
import { StageRail } from "@dapplelight/signet-ui/components/stage-rail"
export function Demo() {
return (
<StageRail
aria-label="Run progress"
stages={["Plan", "Build", "Verify", "Review", "Ship"]}
current={2}
className="max-w-md"
/>
)
}Installation
npm i @dapplelight/signet-uiUsage
import { StageRail } from "@dapplelight/signet-ui/components/stage-rail"
<StageRail aria-label="Run progress" stages={["Plan", "Build", "Ship"]} current={1} />Done stages are filled, the current one is filled and pulses, later ones are empty. The pulse stops when the user prefers reduced motion. Each segment has screen-reader text such as "Verify: in progress"; the rail itself is not interactive and has no tab stop. It uses Stepper's status rule, so the same current works for both.
Examples
Run trace
A rail above a vertical Timeline of the same five stages, with a DecisionCallout under the step where a decision was made.
Plan: done
Build: done
Verify: in progress
Review: not started
Ship: not started
Plan
Split the ticket into 4 tasks
Build
Changed 7 files, +184 −36
Ran 42 affected tests instead of the full suite
The diff touches 3 of 61 packages; 18 s instead of 6 min.
Verify
Running 42 tests
Review
Ship
import { DecisionCallout, DecisionCalloutReason, DecisionCalloutTitle } from "@dapplelight/signet-ui/components/decision-callout"
import { StageRail } from "@dapplelight/signet-ui/components/stage-rail"
import { Timeline, TimelineConnector, TimelineDescription, TimelineItem, TimelineMarker, TimelineTime, TimelineTitle } from "@dapplelight/signet-ui/components/timeline"
const stages = ["Plan", "Build", "Verify", "Review", "Ship"]
export function Demo() {
return (
<div className="w-full max-w-md space-y-6">
<StageRail aria-label="Run progress" stages={stages} current={2} />
<Timeline aria-label="Run trace">
<TimelineItem status="complete">
<TimelineMarker />
<TimelineConnector />
<TimelineTitle>Plan</TimelineTitle>
<TimelineTime>09:02</TimelineTime>
<TimelineDescription>Split the ticket into 4 tasks</TimelineDescription>
</TimelineItem>
<TimelineItem status="complete">
<TimelineMarker />
<TimelineConnector />
<TimelineTitle>Build</TimelineTitle>
<TimelineTime>09:14</TimelineTime>
<TimelineDescription>Changed 7 files, +184 −36</TimelineDescription>
<DecisionCallout>
<DecisionCalloutTitle>Ran 42 affected tests instead of the full suite</DecisionCalloutTitle>
<DecisionCalloutReason>
The diff touches 3 of 61 packages; 18 s instead of 6 min.
</DecisionCalloutReason>
</DecisionCallout>
</TimelineItem>
<TimelineItem status="current">
<TimelineMarker />
<TimelineConnector />
<TimelineTitle>Verify</TimelineTitle>
<TimelineDescription>Running 42 tests</TimelineDescription>
</TimelineItem>
<TimelineItem status="upcoming">
<TimelineMarker />
<TimelineConnector />
<TimelineTitle>Review</TimelineTitle>
</TimelineItem>
<TimelineItem status="upcoming">
<TimelineMarker />
<TimelineConnector />
<TimelineTitle>Ship</TimelineTitle>
</TimelineItem>
</Timeline>
</div>
)
}Customising
- Tokens. The segments use
bg-primaryandbg-bg-elevated; change those in your theme. - Props.
stagesandcurrent. The words screen readers hear (stageDone,stageCurrent,stageUpcoming) come fromLabelsProvider, so an app can translate them. className. Merged onto the root, for examplemax-w-md.classNames.segmentandlabelreplace or extend the classes of every segment and of its screen-reader text.- Own the source.
signet add stage-railcopies the file into your project.
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
stages | ReactNode[] | - | One title per stage, read out by screen readers. Empty renders nothing. |
current | number | - | Index of the current stage, from 0. Earlier stages are done; past the end, all are; below 0, none. |
aria-label | string | - | Required. Names the rail for screen readers, like "Run progress". |
classNames | Partial<Record<"segment" | "label", string>> | {} | Classes for each segment and its screen-reader text. |
className | string | - | Merged onto the root. |
Plus every native <div> prop except children.
| Label key | Default |
|---|---|
stageDone | "done" |
stageCurrent | "in progress" |
stageUpcoming | "not started" |