Integrated ResearchPicasso
Components

Sparkline

A chart stripped to its shape — one series, no axes, no labels, sized to sit beside the number it summarises.

{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}

A chart stripped to its shape — one series, no axes, no labels, sized to sit beside the number it summarises.

Import

import { Sparkline } from "@ir/ui";

Watch out

  • No crosshair, no tooltip, no hover. That is deliberate rather than missing: reading a value off a 24px-tall line is not possible, and a crosshair without an axis to read against is furniture pretending to be information. Values are the time-series chart's job; this is the shape.
  • One series only. There is no series axis and no legend, because two lines in 80 × 24 is two lines nobody can follow — and because the chart palette cannot currently tell eight series apart anyway.

Props

PropTypeRequiredWhat it does
valuesreadonly (number | null)[]yesThe series, oldest first. null is missing data and leaves a gap — it is never plotted as zero, which would invent a reading.
labelstring | nullyesWhat the shape says, in words, for anyone who cannot see it — "MOS over 24 hours, 4.4 falling to 4.1". null where the row or tile around it already says the same thing. Not optional: a label generated from the numbers would describe the data and not the point.
variant"line" | "area"Line, or line with the area under it filled.
toneSparklineToneprimary unless the thing is graded. A status tone is only for use where the status is also written down — a KpiTile badge, a table status cell — never as the only thing saying so.
minnumberPin the low end of the scale. Defaults to the lowest value present.
maxnumberPin the high end. Defaults to the highest value present.
endbooleanA dot on the newest point. On by default — it says which end is now.
thresholdnumberA dashed rule across the plot: a threshold, a target, an SLA floor.

Do and don't

Pass the same min and max to every sparkline in a column.

Don't — Let every row scale to its own high and low, so a trunk wobbling by 0.1 draws the same mountain as one that fell by 2.0.

A column of sparklines is read by comparing shapes. Auto-scaling each one independently makes every row look equally dramatic, which is the one thing the column was supposed to tell you apart. This is the most common way a sparkline lies.

Pass null and leave the gap. A gap means nobody knows; the floor means someone measured zero.

Don't — Plot a missing reading as 0, so a trunk that stopped reporting draws a cliff to the floor.

An endpoint going quiet and an endpoint scoring zero are different incidents with different responses, and a line to the floor reports the second when the first happened.

Keep the badge, the status cell or the icon that says "Critical", and let the tone agree with it.

Don't — Turn the line red and leave it at that.

Status colours are reserved and never travel alone — the same rule KpiTile already follows, for the same reason: colour is not readable by everyone and is gone entirely in a printout.

Put it next to the value it summarises — a KpiTile's number, a table row's figure.

Don't — Ship the line on its own as the reading.

There is no axis, so the line carries direction and steadiness but no magnitude. On its own it says something changed and refuses to say from what to what.

Use the time-series chart when the values matter, and keep this for the shape.

Don't — Add a crosshair, a tooltip or ticks to make it readable point by point.

A crosshair with no axis to read against is furniture pretending to be information, and a 24px-tall plot cannot resolve a value anyway. Growing a sparkline into a chart produces a bad chart rather than a good sparkline.

Accessibility

  • label is required, and null is the explicit way to say the row or tile already names it — there is no default, because a label generated from the numbers would describe the data rather than the point.
  • With a label it is role="img"; with label={null} it is aria-hidden and nothing is said only by the picture.
  • The line is 2px at every rendered size (vector-effect="non-scaling-stroke"), so it does not thin out in a narrow column.
  • A status tone never carries the status alone — see the Do and Don't.
  • No hover, no focus, nothing interactive: there is nothing to read point by point and nothing to tab to.

Where it is drawn

Figma — structure from code, measurements from code.

Open in Storybook

On this page