Sparkline

Tiny trend line that draws itself and ends in a dot. Charts.

Open playground

About

Sparkline is a React component in the Charts category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { Sparkline } from "@ashutoshswamy/smoui" and set data, width, label.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { Sparkline } from "@ashutoshswamy/smoui";

<Sparkline data={[8, 12, 9, 16, 14, 22, 19, 28]} width={200} height={56} />

Props 3

data

Points.

number[]
width / height

Size in px.

numberdefault 120 / 36
label

Accessible description.

stringdefault "Trend"