crucıble

Plotter

A self-drawing chart — line, area, or bar — that performs its data on scroll-in: axes and gridlines fade in first like ruled paper, lines trace left to right behind a bright pen tip with the gradient fill sweeping beneath, bars spring from the baseline and settle. Dataset changes morph the marks, and a tooltipTour mode walks an active tooltip across the points once after the draw.

motionpro

Installation

CLI

npx shadcn@latest add @crucible/plotter

Manual — install dependencies, then copy the source

npm install motion

Props

PropTypeDefaultDescription
labelsstring[]X-axis category labels — one per data point.
seriesPlotterSeries[]The series to plot. Multi-series draws one at a time with overlapping tails.
typePlotterType"line"Chart form.
drawDurationnumber1.8Seconds a single series takes to draw.
drawEasingPlotterEasing"ease-in-out"Easing for the pen stroke (named or a custom 0–1 function).
staggernumber1.1Seconds between series starts — smaller overlaps the tails more.
triggerPlotterTrigger"view"What starts the draw: scroll into view, mount, or the play prop.
inViewThresholdnumber0.35IntersectionObserver threshold for trigger="view".
playbooleanfalseStarts the draw when trigger="manual".
morphbooleantrueMorph existing marks to new values on data change (vs. snapping).
morphSpring{ stiffness?: number; damping?: number }{ stiffness: 120, damping: 20 }Spring driving the morph.
gridLeadnumber0.6Seconds the axes + gridlines fade in before any ink lands.
tooltipTourbooleanfalseWalk an active tooltip across the data once after the draw.
tourDwellnumber0.6Seconds the tour dwells on each stop (tour visits at most 12 stops).
colorsstring[]Fallback palette for series without an explicit color.
format(value: number) => stringcompact en-USNumber formatting for axis ticks and tooltip values.
yTicksnumber4Approximate horizontal gridline count.
pausedbooleanfalseFreezes all animation in place.
Also accepts all props of Omit<React.HTMLAttributes<HTMLDivElement>, "children">they pass through to the underlying element.

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