Data

Sparkline

The shape of a series with no axes: the trend under a Metric, a row in a table. A line in a palette color over a soft fill of the same color, with a dot on the last value. It wipes in from the left once it is on screen and stays still with reduced motion. It is decoration for screen readers, since the Metric beside it already says the number.

view .md
Preview
last 30 days
balanceUp +7.4%
savedUp +18.1%
spentUp +11.3%
palette
Installation
terminal
bash
npx @entrepta/cli@latest add sparkline

// Resolves dependencies, copies the source, and installs npm packages automatically.

Usage
sparkline.tsx
tsx
import { Sparkline } from "@/components/entrepta/sparkline"

<Metric
  label="spent this month"
  value={<Amount value={spent} />}
  trend={<Sparkline data={dailyTotals} tone="chart-1" />}
/>

<Sparkline data={balance} className="h-28" />   // taller in a hero tile
Props
PropTypeDefaultDescription
datanumber[]-Oldest first, two or more
tone"chart-1" … "chart-8" | "success" | "error" | "neutral""chart-1"A palette color, or a status for good or bad news
areabooleantrueThe soft fill under the line
dotbooleantrueThe dot on the last value
classNamestring-Its height, 40px by default
Active theme: entrepta, dark mode.