crucıble

Scriber

A tiny inline sparkline — line, gradient area, or micro-bars — that scores itself in left to right with a bright cooling tip, and can stream live data from the right with a breathing endpoint dot. Pure SVG, no chart library, no axes.

cssfree

Installation

CLI

npx shadcn@latest add @crucible/scriber

Props

PropTypeDefaultDescription
datanumber[]a seeded demo series (see seed)Points to plot, in any numeric range (normalized internally).
variantScriberVariant"line"Chart geometry: a plain line, a gradient-filled area, or micro-bars.
strokeWidthnumber1.5Stroke width in px.
fillDirection"down" | "up""down"Direction the area gradient fades: bright at the line fading down, or reversed.
fillOpacitynumber0.22Peak opacity of the area gradient where it meets the line.
drawDurationnumber1.2Seconds the trace takes to score in, left to right, once in view. 0 skips the draw.
drawEasingScriberEasing"easeOut"Easing for the draw: a named curve or a custom (t) => number.
liveboolean | ((last: number, index: number) => number)falseLive streaming mode: after the initial draw, new points slide in from the right while old points slide off the left. Pass true for a seeded random walk, or a callback (last, index) => next generating each point.
intervalnumber1000Milliseconds between streamed points in live mode.
windowSizenumber32Number of points visible at once in live mode (the stream window).
endpointDotbooleantrueShow the latest-value marker dot (breathes at ~0.5 Hz while live).
bounds[min: number, max: number]auto from the visible dataFixed [min, max] normalization bounds.
seednumber11Seed for the deterministic demo series and the default live walk.
colorsScriberColorsPalette overrides — graphite track, ice-white stroke by default.
pausedbooleanfalseFreeze all animation (draw and live stream).
labelstringVisually-hidden trend text for screen readers, e.g. "up 12% over 30 days". Without it the sparkline is decorative (aria-hidden).
Also accepts all props of Omit<React.ComponentPropsWithoutRef<"span">, "children">they pass through to the underlying element.

Honors prefers-reduced-motion with a designed static fallback, and passes className through.