[ Feedback ]

StackedProgress

One bar split into colored segments with a legend: time breakdowns, storage usage or budget splits.

2 examplesDark modeAccessible

Import#

import { StackedProgress } from 'reusify-ui';

When to use#

  • Showing how a total divides into a few parts (2–5 segments read best).

Examples#

Breakdown#

Time breakdown
  • Work
  • Absence
  • Other
<StackedProgress
  label="Time breakdown"
  segments={[
    { label: 'Work', value: 990, color: '#3f9d5d' },
    { label: 'Absence', value: 380, color: '#8b5cf6' },
    { label: 'Other', value: 450, color: '#e07a7a' },
  ]}
/>

With remaining space#

Pass max to leave the unused part as a muted segment, e.g. storage used out of a quota.

  • Photos
  • Videos
  • Docs
<StackedProgress
  max={100}
  size="lg"
  gap={2}
  segments={[
    { label: 'Photos', value: 38, color: 'var(--ru-info)' },
    { label: 'Videos', value: 24, color: 'var(--ru-warning)' },
    { label: 'Docs', value: 9, color: 'var(--ru-success)' },
  ]}
/>

Used in designs#

StackedProgress in real layouts: this design uses it. Open one to try it and copy the code.

API reference#

<StackedProgress />

segments-
Array<{ label, value, color }>

Parts of the total.

max-
number

Total; defaults to the sum. Extra space shows as muted.

label-
ReactNode

Small uppercase heading.

showLegendtrue
boolean

Dots + labels above the bar.

size'md'
'sm' | 'md' | 'lg'

Bar height.

gap4
number

Space between segments in px.

Accessibility#

  • The bar is role="img" with a summary like "Work 54%, Absence 21%, Other 25%".