Sparkline

Compact inline sparkline for embedding trend data in dashboards or KPI cards.

Category: chart · WCAG 2.1-AA · chart, sparkline, inline, trend, data-viz

Props

PropTypeDefaultDescription
datanumber[]Array of numeric values
labelstringAccessible name for the chart (invisible — rendered as the SVG `<title>`).
ariaLabelstringAlias for `label` (the catalog convention for an invisible accessible name). Both work; pass exactly one.
widthnumber80Fixed SVG width in px. ⚠ **Omit for a responsive chart** — the chart fills and tracks its container via a ResizeObserver; there is no correct pixel number in a responsive grid. A fixed width is clamped to the container (max-inline-size: 100%) so it can never overflow its card, but it also stops the chart growing. `useChartSize` is NOT needed for this — charts call it internally.
heightnumber32SVG height in px. Unlike `width`, height does NOT track the container — this is the knob you set to change the chart's aspect.
colorstringStroke color (CSS value)
endDotbooleanShow dot at last data point

Design tokens

When to use

When not to use

Examples

Inline sparkline

import { Sparkline } from '@cascivo/charts'

<Sparkline data={[10, 20, 15, 30, 25]} label="Trend" endDot />

Related components

← Back to docs