Skip to content
Browse docs and components

Line Chart

line-chart

One or more series over an ordered axis on TanStack Charts, as smooth lines or as areas that fade to their baseline. A dashed cursor snaps to the nearest x from anywhere in the plot, the tooltip lists every series there, and areas can stack.

Responsive

Install

$npxshadcnadd@forme/line-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.

LineChart

One or more series over an ordered axis, as lines or as areas that fade to their baseline.

PropTypeDefaultDescription
data*readonly Row[]—
index*keyof Row & string—The field along the x axis: a month, a date, a release.
series*readonly LineChartSeries<Row>[]—Up to eight. Colours are assigned from --chart-1 onward, in this order.
label*string—Accessible name. Say what is measured and over what period.
variant"line" | "area""line"area fills each line down to zero with a fading gradient.
stackedbooleanfalsestacked piles the areas so the top edge is the total. Area variant only.
curve"monotone" | "linear" | "step""monotone"
dotsbooleanfalseA dot on every point, not only the focused one.
formatValue(value: number) => stringplain
heightnumber260
classNamestring—