Skip to content
ArcadiaDesign
111ms
line: response time
9,100
area: requests
9
bars: deploys
Each sparkline beside its number: a line for a measure, an area for an amount, bars for a count of its own each day.

TSX

A sparkline shows the shape of a trend beside the number it belongs to, in a row, a tile or a table cell: one series, no axis, no grid, no legend and no card. The number gives the size, so the line runs from the series' lowest value to its highest; an area and bars start at zero, because their size is the value.

Reach for it after the number alone, a meter and a table, when the shape is what a person checks. When they need to read a value off the scale, compare series or see the rows, draw a plot: a chart under 240px wide is a sparkline, and one wider that must be read is a Chart.

Anatomy

Line
One stroke of --chart-line-inline, 1.5px: monotone, with round joins and caps, from the series' lowest value at the bottom to its highest at the top. It shows the shape; the number beside it gives the size.
Area
The line and a wash under it, --chart-wash at its highest point fading to nothing at zero, where the area starts.
Bars
One to a row, square, 1px apart, from zero. A zero keeps a 1px sliver and a missing value leaves its place empty.
Size
16px tall in a table or list row, 24px beside a number, 32px in a Stat. It fills its container or takes a fixed width, at least 2px to each row.
Colour
One series, painted chartColor(1) unless its entity owns a slot. Never green or red by its sign: the number beside it says which way it went.
Reading
A dot on the read row, 3px in radius in the series' colour, ringed by --chart-surface as wide as the line; the bars beside a read bar set back to --chart-dim. No card: the number beside it reads the row.

Examples

Sizes

size sets the height: sm in a table or list row, md beside a number, lg in a Stat, where it is the default.

sm: 16px
md: 24px, the default
lg: 32px

In a table

A column of sparklines 16px tall at one fixed width, beside the value and its change in their own columns. In a table the reading stays off: the row's own page holds the plot.

Service
Today
From Sep 8
4 weeks
Search
4,610
up 12%
Checkout
2,180
down 5.6%
Accounts
1,720
up 12%
Exports
1,160
up 18%
Billing
590
down 3.3%

In a list row

16px tall at the row's end, beside the number it shapes.

Reading

onRead turns the reading on: the number beside the sparkline is its reading.

Requests9,100Today
Point, tap or use the arrows: the number and the day beside it read the row, and the newest come back when it ends.

The pointer reads the nearest row across the sparkline's whole box, with no delay. A dot marks the read row on a line or an area, and on bars the read bar stays while the others set back. onRead is called with the point, its row in full, its value and the value as format writes it, in the same event, so the number beside it changes in the same frame as the dot; when the reading ends it is called with null.

On a touch screen a tap or a sideways drag reads, and a vertical swipe that starts on the sparkline scrolls the page. The reading stays until a tap somewhere else.

Tab
Moves to the sparkline: the reading starts on the newest row, or on the row read last.
←→
Step a row; right to left, the arrows follow the page.
↑↓
Step a row, as on any slider.
HomeEnd
The first row and the newest.
Esc
Hides the reading until the next key. Leaving the sparkline clears it.

States

A gap and one point

A missing row breaks the line, never bridged and never drawn to zero, and a value alone between two gaps is a dot. One row is a dot at the sparkline's middle.

9,100
No count on two days
9,100
One row

rootStyle takes layout, a fixed width among it, and these knobs.

--sparkline-h
Ref<Space>Default var(--space-6)
--space-4 in a row, --space-6 beside a number, --space-8 in a Stat.
--chart-surface
ChartKnobs["--chart-surface"]Default var(--card-bg, var(--bg-app))
What the read dot's ring cuts to, as on a Chart.

A sparkline is named from its data, as a plot is: what it counts, how many rows, its first and last value and the change. The area above is "Requests per day: 29 days, from 8.1K to 9.1K, up 12%". Without a reading it is one image (role="img") with that name, and not a Tab stop, so a table of them is read as their names.

With onRead it is one Tab stop, a horizontal slider (role="slider") over its rows: its name the same, its value the read row, and its value text that row's reading, "Tue, Oct 6: 9,100". The value text is the announcement, so the number beside it needs no status region of its own.

The focus ring is the kit's, 6px off the sparkline so it clears the read dot. A 16px sparkline that reads takes the pointer 4px above and below it, so its target is 24px tall without growing the row.

Sparkline

labelrequired
string
What it counts ("Requests per day"): its name starts with it.
xrequired
readonly (string | number | Date)[]
The rows, oldest first: days as yyyy-mm-dd, timestamps, or names.
valuesrequired
readonly (number | null | undefined)[]
A value per row; null is a gap.
kind
"line" | "area" | "bars"Default "line"
size
"sm" | "md" | "lg"
16, 24 or 32px; lg in a Stat.
color
stringDefault chartColor(1)
The paint of the slot its entity owns.
curve
"monotone" | "straight" | "step"Default "monotone"
unit
string
A symbol every number carries (ms, %).
format
(value: number) => string
How a read value is written: fmtCount, fmtPercent.
onRead
(point: SparkPoint | null) => void
Turns the reading on: called with each point read, then null when the reading ends.
rootStyle
RootStyle<SparklineKnobs>

Rest props go to HTMLAttributes<HTMLDivElement>.