Skip to content
Alea0.1

Charts

Sparkline and Gauge

A tiny trend line for tables and stat cards, and a half-circle meter for one measure.

Ant Design: Tiny charts, Gauge

import { Sparkline, Gauge } from '@alea/ui';

Examples

Sparklines and gauges

Small trends for stat cards, and a meter for one score.

Visits

9,612

Errors

23

92Accessibility score
64%Storage used

In a table

Sparklines next to the numbers they summarize.

Plugin
Users
Last 7 days
Contrast Checker3,410
Palette Generator1,240
Type Scale860

Props

Sparkline props

A tiny trend line for tables and stat cards (MUI SparkLineChart, Mantine Sparkline).

PropTypeDefaultDescription
labelrequiredstring-What it shows, read by screen readers ("Visits, last 14 days").
valuesrequirednumber[]-The numbers, oldest first.
colorstring'var(--alea-chart-1)'Line or bar color. Default the first chart color.
heightnumber32Height in px. Default 32.
type"area" | "line" | "bar"'line'line (default), area or bar.
widthnumber120Width in px. Default 120.

Gauge props

A half-circle meter for a single measure: score, load, quota (MUI Gauge, Mantine SemiCircleProgress).

PropTypeDefaultDescription
labelrequiredstring-The visible label under the number.
valuerequirednumber-The current value.
maxnumber100The top of the scale. Default 100.
minnumber0The bottom of the scale. Default 0.
sizenumber200Width in px. Default 200.
thresholds{ upTo: number; tone: "danger" | "success" | "warning" | "accent"; }[]-Colors by range: [{ upTo: 60, tone: 'success' }, ...].
valueFormat((v: number) => string)-Formats the number in the middle, e.g. v => `${v}%`.

Accessibility

  • Sparkline is an image named with the trend; Gauge is a meter with its value.

Do and don't

Do

  • Pair a sparkline with the current number (Statistic).
  • Use the same scale for sparklines you compare.

Don't

  • Don't add axes or tooltips: use LineChart for that.
  • Don't use a gauge for values without a meaningful maximum.
Tested with axe, keyboard and screen reader roles