Area Chart
Show how one or several measures change over time as filled areas, overlaid or stacked.
An area chart shows how one or several measures change over time, with the space between each line and 0 filled, so the size of a measure reads at a glance. Stack the areas to show how parts add up to a total. Hover the plot to read every series at the nearest point, or focus it and step through the points with the arrow keys; the card trails beside the crosshair.
Installation
pnpm dlx shadcn@4.18.0 add @siteplane/area-chartComplete the one-time setup first. Registry JSON lists source files and dependencies.
For this page’s examples, also install:
pnpm dlx shadcn@4.18.0 add @siteplane/card @siteplane/toggle-groupUsage
import { AreaChart } from "@/siteplane/components/area-chart";
<AreaChart
label="Page views by month"
data={[
{ month: "Jan", views: 18200 },
{ month: "Feb", views: 21400 },
{ month: "Mar", views: 19800 },
]}
x="month"
series={[{ key: "views", label: "Page views" }]}
/>;x names the key of the x value in each row, and each series names the key of its numbers.
Stacked
Set stacked to stack the areas in the order of series, the first at the bottom, so the top of the stack shows the total. The tooltip shows each series’ own value, not the running sum. A series that names no color takes a shade of the brand color, from strong to light, spread over the number of series.
- Search
- Direct
- Referral
Fill
fill sets how an area is filled: the default gradient fades the series color out toward the base of the area, downward above 0 and upward below it, and solid fills it with a flat tint. Either way, a line runs along the top of each area.
gradient (default)
solid
Curves
curve takes the same four curves as the Line Chart: monotone, smooth, linear and step. monotone, the default, never swings past the data, so an area that rests on 0, such as build minutes that stop between busy hours, stays on 0. smooth is a natural spline that bends evenly and can swing a little past the data between two points.
Negative values
An area fills between its line and 0, so values below 0 fill downward, and the value axis reaches below 0 to take them in. Stacked, the positive values stack up from 0 and the negative values down. The gradient is strongest at the edge away from 0 and fades toward the 0 line on both sides, so an area below 0 reads as the mirror of one above it.
- New
- Reactivated
- Churned
Fill height
With height="fill", the chart is as tall as its box, which takes its height from the container: a flex item that grows, a grid cell, or a box with a height of its own. The chart never goes lower than minHeight, 240 px by default, and keeps that height until it has measured its box, on the server too. Its own content never makes the box taller, so a card can hand the chart whatever room the rest of the card leaves. Here the grid row is as tall as the list beside the chart, and the chart fills the room its card leaves in that row. The Bar Chart fills its box the same way.
- /96.4K
- /pricing42.1K
- /docs38.7K
- /docs/installation21.5K
- /blog17.9K
- /changelog12.3K
- /about6.8K
- /contact3.2K
Changing data
New data glides in: the areas morph to it, whatever its length, and the value axis moves with them. Axis labels fade through, the old ones out before the new ones in. A series with a gap or a single point, and a change in the number of series, show at once.
- Direct
- Search
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
Area | readonly ChartDatum[] | required | Rows of the chart: an x value and one number per series. |
Area | string | required | Key of the x value in each row: category text, or a Date for a time axis. |
Area | readonly ChartSeries[] | required | The series to draw, in order. |
Area | string | required | Accessible name of the chart. |
Area | string | unset | Id of an element that describes the chart, read after the summary of the data that the chart gives screen readers. |
Area | monotone | smooth | linear | step | monotone | How the points are joined: monotone bends through every point and never swings past the data, smooth is a natural spline that can swing a little past the data between two points, linear draws straight segments and step holds each value until the middle between two points. |
Area | boolean | false | Stacks the areas on each other in the order of series: positive values up from 0, negative values down. |
Area | gradient | solid | gradient | gradient fades the series color out toward the base of the area, downward above 0 and upward below it; solid fills it with a flat tint. |
Area | number | fill | 240 | Height of the chart in pixels, the legend included, or fill to take the height of its box down to minHeight; the width follows the container. |
Area | number | 240 | With height fill, the least height of the chart in pixels, the legend included. |
Area | brand | categorical | brand | brand shades the brand color from strong to light; categorical gives each series its own chart color. A series’ own color wins either way. |
Area | boolean | true with more than one series | Lists the series below the plot. |
Area | boolean | true | Grid lines at the value axis ticks. |
Area | boolean | true | Labels along the x axis. |
Area | boolean | true | Labels along the value axis. |
Area | (value: number) => string | locale number (1,234.5); compact on the axis (1.2K) | Formats values in the tooltip and on the value axis. |
Area | (value: ChartXValue) => string | text as given; a date as Jan 5, and Jan 5, 2026 in the tooltip | Formats x values on the axis and in the tooltip heading. |
Area | string | en-US | Locale of numbers and dates. |
Area | string | No data | Shown in place of the marks when there is nothing to draw. |
Area | Partial<CartesianChartLabels> | English words | Replaces the words that the chart gives screen readers, each one on its own. Pass their translation when the application is in another language. |
Area | string | unset | Additional classes. |
Chart | string | required | Key of the numbers of this series in each row. |
Chart | string | required | Name shown in the legend and the tooltip. |
Chart | string | palette color | A CSS color, such as var(--chart-3), that replaces the palette color of this series. |
Cartesian | string | chart | What screen readers call the chart. |
Cartesian | string | Use the arrow keys to move between data points. | Read after the description of the chart while it is a focus stop. An empty text leaves the hint out. |
Cartesian | string | to | Joins the first and the last x value in the summary of the data, as in Jan to Jun. |
Cartesian | string | lowest | Comes before the lowest value of each series in the summary. |
Cartesian | string | highest | Comes before the highest value of each series in the summary. |
AreaChartProps exports this contract. ChartDatum, ChartSeries, ChartXValue,
ChartCurve, ChartPalette and CartesianChartLabels come from the chart core,
@/siteplane/components/chart, which installs with the chart. The chart renders
a figure with the plot and, for several series, a legend; it takes no native
props or ref beyond className and aria-describedby. The categorical palette
has eight chart colors and the brand palette spreads up to eight shades, and
both repeat after the eighth series.
Usage notes
Use an area chart when the size of a measure over time matters, or, stacked, how its parts add up to a total. Areas that overlap can hide each other: stack them, or use a Line Chart for several series that are not parts of one whole. When the categories have no order, such as countries, use a Bar Chart. The axis gives a rough scale and the tooltip one point at a time, so show a Table when readers need exact values. Several series share one value axis, which always includes 0; there is no second axis.
A missing value (null, undefined or anything that is not a number) breaks the area at that point and leaves the series out of the tooltip there; in a stack it adds nothing. A point on its own is drawn as a dot. Date values on the x axis are written in UTC, so use dates at midnight UTC for days. Text values are categories, shown in the order given.
The plot is one focus stop. On hover, focus or tap, the nearest x position becomes the active item, and the chart shows:
- a hairline crosshair;
- a dot per series that glides to it;
- an inverse label on the axis that names the item;
- the tooltip card beside the crosshair, trailing it. The card’s values roll to the new ones.
The rest of the chart steps back slightly: the areas go to 90%, and the stretch of their outline around the active point stays at full strength. The legend is on by default when there is more than one series, and sits below the plot. A mouse over an entry steps the other series back; the legend does not toggle series, and the chart has no click or selection API.
Left and Right arrow keys step through the x positions, Home and End jump to the ends, and Escape closes the tooltip. Keyboard focus starts at the first x position. A tap or pen press pins the item until the next press elsewhere or Escape. Screen readers meet the plot as a chart named by label. Its description sums up the data with the first and the last x value and the lowest and the highest value of each series; a chart with no value is described by emptyLabel. While the chart is a focus stop, a hint that the arrow keys move between the data points follows the description. labels replaces these words and the role description, for example with their translation. While the keyboard or a tap moves between the items, a polite live region reads what the tooltip shows. Each row of the tooltip names its series, so the color never carries the information alone. A chart with no values is not a focus stop.
Everything that moves runs on the Motion tokens: new data glides over --motion-duration-value, and the crosshair, the dots and the axis label follow the active item over --motion-duration-follow, with the card trailing over --motion-duration-follow-trail. All of it is instant under reduced motion: the system setting, html with data-motion-reduce="true" or SiteplaneMotionProvider preset="reduced". The chart draws its plot once it has measured the width of its container. Until then, and in the server HTML, it renders the box of the plot at its full height, the legend and what screen readers read, so nothing on the page moves when the plot appears. The tooltip comes from Tooltip. The chart opens and closes it itself, so it needs no TooltipProvider, which only shares hover delays between tooltips.