Branch Tree

A tree branches level by level from one root into many leaves, then lands the leaf count in big type. A free, MIT-licensed Remotion number animation.

Installation
$ pnpm dlx shadcn@latest add @remocn/branch-tree

Usage

tsx
// src/Root.tsx
import { Composition } from "remotion";
import { BranchTree } from "@/components/remocn/branch-tree";
 
const BranchTreeScene = () => <BranchTree depth={3} branching={[3, 4, 4]} title="variants" rootLabel="1 component" />;
 
export const RemotionRoot = () => (
  <Composition
    id="BranchTree"
    component={BranchTreeScene}
    durationInFrames={260}
    fps={60}
    width={1280}
    height={720}
  />
);

A single root node branches level by level into a growing fan of leaves, then the leaf count lands in large type with a caption. The count is the product of the branching, so 3 by 4 by 4 gives 48. Pass depth (1 to 5), branching as one number or one per level, title for the word after the count, and rootLabel. It ships light and dark through theme.

Props15

PropTypeDefault
depth
number3

Number of branching levels, from 1 to 5.

branching
number | number[][3, 4, 4]

Children per node; one number, or one per level.

title
string"variants"

Word shown after the final leaf count.

rootLabel
string"1 component"

Label next to the root node.

grow
number12

Frames each branch takes to grow to its node.

fontWeight
number500

Weight of the leaf count.

accent
string"#3B5BFD"

Accent color of the branches and count.

ink
string—

Text color; overrides the theme ink.

background
string—

Background fill; pass "transparent" to drop it.

fontFamily
string"Space Grotesk"

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

grain
booleantrue

Film grain over the scene.

theme
"dark" | "light""dark"

Light or dark palette.

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.

speed
number1

Playback speed multiplier.

  • depthnumber

    Number of branching levels, from 1 to 5.

    Default3

  • branchingnumber | number[]

    Children per node; one number, or one per level.

    Default[3, 4, 4]

  • titlestring

    Word shown after the final leaf count.

    Default"variants"

  • rootLabelstring

    Label next to the root node.

    Default"1 component"

  • grownumber

    Frames each branch takes to grow to its node.

    Default12

  • fontWeightnumber

    Weight of the leaf count.

    Default500

  • accentstring

    Accent color of the branches and count.

    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"Space Grotesk"

  • grainboolean

    Film grain over the scene.

    Defaulttrue

  • theme"dark" | "light"

    Light or dark palette.

    Default"dark"

  • 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

  • speednumber

    Playback speed multiplier.

    Default1