Spelte

Open Github

Chart

Interactive line chart with a cursor-tracked tooltip card, snap-to-point hover, and built-in X-axis labels.

Jan '16
Apr '26

Installation

pnpm dlx shadcn-svelte@latest add https://spelte.dev/r/chart.json

Examples

With Labels

Jan
Dec

Custom Color

Jan
Dec

Props

PropTypeDefaultDescription
datanumber[]—Numeric values to plot
labelsstring[]—Label for each data point
namestring—Series name shown in tooltip
colorstring"#0090FD"Line and dot color
widthnumber640Maximum chart width in pixels
formatValue(value: number, index: number) => stringv.toLocaleString()Format tooltip value
defaultIndexnumberdata.length - 1Initial active point index
showXAxisbooleantrueShow X-axis tick labels
tickCountnumber6Target number of X-axis ticks
revealbooleanfalseGray line until cursor passes over it
showFillbooleantrueShow gradient fill under line
showDotbooleantrueShow colored dot at active point
animatedbooleantrueAnimate cursor, dot, and tooltip
classstring—Additional CSS classes