Skip to content
WunderUI

Area Chart

Pro

Area chart for volumes over time: gradients, steps, ranges, a horizon graph, differences and target lines.

Playground

Area Charts

Area chart, 12 points from Jan to Dec. Revenue from 32k to 58k, lowest 32k, highest 58k; Expenses from 18k to 35k, lowest 18k, highest 38k.
Area Charts, data table
monthRevenueExpenses
Jan32k18k
Feb41k22k
Mar38k27k
Apr47k24k
May44k30k
Jun52k28k
Jul49k34k
Aug55k31k
Sep51k36k
Oct46k33k
Nov53k38k
Dec58k35k

Installation

Area Chart comes with WunderUI Core and Pro, in the package from your plan. See the plans.

The charts live in their own entry point: import the chart, its card and its hooks from @wunderui/react/charts, not from @wunderui/react.

Then import what you need:

tsx
import {
  AreaChart,
  AreaChartProps,
  AreaChartVariant,
} from "@wunderui/react/charts"

Then use it:

tsx
import { AreaChart } from "@wunderui/react/charts"

const data = [
  { month: "Jan", revenue: 32000 },
  { month: "Feb", revenue: 41000 },
  { month: "Mar", revenue: 38000 },
  { month: "Apr", revenue: 47000 },
]

export function RevenueArea() {
  return <AreaChart data={data} index="month" series={[{ key: "revenue", label: "Revenue" }]} label="Revenue" />
}

Expected result: You should see one filled area over a grid that starts at 0, with the months below. Hovering shows a crosshair and a tooltip.

When to use

Use Area Chart for

  • Volumes over time, where the filled area carries the message
  • A total made of overlapping series (requests, sessions)
  • A band around a value (a range of temperatures), or the gap between two series
  • Several signals stacked as horizon rows

Use something else for

  • Line Chart for exact values and many series that would hide each other
  • Stacked Chart for the parts of a total, stacked on top of each other
  • River Chart for a mix that changes over time, centred on a baseline
  • Sparkline for a small trend without axes

States

Loading, empty and error keep the chart's size, so the card never jumps. Add a retry handler and the error state offers a Try again button.

Area Charts

Area chart, 12 points from Jan to Dec. Revenue from 32k to 58k, lowest 32k, highest 58k; Expenses from 18k to 35k, lowest 18k, highest 38k.
Area Charts, data table
monthRevenueExpenses
Jan32k18k
Feb41k22k
Mar38k27k
Apr47k24k
May44k30k
Jun52k28k
Jul49k34k
Aug55k31k
Sep51k36k
Oct46k33k
Nov53k38k
Dec58k35k

Table view

Every chart carries a table of its data for screen readers. A ChartCard can show it on screen too, with a toggle in the header.

Revenue

Area chart, 12 points from Jan to Dec. Revenue from 32k to 58k, lowest 32k, highest 58k; Expenses from 18k to 35k, lowest 18k, highest 38k.
Revenue and expenses, data table
monthRevenueExpenses
Jan32k18k
Feb41k22k
Mar38k27k
Apr47k24k
May44k30k
Jun52k28k
Jul49k34k
Aug55k31k
Sep51k36k
Oct46k33k
Nov53k38k
Dec58k35k

Keyboard interactions

The plot is focusable, so the chart works without a pointer.

TaborShiftTab
Moves focus to the plot and away from it. The plot is one tab stop; so is every legend badge.
ArrowRightorArrowLeft
Moves to the next or previous point. The tooltip follows, and a live region announces the one you are on. The first press starts at the first one (Left: the last one).
HomeorEnd
Jumps to the first or last point.
ShiftArrowRightorShiftArrowLeft
Extends a selected range from the point you started on. A range is only selected when is set.
Escape
Clears the active point and the selected range.
EnterorSpace
On a legend badge of a ChartCard: switches its series off or on. The last visible series stays on.

Behavior and motion

What the chart does on its own and what the page decides.

