Skip to contentEnma

Components

Sparkline

Live demo

Active seats
1,284
Churn
1.9%

How to use it

A word-sized trend line beside a number: in a KPI tile, a table cell or a list row.

  • Provide data, and optionally width (default 96), height (default 28) and label.
  • The line uses the theme's spark color and ends in a dot on the latest value. The default summary reads "Trend from 4 to 9".
  • It scales to its own range, so it shows direction, not magnitude. Put the actual number next to it.

Don't: use it as the only place a value appears, or add axes.

In every theme

Follows the mode picked in the header.
Graphite
Glass
Paper
Mineral
Enamel
Ember

Code

React
import { Sparkline, Stat } from 'enma/react';

<Stat label="Active seats" value={1284} />
<Sparkline data={[1020, 1080, 1110, 1150, 1190, 1240, 1284]} />

This component needs JavaScript for its behaviour. Outside React, port it with the same classes and props, as described in Other platforms.

Props

SparklineProps

Props of SparklineProps
PropTypeDefaultDescription
data requirednumber[]
widthnumber96Width in px. Default 96.
heightnumber28Height in px. Default 28.
labelstringdescribes the first and latest valuesAccessible summary. Default describes the first and latest values.
classNamestring
styleReact.CSSProperties

↑ ↓ to move, Enter to open, Esc to close

Keyboard shortcuts

Open the command palette
Ctrl then K
Search
/
Show keyboard shortcuts
?
Close the top overlay
Esc
Go to Home
G then H
Go to Themes
G then T
Go to Playground
G then P
Go to Components
G then C
Go to Guides
G then G
Go to Samples
G then S