Skip to content
Browse docs and components

Area Chart

area-chart

A line or area chart in plain SVG with no chart library. A crosshair snaps to the nearest point and lists every series, arrow keys walk it, round tick values, a legend from two series up, and a hidden table so screen readers get the numbers.

Responsive

Install

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

AreaChart

A line or area chart in plain SVG, sized to its container.

PropTypeDefaultDescription
data*readonly Row[]—
index*keyof Row & string—The field that labels the x axis: a date, a month, a version.
series*readonly ChartSeries<Row>[]—Up to eight. Colours are assigned from --chart-1 onward, in this order.
label*string—Accessible name, and the caption of the table view.
variant"area" | "line""area"area puts a 10% wash under each line; line is the line alone.
heightnumber240
formatValue(value: number) => string(value) => value.toLocaleString("en-US")
classNamestring—