Skip to content
Browse docs and components

Stacked Bar Chart

stacked-bar-chart

Bars split into the parts that make them up, on TanStack Charts. Layers keep the order you give them in every bar, `percent` compares the mix instead of the totals, and focus groups a whole bar so the tooltip lists every layer.

Responsive

Install

$npxshadcnadd@forme/stacked-bar-chart

Adds the component, its registry dependencies, and the token stylesheet you import once.

API reference

Read from the source, so it is the API of the file you install. A prop marked * is required.

StackedBarChart

Bars split into the parts that make them up: revenue by plan, tickets by priority, spend by team.

PropTypeDefaultDescription
data*readonly Row[]—
index*keyof Row & string—The field that labels each bar: a month, a region, a release.
series*readonly StackedBarSeries<Row>[]—The layers, bottom to top. Colours follow this order from --chart-1.
label*string—Accessible name. Say what is stacked and over what.
percentbooleanfalseEach bar to 100%, so the mix compares rather than the totals.
formatValue(value: number) => stringplain
heightnumber280
classNamestring—