Skip to content

Sparkline

A compact, inline mini chart with no axes or labels. Used within table cells, stat blocks, or alongside text to show trends at a glance.

Preview

Line sparkline

Revenue

Area sparkline

Traffic

Bar sparkline

Activity

In a stat block

Monthly Users
4,218
+18.3%

Variants

VariantDescription
LineStroke-only polyline
AreaFilled area under the line
BarVertical micro-bars

Props

PropTypeDefaultDescription
datanumber[]--Data points
variant'line' | 'area' | 'bar''line'Visual style
widthnumber80Chart width in px
heightnumber24Chart height in px
colorstringSeries 1 colourStroke/fill colour

Code example

React

tsx
import { Sparkline } from '@thepace/lexicon/components';

<Sparkline data={[4, 8, 12, 10, 16, 20, 18]} variant="area" />
<Sparkline data={[4, 8, 12, 10, 16, 20, 18]} variant="bar" />

CSS class reference

ClassPurpose
.lex-sparklineInline container
.lex-sparkline__svgSVG canvas
.lex-sparkline__lineLine stroke
.lex-sparkline__areaFilled area polygon
.lex-sparkline__barsBar container
.lex-sparkline__barIndividual micro-bar

Accessibility

  • Use role="img" and aria-label describing the trend (e.g. "Revenue trending up over 7 days").
  • Sparklines are decorative supplements — always pair with a readable value nearby.
  • Ensure the stroke/fill colour has sufficient contrast against the background.

Guidelines

Do

  • Use inside table cells to add visual context to numbers.
  • Pair with stat blocks to show trend direction.
  • Keep sparklines small — they are glanceable, not interactive.

Don't

  • Don't use sparklines as standalone charts — they lack axes and labels.
  • Don't add tooltips or interactivity to sparklines — use a full chart instead.

Released under the MIT License. A product by the pace.