ui · Primitive
Progress
@devalok/shilp-sutra/ui/progressView in Storybook Preview
Uploading
72%
Variants
color
size
autoColor by value
40%
72%
95%
indeterminate
Syncing
segments
compound (Root / Track / Indicator)
Storage
68%
Reference
- Import: @devalok/shilp-sutra/ui/progress
- Server-safe: No
- Category: ui
A linear progress bar. Use the smart all-in-one <Progress value={70} /> for the
common cases, or the compound parts (Progress.Root / Track / Indicator /
Segment / Label / Value) for full layout control and multi-segment bars.
Props
value: number | null (0–max) — omit or null for an indeterminate bar
max: number (scale maximum, default 100)
size: "sm" | "md" | "lg" (track height)
color: "accent" | "success" | "warning" | "error" (indicator color)
autoColor: boolean (auto-shift color by value: 0-59=accent, 60-84=warning, 85-100=success, >100=error)
label: ReactNode (descriptive label rendered before the bar; names the bar for a11y)
showValue: boolean (shows the "{n}%" readout after the bar)
segments: { value: number; color?: "accent" | "success" | "warning" | "error" }[] (multi-segment bar; overrides the single indicator)
trackClassName: string (class for the Track element)
indicatorClassName: string (class for the single Indicator; ignored when segments set)
Compound Components
Progress (smart all-in-one — value/size/color/label/showValue/autoColor/segments)
Progress.Root (layout container + context; owns value/max/size)
Progress.Label (descriptive label; give it id + point Track's aria-labelledby at it)
Progress.Track (the aria progressbar + track visual; holds Indicator or Segments)
Progress.Indicator (single fill; color, or auto-color by value)
Progress.Segment (one slice of a multi-segment bar — value + color)
Progress.Value (the "{n}%" readout; custom via children or a `format` fn)
Defaults
size: "md"
color: "accent"
max: 100
Example
// Simple:
<Progress value={75} color="success" showValue />
<Progress size="sm" /> {/* indeterminate */}
<Progress value={80} autoColor showValue /> {/* color follows value */}
// Multi-segment (Mantine-style):
<Progress segments={[{ value: 40, color: 'success' }, { value: 30, color: 'warning' }]} />
// Compound — full control:
<Progress.Root value={62} size="lg">
<Progress.Label id="storage-lbl">Storage</Progress.Label>
<Progress.Track aria-labelledby="storage-lbl">
<Progress.Indicator color="warning" />
</Progress.Track>
<Progress.Value format={(pct) => `${pct}% of 50 GB`} />
</Progress.Root>Composability
- Two APIs, one component. The smart
<Progress>composes the parts for you; reach for the compound parts when you need a custom layout (label above the bar, value inside, multiple bars) or multi-segment fills. Structure follows Ark UI / Chakra;Progress.Segmentfollows Mantine. Progress.Trackis the accessible progressbar (role=progressbar, aria-valuenow/min/max fromRoot's value). Give it a name viaaria-label, or aProgress.Label+ matchingaria-labelledby. The smart form wires this from thelabelprop / a passedaria-labelautomatically.- autoColor semantic signal: maps value thresholds to color (0–59 accent · 60–84 warning · 85–100 success · >100 error) — storage meters, budget trackers, goal progress. Pass an explicit
colorto opt out. - Segments render side-by-side, each
valueas a % ofmax; the Track's aria value still reflectsRoot'svalue. - Indeterminate: omit
value(or passnull) for the continuous sweep. Motion-reduced users get a static bar. - Progress vs ProgressRing: Progress is linear;
ProgressRingis circular (with multi-ring stacked variants).
Gotchas
- Omit
value(or passnull) for indeterminate. - Pass an explicit
colorto overrideautoColor. - Compound
Progress.Trackneeds a name — anaria-label, or aProgress.Labelwhoseidthe Track'saria-labelledbypoints to. A Track with neither is an unnamed progressbar (axe will flag it). Progress.Indicator/Segment/Valuethrow if rendered outsideProgress.Root.
Changes
v0.49.0
- BREAKING Progress redesigned as a compound component. Renamed
showLabel→showValue. Thecolorneutral value"default"→"accent"(the type is now"accent" | "success" | "warning" | "error"). Added compound parts (Progress.Root/Track/Indicator/Segment/Label/Value), alabelprop, amaxprop, asegmentsprop (multi-segment bars), andtrackClassName. MigrateshowLabel→showValueandcolor="default"→color="accent"(or drop it — accent is the default).
v0.29.0
- Added
autoColorprop — automatically shifts indicator color based on value thresholds
v0.1.0
- Added Initial release with
size,color,indeterminatevariants and optional label slot