Sparkline Thread

A small glowing sparkline climbs and ends on a dot while a +212% counter ticks up beside it. A free, MIT-licensed Remotion number animation.

Installation
$ pnpm dlx shadcn@latest add @remocn/sparkline-thread

Usage

tsx
// src/Root.tsx
import { Composition } from "remotion";
import { SparklineThread } from "@/components/remocn/sparkline-thread";
 
const SparklineThreadScene = () => (
  <SparklineThread
    values={[20, 26, 24, 35, 34, 49, 56, 64, 77]}
    metric="+212%"
    label="weekly renders"
  />
);
 
export const RemotionRoot = () => (
  <Composition
    id="SparklineThread"
    component={SparklineThreadScene}
    durationInFrames={300}
    fps={60}
    width={1280}
    height={720}
  />
);

Data points pop in, a glowing thread draws through them and thickens into an area fill, then a bloom at the last point leads to the metric counting up with its label. Pass values (one number per point), metric and label. Ships dark and light via theme.

Props14

PropTypeDefault
values
number[]DEFAULT_VALUES

Data points along the line, in order.

metric
string"+212%"

The stat that counts up, such as +212%.

label
string"weekly renders"

Line under the metric.

stagger
number2

Frames between data points as they pop in.

drawDuration
number42

Frames the thread takes to run through the points; the thickening and the landing follow it.

accent
string"#3B5BFD"

Accent color for the hero element.

ink
string—

Text color; overrides the theme ink.

background
string—

Background fill; pass "transparent" to drop it.

fontFamily
string"Geist"

Typeface for the copy. Load the font in your project first.

scale
number1

Size of the foreground around the frame's center; the background stays put.

delay
number0

Frames to hold the first frame before anything moves.

grain
booleantrue

Film grain over the scene.

speed
number1

Playback multiplier.

theme
"dark" | "light""dark"

Dark or light palette.

  • valuesnumber[]

    Data points along the line, in order.

    DefaultDEFAULT_VALUES

  • metricstring

    The stat that counts up, such as +212%.

    Default"+212%"

  • labelstring

    Line under the metric.

    Default"weekly renders"

  • staggernumber

    Frames between data points as they pop in.

    Default2

  • drawDurationnumber

    Frames the thread takes to run through the points; the thickening and the landing follow it.

    Default42

  • accentstring

    Accent color for the hero element.

    Default"#3B5BFD"

  • inkstring

    Text color; overrides the theme ink.

  • backgroundstring

    Background fill; pass "transparent" to drop it.

  • fontFamilystring

    Typeface for the copy. Load the font in your project first.

    Default"Geist"

  • scalenumber

    Size of the foreground around the frame's center; the background stays put.

    Default1

  • delaynumber

    Frames to hold the first frame before anything moves.

    Default0

  • grainboolean

    Film grain over the scene.

    Defaulttrue

  • speednumber

    Playback multiplier.

    Default1

  • theme"dark" | "light"

    Dark or light palette.

    Default"dark"

Common questions

How do I make a small glowing sparkline that ends on a dot with a counter in Remotion?

Install Sparkline Thread with npx shadcn@latest add @remocn/sparkline-thread and pass values (one number per point), metric and label. A glowing line draws through the points, blooms on the last one, and the metric counts up beside it. The line is plain SVG; you don't need @remotion/paths, @remotion/shapes or d3-shape.

Does the counter work for formats other than percent?

Yes. The first number in metric counts up from zero and everything around it is kept: "+212%", "$1.2M" and "3x" all work, with the same number of decimals as you typed and thousands separators if the number had a comma. A metric with no number is shown as static text.

How many data points can I pass?

At least two; there is no upper limit. The line is scaled to the lowest and highest value. Eight to sixteen points read best.

How long is it at 30 fps and at 60 fps?

The label lands at frame 116 at 30 fps, then the frame holds. Timing is counted on a 30 fps scale at any frame rate, so a 60 fps composition needs at least 232 frames; the usage example's 300 frames includes a hold.

Does it work in portrait?

It is laid out for 16:9, with the chart on the left and the metric on the right.