Skip to content
SENVENLI UI

Sparkline

A tiny line or bar trend with no axes, next to a figure.
Beside a figure
import { Sparkline } from "@senvenli/react/charts";

Examples

Bars

For counts per period, where each value stands alone.

In a table cell

One trend per row, all at the same size.

Guidelines

When to use it

  • A trend beside a stat or in a table cell.

Use something else when

  • Readers need axes, values or several series. Line chart
  • The current figure and its change are enough. Stat

Accessibility

Built in

  • A "Show as table" button shows the same data as a table, which screen readers get by default.

You provide

  • An aria-label that summarizes the trend.

API reference

Sparkline

dataRequired
readonly number[]
type
"line" | "bar"Default "line"
width
number

120 in tables; leave out to fill the width (Stat).

height
numberDefault 32

32 in tables, 28 in a Stat.

aria-label
string

Names the trend when the text next to it does not; a summary of the values otherwise.

valueFormatter
ChartValueFormatterDefault plain