Charts
Area chart
Trends with soft gradient areas.
Usage
AreaChart draws a gradient that fades to transparent under each line. Pass the records, the key of the x value (index) and the series to plot. Colours come from CSS variables, so the chart follows theme, dark mode and accent with no re-render.
| date | Desktop | Mobile |
|---|---|---|
| Apr 1 | 320 | 260 |
| Apr 2 | 334 | 268 |
| Apr 3 | 348 | 273 |
| Apr 4 | 361 | 276 |
| Apr 5 | 293 | 307 |
| Apr 6 | 305 | 305 |
| Apr 7 | 395 | 271 |
| Apr 8 | 404 | 265 |
| Apr 9 | 411 | 258 |
| Apr 10 | 417 | 249 |
| Apr 11 | 421 | 239 |
| Apr 12 | 343 | 260 |
| Apr 13 | 343 | 250 |
| Apr 14 | 422 | 211 |
| Apr 15 | 419 | 203 |
| Apr 16 | 414 | 196 |
| Apr 17 | 407 | 191 |
| Apr 18 | 399 | 189 |
| Apr 19 | 310 | 218 |
| Apr 20 | 300 | 220 |
| Apr 21 | 369 | 194 |
| Apr 22 | 358 | 201 |
| Apr 23 | 346 | 210 |
| Apr 24 | 335 | 220 |
| Apr 25 | 323 | 233 |
| Apr 26 | 232 | 276 |
| Apr 27 | 222 | 290 |
| Apr 28 | 293 | 274 |
| Apr 29 | 285 | 287 |
| Apr 30 | 279 | 301 |
| May 1 | 274 | 312 |
| May 2 | 271 | 323 |
| May 3 | 189 | 361 |
| May 4 | 190 | 367 |
| May 5 | 272 | 341 |
| May 6 | 276 | 343 |
| May 7 | 281 | 342 |
| May 8 | 289 | 339 |
| May 9 | 298 | 334 |
| May 10 | 228 | 357 |
| May 11 | 240 | 349 |
| May 12 | 332 | 309 |
| May 13 | 345 | 300 |
| May 14 | 359 | 290 |
| May 15 | 373 | 280 |
| May 16 | 387 | 272 |
| May 17 | 321 | 295 |
| May 18 | 334 | 289 |
| May 19 | 426 | 255 |
| May 20 | 438 | 254 |
| May 21 | 448 | 255 |
| May 22 | 457 | 258 |
| May 23 | 464 | 264 |
| May 24 | 390 | 302 |
| May 25 | 394 | 312 |
| May 26 | 476 | 293 |
| May 27 | 476 | 306 |
| May 28 | 475 | 320 |
| May 29 | 471 | 334 |
| May 30 | 466 | 348 |
| May 31 | 380 | 391 |
| Jun 1 | 372 | 404 |
| Jun 2 | 443 | 385 |
| Jun 3 | 433 | 394 |
| Jun 4 | 422 | 401 |
| Jun 5 | 410 | 406 |
| Jun 6 | 399 | 408 |
| Jun 7 | 307 | 439 |
| Jun 8 | 296 | 436 |
| Jun 9 | 365 | 402 |
| Jun 10 | 355 | 396 |
| Jun 11 | 346 | 388 |
| Jun 12 | 338 | 379 |
| Jun 13 | 332 | 370 |
| Jun 14 | 247 | 390 |
| Jun 15 | 244 | 380 |
| Jun 16 | 322 | 341 |
| Jun 17 | 322 | 333 |
| Jun 18 | 325 | 327 |
| Jun 19 | 329 | 323 |
| Jun 20 | 334 | 320 |
| Jun 21 | 262 | 350 |
| Jun 22 | 271 | 353 |
| Jun 23 | 361 | 327 |
| Jun 24 | 373 | 334 |
| Jun 25 | 385 | 343 |
| Jun 26 | 398 | 354 |
| Jun 27 | 412 | 367 |
| Jun 28 | 346 | 410 |
| Jun 29 | 360 | 424 |
When to use
- A trend over time where the volume under the line matters (traffic, revenue, usage).
- Two or three overlaid series, or a stacked composition of one total.
Not for: exact comparisons between categories (use a bar chart) or many overlapping series (use a line chart).
Stacked
Set stacked to pile the series on top of each other. The tooltip still shows each series on its own, and the top edge is the total.
| month | Enterprise | Team | Starter |
|---|---|---|---|
| Jan | $12,400 | $7,800 | $4,200 |
| Feb | $13,900 | $8,100 | $4,350 |
| Mar | $14,200 | $8,900 | $4,600 |
| Apr | $16,800 | $9,600 | $4,550 |
| May | $18,100 | $10,300 | $4,900 |
| Jun | $21,500 | $11,200 | $5,100 |
API
AreaChart
| Prop | Type | Default | Description |
|---|---|---|---|
| data | Record<string, unknown>[] | — | One record per x position. |
| index | string | — | Key of the x value in each record. |
| series | { key, label?, color? }[] | — | Series to plot. color is 'series-1'…'series-6' or any CSS colour. |
| stacked | boolean | false | Stack the series instead of overlaying them. |
| curve | 'monotone' | 'linear' | 'step' | 'monotone' | Monotone never overshoots the data. |
| height | number | 280 | Plot height in px. The width fills the parent. |
| valueFormat | 'number' | 'currency' | 'percent' | 'compact' | Intl options | (n) => string | 'number' | Formats tooltip values; axis ticks use a compact form. |
| indexFormat | (value, i) => string | — | Formats the x value in the axis, tooltip and data table. |
| xAxis / yAxis | boolean | options | true | yAxis options: format, ticks, width, domain. xAxis options: format. |
| grid | boolean | 'horizontal' | 'vertical' | 'both' | true | Dashed grid; true means horizontal lines. |
| legend | 'top' | 'bottom' | false | bottom when there are 2+ series | Legend items toggle their series. |
| tooltip | boolean | { labelFormat } | true | Crosshair, dots and a readout. |
| animate | boolean | true | Draw-in on mount and smooth transitions between data. |
Keyboard
| Key | Action |
|---|---|
| Tab | Focuses the chart. |
| ← / → | Moves the active point; the readout is announced. |
| Home / End | Jumps to the first or last point. |
| Esc | Clears the active point. |
Accessibility
- The svg is role="img" with a generated summary (override with aria-label).
- A visually hidden table lists every value, so screen readers can read the data.
- Touch scrubs horizontally while vertical swipes still scroll the page.
- Series are told apart by position in the legend and tooltip as well as colour.
Motion
- On mount the line draws in and the area fades up (600ms, ease-out). Nothing animates during server render.
- The crosshair and dots glide between points; the tooltip follows the pointer and flips at the edge.
- Changing data eases the values over 450ms.
- Reduced motion: no draw-in, no glide; the state still changes.