LinearProgress
Horizontal progress bar with optional label, buffer, segmented stacks, and indeterminate loading.
Renders an ARIA progressbar with min/max/now and a formatted aria-valuetext; indeterminate state omits the value.
import { LinearProgress } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<div style={{ width: '20rem' }}>
<LinearProgress value={60} />
</div>
);
}
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.
import { LinearProgress } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<div style={{ width: '20rem', display: 'flex', flexDirection: 'column', gap: '0.75rem' }}>
<LinearProgress value={60} size="xs" />
<LinearProgress value={60} size="sm" />
<LinearProgress value={60} size="md" />
<LinearProgress value={60} size="lg" />
</div>
);
}
Color schemes
Section titled “Color schemes”Pick a scheme that matches the surrounding context: accent, success, warning, danger, or neutral.
import { LinearProgress } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<div style={{ width: '20rem', display: 'flex', flexDirection: 'column', gap: '0.75rem' }}>
<LinearProgress value={60} colorScheme="accent" />
<LinearProgress value={60} colorScheme="success" />
<LinearProgress value={60} colorScheme="warning" />
<LinearProgress value={60} colorScheme="danger" />
<LinearProgress value={60} colorScheme="neutral" />
</div>
);
}
With label
Section titled “With label”Pass label and meta for a two-up header above the bar. Set showValue to render the formatted percentage below.
import { LinearProgress } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<div style={{ width: '22rem' }}>
<LinearProgress
value={64}
label="Uploading project assets"
meta="2.4 MB / 3.8 MB"
showValue
/>
</div>
);
}
Indeterminate
Section titled “Indeterminate”Pass indeterminate for an unknown-duration loader. The ARIA value attributes are dropped so assistive tech announces an unspecified loading state.
import { LinearProgress } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<div style={{ width: '22rem' }}>
<LinearProgress indeterminate label="Loading" aria-label="Loading" />
</div>
);
}
Buffer
Section titled “Buffer”Pass buffer for a YouTube-style preloaded zone behind the active indicator.
import { LinearProgress } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<div style={{ width: '22rem' }}>
<LinearProgress value={32} buffer={68} label="Streaming" meta="1:48 / 5:32" />
</div>
);
}
Segments
Section titled “Segments”Pass a segments array for a stacked multi-value bar — each segment becomes a LinearProgressSegment with its own colour scheme.
import { LinearProgress } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<div style={{ width: '22rem' }}>
<LinearProgress
max={100}
label="Storage"
meta="78 GB of 100 GB"
segments={[
{ value: 48, colorScheme: 'accent', label: 'Photos' },
{ value: 20, colorScheme: 'success', label: 'Documents' },
{ value: 10, colorScheme: 'warning', label: 'Other' },
]}
/>
</div>
);
}
Accessibility
Section titled “Accessibility”- Renders
role="progressbar"on the root witharia-valuenow,aria-valuemin, andaria-valuemax. aria-valuetextfollowsformatValue(defaults to"NN%") so screen readers announce a human-readable value.- Omits the value when
indeterminateis set so assistive tech reports “loading” instead. - When
labelis a string it doubles as the accessible name; otherwise pass an explicitaria-label. data-completeflips on oncevalue >= max(unlesscompletionState="none"), letting you style the finished state without extra state.
Recipes
Section titled “Recipes”- Use
variant="ticked"for a stepped bar that emphasises discrete progress milestones. - Pass a
formatValuecallback like(v, max) => `${v} of ${max}`to switch from a percent readout to a count. - Use
segmentsto visualise quota usage (e.g. used / reserved / free) in a single bar. - Combine
buffer+valueto surface “downloaded” vs “playing back” progress for media players.