Variants set the fill
The variant picks the fill, the curve (smooth or step) and the layers (band, target line, difference, threshold). A separate curve setting overrides the outline.
Order
Overlapping series are drawn in series order, so the first one sits at the back. Put the largest first.
Baseline
Areas are clipped to the plot and never draw below the baseline, even on a smooth curve.
Horizon graph
The horizon graph gives each series its own row and folds values into bands of deepening shade: positive in the series colour, negative in red.
Loading, empty and error
The chart keeps its size while it loads, is empty or fails, so the card never jumps. Loading shows a skeleton; error adds a Try again button when a retry handler is set.
Legend
A ChartCard shows series as badges. With two or more series each badge switches its series off, the last visible one stays on, and a legend of roles can be made static.
Data table
The chart also renders its data as a table for screen readers, in plot order. A ChartCard can show that table on screen through a toggle that keeps the card height.
Size
The chart fills its container's width; you set the plot height. Text never scales: labels keep their size at every width.

Motion

The enter sequence and the hover follow the motion tokens of the library.

Wipe
Areas wipe in from the left and outlines draw along their path the first time the chart is in view, and again after loading or when new data arrives.
Hover
The crosshair and the ringed points glide from point to point. The horizon graph has no crosshair.
Reduced motion
With reduced motion on, the enter sequence is off and the chart appears at once. Tooltip, crosshair and every state still work.

Anatomy

AreaChart fills the space under a line so the amount reads at a glance. Variants cover solid and gradient fills, overlaps, a positive and negative split, bands, horizon rows and a target line.

Revenue

Area chart, 12 points from Jan to Dec. Revenue from 32k to 58k, lowest 32k, highest 58k; Expenses from 18k to 35k, lowest 18k, highest 38k.
Revenue and expenses, data table
monthRevenueExpenses
Jan32k18k
Feb41k22k
Mar38k27k
Apr47k24k
May44k30k
Jun52k28k
Jul49k34k
Aug55k31k
Sep51k36k
Oct46k33k
Nov53k38k
Dec58k35k
  • Takes data, an index and series. You can pick smooth, straight or step outlines, change the fill opacity, and mark series that skip the fill or the outline.

  • data-slot="chart-plot"

    The focusable region. Arrow keys walk the points, Shift with an arrow or a drag selects a range, Escape clears it, and hover shows a crosshair and one point per series (not on the horizon graph).

  • data-slot="chart-grid"

    Grid lines from 0 and the same axis rules as other cartesian charts. Areas are clipped to the plot and never draw below the baseline, even on smooth curves.

  • data-slot="chart-marks"

    A fill per series (solid, gradient, reversed gradient or light tint) with a thin outline on top. Overlapping series draw in order, so the first sits at the back.

  • data-slot="chart-horizon"Optional

    The horizon layout: each series gets its own row and values fold into bands of deepening shade, positive in the series colour and negative in red.

  • Optional

    The range band between lower and upper values, the split fill and threshold label of the positive-negative area, and the dashed target series of the target-line area.

  • data-slot="chart-tooltip"Optional

    Category title and one row per visible series, with the change against the previous point on the first series.

  • data-slot="chart-message"Optional

    Loading shows a muted skeleton shaped like the data; empty and error replace the plot with a message.

  • The data as a screen-reader table with a live region for the active point.

Best practices

  • Do

    Overlap at most two series, and give the back one the lighter fill. A third filled area covers the others and makes the lower values unreadable.

  • Do

    For positive and negative values use the positive-negative area with a threshold, not a single colour. The split at the baseline shows which side the value is on without reading the axis.

  • Do

    Use the horizon graph when many series share a short row height, for example 12 services in one card. Mention the fold count in the description, since the bands are not on a shared scale.

  • Don’t

    Don't use a gradient fill to encode data. The fade is decoration; the outline and the tooltip carry the value.

  • Don’t

    Don't stack unrelated series in one plot. For parts of a whole use StackedChart, whose stacking is explicit, instead of areas that merely overlap.

API reference

One table for AreaChart. It is a plain component, so the table lists every prop; the ChartCard around it takes its own props, and the chart works without one.

Takes data, an index and series. You can pick smooth, straight or step outlines, change the fill opacity, and mark series that skip the fill or the outline.

