Vesture

Charts

SparklineNew in 0.7.0

A tiny, axis-less line, area or bar chart sized for table cells, stat tiles and headlines. Server-safe — plain SVG, no JavaScript.

Sparkline

Preview

Stroke 1.5px
Signups+31%
Churn−48%
Net revenue+$9k

Usage

tsx
import { Sparkline } from "@vesture/react";

<Sparkline values={weeklySignups} type="area" curve="smooth" highlight="minmax" label="Signups, last 12 weeks" />

<Sparkline
  type="bar"
  values={[3, -2, 5, -4, 6]}
  baseline={0}
  color="#1baf7a"
  negativeColor="#e34948"
/>

Behavior

  • type is line, area or bar. curve (linear / smooth / step) shapes line and area; domain pins either end of the y-scale so several sparklines can share one scale or bars can start at zero.
  • baseline draws a dashed reference line and, for bars, splits colors: values below it use negativeColor — handy for profit/loss or change-vs-target series.
  • highlight marks the last, min, max, both extremes or every point with a dot.
  • A flat series sits mid-height instead of collapsing onto the floor; an empty series renders an empty (but labeled) SVG.

Props

PropTypeDefaultDescription
valuesnumber[]—Required.
type"line" | "area" | "bar""line"
width / heightnumber120 / 32
colorstringchart series 1Any CSS color.
negativeColorstring—Bars below baseline.
curve"linear" | "smooth" | "step""linear"
strokeWidthnumber1.5
areaOpacitynumber0.2Fill under an area sparkline.
domain{ min?: number; max?: number }—Pins the y-scale.
baselinenumber—Dashed reference line; splits bar colors.
highlight"none" | "last" | "min" | "max" | "minmax" | "all"—Dots on chosen points.
barGapnumber1Gap between bars in px.
labelstring—Accessible label.