Line chart
A multi-series line chart with a gliding crosshair, legend toggles, and paths that morph between ranges.
Layered streams on a wiggle baseline that morph between ranges, with a layer you can isolate and read week by week.
npx shadcn@latest add @silicon-ui/streamgraphnpx shadcn@latest add @silicon-ui/streamgraphInstall the dependencies.
npm install motionCopy these files into your project. Shared files are skipped if you already have them.
components/silicon-ui/streamgraph/streamgraph.tsxcomponents/silicon-ui/streamgraph/streamgraph.module.cssInstall the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation
| Prop | Type | Default |
|---|---|---|
data* | StreamgraphDatum[] | — |
series*Layers from the centre out: the first runs through the middle of the stream, the rest alternate above and below it. | StreamgraphSeries[] | — |
label*What is measured, such as "Support tickets by topic". Names the chart for assistive technology. | string | — |
unitUnit after each value, such as "tickets". | string | "" |
heightPlot height in pixels. The width follows the container. | number | 260 |
offset"wiggle" minimises layer slopes for a flowing stream, "silhouette" centres the stack, "zero" stacks from a flat baseline. | "wiggle" | "silhouette" | "zero" | "wiggle" |
formatValue | (value: number, series: StreamgraphSeries) => string | — |
hiddenSeriesControlled hidden layer keys. A hidden layer thins to nothing and the rest reflow. | string[] | — |
defaultHiddenSeries | string[] | — |
onHiddenSeriesChange | (hidden: string[]) => void | — |
onActiveChangeCalled as the reading moves, and with nulls when it leaves. | (index: number | null, seriesKey: string | null) => void | — |
legendLayer toggles above the plot. | boolean | true |
directLabelsNames each layer inside its widest stretch when it is thick enough to hold the text. | boolean | true |
categoryLabelHeader of the first column in the screen reader table. | string | "Date" |
emptyLabel | string | "No data for this range" |
ref | Ref<HTMLElement> | — |
className | string | — |