Area Chart

Charts

Highlights magnitude under a trend line.

Area charts pair a trend line with a filled region, making volume and cumulative change easy to read. The fill fades from the series color to transparent via an SVG linear gradient.

npx shadcn@latest add area-chart

Default

Subscriber growth with a gradient fill.

Preview
Live
tsx
1<AreaChart data={subscribersByMonth} xKey="month" yKey="subscribers" height={220} />

Custom

A flat fill (no gradient) in a different color.

Preview
Live
tsx
1<AreaChart
2 data={activeUsersByHour}
3 xKey="hour"
4 yKey="users"
5 color="var(--color-chart-4)"
6 height={220}
7 gradient={false}
8/>

API reference

All props of the underlying Base UI primitive are forwarded. The table below documents the Shelf-specific props.

PropTypeDescription
dataRecord<string, unknown>[]The data rows to plot.
xKeystringThe key used for the horizontal axis.
yKeystringThe key used for the area values.
colorstring= "var(--color-primary)"The stroke and gradient base color.
heightnumber= 240The chart height in pixels.
gradientboolean= trueWhether the fill fades from the series color to transparent.