Skip to content

Area Trend Card

A card for a total made of parts over time: a headline with its change, a period menu, a soft-gradient area chart and a legend with each part's total. Point at a part and the headline becomes its total.

On this page
Used for
  • Runs, spend or tokens split by agent, model or team over a week, a month or a year
  • A dashboard card whose total is made of parts
  • The share each part holds over time, in percent mode

Examples

Curve

Overlap

Percent

Installation

npx knowns-ui@latest add area-trend-card
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

Props

title / icon
string / ReactNode
Defaultrequired / -
The label above the headline and an optional 16px mark before it.
data / x / seriesrequired
ChartDatum[] / string / ChartSeries[]
One row per point on the x axis, the key of its label, and the parts.
mode
"stacked" | "overlap" | "percent"
Default"stacked"
Add the parts up, draw each from the baseline, or show each one's share of the whole.
curve
"smooth" | "linear"
Default"smooth"
A monotone curve that never dips below the baseline, or straight segments.
periods / period / defaultPeriod / onPeriodChange
AreaTrendPeriod[] / string
The dropdown. The card does not own the data: swap `data` when a period is picked.
delta / goodWhen
number / "up" | "down"
Default - / "up"
The change as a fraction (0.082 is +8.2%) and which way is good news.
unit / format / headlineFormat / formatX
string / functions
Defaultcompact
The thing counted, and how values and categories read.
height / chartLabel
number / string
Default200 / title
Plot height and the chart's name for assistive tech.
Motion
280 ms in-out
A period change tweens the areas and rolls the headline. Hover dims by opacity in 120 ms. Nothing plays on first render or with reduced motion.

What it handles

  1. 01Shows a headline total with its change, and swaps the headline to a series' total when you point at its band or line, or at its entry in the legend, with the digits rolling.
  2. 02Draws the parts stacked, overlaid, or as each one's share of the whole, with a soft gradient under each line.
  3. 03Takes its data from you: a period pick calls onPeriodChange and you pass the new rows; the chart tweens to them.
  4. 04Turns the change green when it moves the good way, with goodWhen="down" for cost and errors.
  5. 05Reads out the headline and the focused series to a screen reader, and keeps the chart's own keyboard tooltip and data table.

States

Point at a band, a line or a legend entry
The other series dim, the headline rolls to that series' total, the change hides
120ms dim, 280ms roll
Period change
The areas tween to the new rows and the headline rolls to the new total
280ms, ease in-out
First render
Nothing plays
none
Reduced motion
Every change lands at once
0ms

Works with

When to use

When to use

  • A dashboard card for a total made of parts over time: runs by agent, spend by model, tokens by team.
  • The share each part holds over a week, a month or a year, with the headline following the part you point at.

When not to use

  • A bare chart with no headline or period menu: use Chart.
  • Status day by day for one service: use Uptime Bar.
  • A total and where it happens on two axes: use Heatmap Card.

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Area Trend Card to my app and wire it to my own data.
  • I need a dashboard card for a total made of parts over time: runs by agent, spend by model, tokens by team. Set that up with the Knowns UI Area Trend Card.
  • Which Area Trend Card props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "area-trend-card" }) and search_docs({ query: "area trend card" }).

Need help?

Stuck on Area Trend Card, or found something off? We read every message.