Skip to content

Data display

Chart

Dependency-free SVG charts that follow the theme: line, area (plain or stacked), bar (single, grouped or stacked), donut and sparkline. Series take the chart-1 to chart-4 colors in a fixed order, starting with the accent. Every chart has a hover and keyboard tooltip, a legend when there are two or more series, a written summary and a hidden data table for screen readers.

On this page

Revenue and expenses

$412,980

Fiscal year 2025

  • Revenue
  • Expenses

Revenue and expenses, 2025
MonthRevenueExpenses
Jan$24.8k$19.2k
Feb$26.2k$20.1k
Mar$29.9k$21.4k
Apr$31.4k$22k
May$30.1k$23.8k
Jun$34.8k$23.1k
Jul$36.9k$24.9k
Aug$35.2k$26.4k
Sep$38.4k$25.2k
Oct$41.2k$27.1k
Nov$39.8k$28.8k
Dec$44.3k$29.6k

Usage

components/ui/chart.tsx
import { AreaChart, BarChart, Donut, LineChart, Sparkline } from "@/components/ui/chart"; <LineChart  title="Monthly revenue"  labels={["Jan", "Feb", "Mar"]}  series={[{ name: "Revenue", color: 1, values: [24800, 26200, 29900] }]}  format="usd"/>

Examples

Overview

Revenue and expenses

$412,980

Fiscal year 2025

  • Revenue
  • Expenses

Revenue and expenses, 2025
MonthRevenueExpenses
Jan$24.8k$19.2k
Feb$26.2k$20.1k
Mar$29.9k$21.4k
Apr$31.4k$22k
May$30.1k$23.8k
Jun$34.8k$23.1k
Jul$36.9k$24.9k
Aug$35.2k$26.4k
Sep$38.4k$25.2k
Oct$41.2k$27.1k
Nov$39.8k$28.8k
Dec$44.3k$29.6k

Line

Up to four series on one y-axis. dots marks every point, which helps with fewer than about 20 points. Focus the chart and use the arrow keys to step through values.

  • p50
  • p95
  • p99

API latency
Dayp50p95p99
Oct 1118ms342ms610ms
Oct 2121ms360ms655ms
Oct 3116ms338ms600ms
Oct 4124ms395ms720ms
Oct 5130ms420ms790ms
Oct 6127ms398ms742ms
Oct 7119ms351ms640ms
Oct 8115ms340ms612ms
Oct 9122ms366ms668ms
Oct 10126ms380ms702ms
Oct 11131ms412ms760ms
Oct 12128ms401ms731ms
Oct 13120ms358ms650ms
Oct 14117ms349ms628ms

Stacked area

stacked shows parts of a whole over time. The tooltip lists each part and the total.

  • Organic
  • Referral
  • Paid

Visits by channel
WeekOrganicReferralPaid
W18.2k3.1k2.4k
W28.6k3.3k2.6k
W39.1k3.2k3.5k
W49.4k3.7k3.3k
W59.9k3.9k2.9k
W610.4k4.1k2.7k
W710.2k4.5k3.1k
W810.9k4.4k3.6k
W911.5k4.8k3.4k
W1012.1k5.1k3.2k

Bar

The single-series shorthand takes values, name and color. Labels thin out on narrow screens; the tooltip always shows the full label.

Bar chart
LabelSignups
Sep 142
Sep 238
Sep 351
Sep 447
Sep 555
Sep 661
Sep 733
Sep 829
Sep 958
Sep 1064
Sep 1170
Sep 1266
Sep 1372
Sep 1441
Sep 1536
Sep 1669
Sep 1775
Sep 1881
Sep 1977
Sep 2084
Sep 2147
Sep 2240
Sep 2379
Sep 2488
Sep 2592
Sep 2686
Sep 2795
Sep 2852
Sep 2948
Sep 30101

Grouped and stacked bars

Pass series for several bars per label: side by side by default, or stacked with a 2 px gap between segments.

  • Europe
  • Americas

Revenue by region
QuarterEuropeAmericas
Q1$141k$182k
Q2$151k$202k
Q3$149k$214k
Q4$172k$236k
  • Starter
  • Team
  • Business

Accounts by plan
MonthStarterTeamBusiness
Jul42021060
Aug45023064
Sep47026071
Oct51028078
Nov53031084
Dec56033592

Donut

Part-to-whole with up to four segments. The legend prints each share (and value with format); hover a segment or legend row to show it in the middle.

  • Team$21.9k45%
  • Business$14.6k30%
  • Starter$8,20017%
  • Add-ons$3,5107%

Sparkline

A tiny trend for table rows and stat tiles. It is decorative on its own; pass labels to get a hover tooltip.

Fernhill Studio$4,200
Quillmark$2,950
Tidewell Logistics$8,120

Props

LineChart and AreaChart

  • labelsrequiredstring[]default: —One label per point (x-axis).
  • seriesrequired{ name: string; color: 1 | 2 | 3 | 4; values: number[] }[]default: —Up to four series.
  • titlestringdefault: —Used in the spoken summary and as the data table caption.
  • indexLabelstringdefault: —Header of the label column in the data table, e.g. "Month".
  • format"number" | "compact" | "percent" | "ms" | "usd" | (v) => stringdefault: "number"Axis and tooltip format. Functions only from client components.
  • heightnumberdefault: 220Height in px; width fills the container.
  • areabooleandefault: false (AreaChart: true)Gradient fill under each line.
  • stackedbooleandefault: falseStack series as areas.
  • curve"linear" | "monotone"default: "linear" (AreaChart: "monotone")Straight segments or a smooth curve that never overshoots.
  • dotsbooleandefault: falseDot on every point.
  • zerobooleandefault: trueStart the y-axis at 0. Set false for values in a narrow band.

BarChart

  • labelsrequiredstring[]default: —One label per bar or group.
  • values / name / colornumber[] / string / 1–4default: —Single-series shorthand.
  • seriesLineSeries[]default: —Two to four series, grouped or stacked.
  • stackedbooleandefault: falseStack series in one bar.
  • title, indexLabel, format, height—default: —As for LineChart (height defaults to 200).

Donut

  • segmentsrequired{ label: string; value: number; color: 1 | 2 | 3 | 4 }[]default: —Up to four parts.
  • titlestringdefault: "Donut chart"Accessible title.
  • centerValue / centerLabelstringdefault: —Shown in the hole when nothing is hovered.
  • formatChartFormatdefault: —Also show each value in the legend.
  • size / thicknessnumberdefault: 140 / 14Diameter and ring width in px.
  • legend"right" | "bottom" | "none"default: "right"Legend placement.

Sparkline and Legend

  • valuesrequirednumber[]default: —Sparkline points.
  • labelsstring[]default: —Enables the hover tooltip.
  • color1 | 2 | 3 | 4default: 1Series color.
  • areabooleandefault: falseSoft fill under the line.
  • heightnumberdefault: 32Height in px.
  • Legend items{ label: string; color: 1 | 2 | 3 | 4 }[]default: —Standalone legend for custom layouts.

Accessibility

  • Each chart is a focusable group with role description "chart" and a generated summary: the range, and for each series where it starts, ends and peaks.
  • A visually hidden table holds every value, so screen reader users can read the data in table mode.
  • With the chart focused, Left and Right arrows step through points, Home and End jump to the ends, and Escape clears; the current values are announced.
  • Series are told apart by legend labels and the tooltip, never by color alone; all text uses text colors, not series colors.
  • Colors come from chart-1 to chart-4 tokens and adapt to the accent and to dark mode; the grid and axes stay recessive.

Was this page helpful?

Updated October 14, 2026 Plinth v1.0

Suggested