SegmentedRail
A progress rail with 22px squares inside a canvas wrapper. The wrapper has 6px padding, medium radius, border and inset shadows; the track has no padding and a 3px gap. Percentage can partially fill a square. Each color has its own tooltip label.
Playground
Live preview
States and colors
Brand · partial square
XP · empty
Reward · complete
One color and tooltip per square
XP · three milestone colors · 73%
XP · 2,480 of 3,000
Overflow percentage is capped
Fluid · 24 squares in a narrow card
Code
import { SegmentedRail } from "@npolyhunter/ui";
<SegmentedRail
squares={4}
colors={[
{ tone: "brand", label: "Starting" },
{ tone: "xp", label: "Growing" },
{ tone: "reward", label: "Nearly there" },
{ tone: "periwinkle", label: "Complete" },
]}
percentage={62.5}
label="Progress to next tier"
valueText="62.5% complete"
fluid={false}
className={undefined}
/>;
<SegmentedRail
squares={9}
colors={[{ tone: "xp", label: "XP earned" }]}
current={2480}
max={3000}
label="XP progress"
valueText="2,480 of 3,000 XP"
/>;Used in
Includes use through shared UI components.
App
