Skip to content

LinearProgress

Horizontal progress bar with optional label, buffer, segmented stacks, and indeterminate loading.

  • stable
  • since v0.1.0
  • 2.4 kB
  • data-display
  • progress
  • feedback

Renders an ARIA progressbar with min/max/now and a formatted aria-valuetext; indeterminate state omits the value.

Preview
Open
tsx
import { LinearProgress } from '@arshad-shah/cynosure-react';
<LinearProgress value={60} />

For custom layouts, compose with LinearProgressRoot, LinearProgressTrack, LinearProgressIndicator, LinearProgressBuffer, LinearProgressSegment, LinearProgressHeader, LinearProgressLabel, LinearProgressMeta, and LinearProgressValue directly.

Four sizes are available: xs, sm, md (default), and lg.

Preview
Open
tsx

Pick a scheme that matches the surrounding context: accent, success, warning, danger, or neutral.

Preview
Open
tsx

Pass label and meta for a two-up header above the bar. Set showValue to render the formatted percentage below.

Preview
Open
tsx

Pass indeterminate for an unknown-duration loader. The ARIA value attributes are dropped so assistive tech announces an unspecified loading state.

Preview
Open
tsx

Pass buffer for a YouTube-style preloaded zone behind the active indicator.

Preview
Open
tsx

Pass a segments array for a stacked multi-value bar — each segment becomes a LinearProgressSegment with its own colour scheme.

Preview
Open
tsx
PropTypeDefaultDescription
value
number
0
Current progress value. Ignored when `indeterminate` or `segments` is set.
max
number
100
Upper bound used to compute the filled percentage.
size
"xs"|"sm"|"md"|"lg"
md
Height/font preset for the bar.
colorScheme
"accent"|"success"|"warning"|"danger"|"neutral"
accent
Colour role for the filled portion.
variant
"solid"|"ticked"
solid
Visual treatment: `solid` (flat colour) or `striped` (animated stripes).
indeterminate
boolean
false
Render the indeterminate loop animation instead of a value-driven fill.
buffer
number
YouTube-style preloaded / reserved progress bar behind the indicator.
segments
LinearProgressSegmentDescriptor[]
Stacked multi-value bar — mutually exclusive with plain `value`. Each entry becomes a `<LinearProgressSegment>`.
showValue
boolean
false
Render the formatted value below the track.
label
ReactNode
Short label rendered above the track (left side).
meta
ReactNode
Trailing text above the track (right side) — speed, ETA, "12 of 20".
formatValue
((value: number, max: number) => string)
Override the default `${pct}%` formatter used by {@link LinearProgressValue}.
completionState
"auto"|"none"
auto
`auto` flips to the success palette once full; `error` forces the danger palette.
aria-label
string
`aria-label` passthrough. When omitted, falls back to `label` if it's a string.
className
string
Additional class applied to the root element.
style
CSSProperties
Additional inline styles merged onto the root.
  • Renders role="progressbar" on the root with aria-valuenow, aria-valuemin, and aria-valuemax.
  • aria-valuetext follows formatValue (defaults to "NN%") so screen readers announce a human-readable value.
  • Omits the value when indeterminate is set so assistive tech reports “loading” instead.
  • When label is a string it doubles as the accessible name; otherwise pass an explicit aria-label.
  • data-complete flips on once value >= max (unless completionState="none"), letting you style the finished state without extra state.
  • Use variant="ticked" for a stepped bar that emphasises discrete progress milestones.
  • Pass a formatValue callback like (v, max) => `${v} of ${max}` to switch from a percent readout to a count.
  • Use segments to visualise quota usage (e.g. used / reserved / free) in a single bar.
  • Combine buffer + value to surface “downloaded” vs “playing back” progress for media players.