PropTypeDefaultDescription
data requiredreadonly ChartDatum[]—One object per category / point.
index requiredstring—Field holding the category label (x axis; y axis for horizontal bars).
series requiredreadonly ChartSeries[]—The series to draw, in order.
variant"basic-area" | "gradient-area" | "gradient-reverse-area" | "stroke-area" | "dashed-area" | "step-area" | "smooth-area" | "overlap-area" | "positive-negative-area" | "range-area" | "horizon-graph" | "area-with-target-line" | "difference-area" | "area-line-overlay""basic-area"Figma variant. Default .
valueFormatterChartValueFormatter—Values in tooltip, labels, table and live region. Default: 42000 → "42k".
labelstring—Accessible name, e.g. the card title.
heightnumber—Height of the plot frame in px. Default 434 = the plot of the Figma large card.
state"ready" | "loading" | "empty" | "error"— shows the chart-shaped skeleton, and a message in the plot.
hiddenSeriesreadonly string[]—Series keys that are switched off (legend toggle): drawn faded, dimmed in the tooltip.
curve"linear" | "smooth" | "step"—Override the variant's curve: straight, monotone smooth or step.
range{ lower: string; upper: string; label?: string }—: the min/max band (fields in each datum) drawn behind the line.
thresholdnumber0: the value the area is split at (default 0).
activeIndexnumber | null—The active point (hovered or focused) as an index into , to control it yourself. shows none.
animateboolean—Enter sequence (draw, wipe, grow) on scroll into view, after loading and on new data. Default true; off with reduced motion.
animationKeystring | number—Change it to play the enter sequence again (e.g. ). New replays it by itself.
axisFormatterChartValueFormatter—Value-axis labels; defaults to .
categoryAxisboolean—Category-axis labels (default true).
categoryFormatter(label) => string—Shortens category labels on the axis, e.g. "Mar 12" → "Mar"; tooltip and pill keep the full label.
categoryTicksreadonly string[]—Only these category labels are shown on the axis (the rest stay hoverable).
defaultActiveIndexnumber | null—The point that is active at first, for an uncontrolled chart. It shows the tooltip without a pointer.
defaultSelectedRangeChartRange | null—The range that is selected at first, for an uncontrolled chart.
descriptionstring—Screen-reader summary; generated from the data when omitted.
emptyDescriptionstring—Text under the title in the empty state.
emptyTitlestring—Title of the message in the empty state.
errorDescriptionstring—Text under the title in the error state.
errorTitlestring—Title of the message in the error state.
fillOnlyreadonly string[]—Series drawn as a fill only (no outline).
fillOpacitynumber—Opacity of solid fills / top of gradient fills (0…1); each variant has its default.
gridboolean—Grid lines (default true).
gridIntervalsnumber—Number of equal grid intervals (default 6 = 7 grid lines like the Figma cards).
gridStyle"solid" | "dashed"— draws the grid lines 4 / 4 dashed (dense dashboards).
horizonBandsnumber2: number of folded bands per row (default 2).
includeZeroboolean—The value axis starts at 0 (owner rule, default). fits the data (prices, temperatures).
lineOnlyreadonly string[]—Series drawn as a line only (no fill), e.g. a benchmark.
onActiveIndexChange(index) => void—Called with the index when the pointer or the arrow keys move to another point, and with when they leave. Use it to show the hovered value in a headline.
onRetry() => void—Shows a Try again button in the error state and calls this when it is pressed.
onSelectedRangeChange(range) => void—Called when a drag across the plot or Shift with an arrow key changes the range, and with when Escape or a click clears it.
rangeSelectableboolean—Allow selecting a range by dragging or Shift + arrow keys. On when is set.
selectedRangeChartRange | null—The selected range as inclusive indices into , to control it yourself. selects nothing.
thresholdLabelstring—
tooltipboolean—Tooltip on hover / keyboard focus. Default true.
tooltipTitle(datum, index) => ReactNode—Title line of the tooltip; defaults to the category label.
valueAxisboolean—Value-axis labels (default true). Off for compact cards and sparkline-like plots.
valueAxisSide"left" | "right"—Side of the value axis (vertical charts). is the price axis of trading charts.
valueDomainreadonly [number, number]—Fix the value domain instead of fitting it to the data (still rounded to nice steps).
valueTicksreadonly number[]—Exact value-axis ticks (ascending), e.g. [0, 10000, … 70000]; replaces the nice-step domain.
widthnumber—Fixed width instead of filling and measuring the container.

Notes for AI

Give your coding assistant the Markdown reference instead of screenshots.

MCPget_component("area-chart")
InstallIncluded in Core and Pro

The full library index for assistants is at /llms.txt.