Charts
area-chart
A line chart with the space under each line filled flat at low opacity, optionally stacked so the series add up to a total.
When to use it
One series over time whose volume matters, or a few series that add up to a whole (stacked). To compare series that cross each other use line-chart: overlapping fills hide one another.
See it working
The demonstration the browser checks drive, with the keyboard as well as the pointer. More of it is on the Charts page.
Line chart
- Requests
- Errors
| day | Requests | Errors |
|---|---|---|
| Mar 1, 2026 | 120 | 56 |
| Mar 2, 2026 | 180 | 76 |
| Mar 3, 2026 | 150 | 52 |
| Mar 4, 2026 | 210 | 88 |
| Mar 5, 2026 | 260 | 72 |
| Mar 6, 2026 | 240 | 100 |
| Mar 7, 2026 | 300 | 84 |
| Mar 8, 2026 | 280 | 120 |
| Mar 9, 2026 | 340 | 96 |
| Mar 10, 2026 | 390 | 112 |
| Mar 11, 2026 | 370 | 140 |
| Mar 12, 2026 | 430 | 124 |
Area chart, stacked
- Images
- Video
- Audio
| month | Images | Video | Audio |
|---|---|---|---|
| Jan 1, 2026 | 12 | 30 | 6 |
| Feb 1, 2026 | 18 | 42 | 9 |
| Mar 1, 2026 | 22 | 61 | 11 |
| Apr 1, 2026 | 27 | 70 | 16 |
| May 1, 2026 | 35 | 84 | 18 |
Bar chart
- Web
- App
| quarter | Web | App |
|---|---|---|
| Q1 | 320 | 210 |
| Q2 | 410 | 290 |
| Q3 | 380 | 350 |
| Q4 | 460 | 420 |
Donut chart
| source | visits | Share |
|---|---|---|
| Search | 5,200 | 49% |
| Direct | 3,100 | 29% |
| Referral | 1,400 | 13% |
| Social | 900 | 8% |
- Search5,200 · 49%
- Direct3,100 · 29%
- Referral1,400 · 13%
- Social900 · 8%
Heatmap
| day | 09 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
|---|---|---|---|---|---|---|---|---|
| Mon | 6 | 11 | 16 | 21 | 26 | 8 | 13 | 18 |
| Tue | 13 | 19 | 25 | 8 | 14 | 20 | 26 | 9 |
| Wed | 20 | 27 | 11 | 18 | 25 | 9 | 16 | 23 |
| Thu | 27 | 12 | 20 | 28 | 13 | 21 | 6 | 14 |
| Fri | 11 | 20 | 6 | 15 | 24 | 10 | 19 | 28 |
Radial progress, sparkline, stat
72%Storage used
Signups
1,204
+12%than last week
Add it
npx shadcn@latest add @rivier-ui/area-chartThe registry is named once in components.json: see Installation.
Example
Import it from @/components/viz/area-chart.
<AreaChart
label="Storage used per month, by kind"
data={[
{ month: new Date("2026-01-01"), images: 12, video: 30 },
{ month: new Date("2026-02-01"), images: 18, video: 42 },
{ month: new Date("2026-03-01"), images: 22, video: 61 },
]}
x="month"
series={[
{ key: "images", label: "Images" },
{ key: "video", label: "Video" },
]}
stacked
/>What it needs
Plain markup: it can stay a server component. No packages beyond React.
It imports
Source
The whole file. Once copied it is yours: the registry item holds the same text.
/**
* @name area-chart
* @category viz
* @description A line chart with the space under each line filled flat at low opacity, optionally stacked so the series add up to a total.
* @when One series over time whose volume matters, or a few series that add up to a whole (`stacked`). To compare series that cross each other use line-chart: overlapping fills hide one another.
* @example
* <AreaChart
* label="Storage used per month, by kind"
* data={[
* { month: new Date("2026-01-01"), images: 12, video: 30 },
* { month: new Date("2026-02-01"), images: 18, video: 42 },
* { month: new Date("2026-03-01"), images: 22, video: 61 },
* ]}
* x="month"
* series={[
* { key: "images", label: "Images" },
* { key: "video", label: "Video" },
* ]}
* stacked
* />
*/
import { SeriesChart, type LineChartProps } from "@/components/viz/line-chart";
export type AreaChartProps<T extends object> = Omit<LineChartProps<T>, "zero"> & {
/** Stack the series so the top edge is their total. Missing values count as zero. */
stacked?: boolean;
};
/** Same contract as LineChart. The y axis always starts at zero, because a fill is read by its height. */
export function AreaChart<T extends object>({ stacked = false, ...props }: AreaChartProps<T>) {
return <SeriesChart {...props} area stacked={stacked} slot="area-chart" />;
}