RemotionUI

Treemap Blocks

Nested rectangles sized by value. Install with npx remotion-ui@latest add treemap-blocks.

PrimitiveData & mediaAdvanced

treemap-blocks30fps · 960×540
Install
$ npx remotion-ui@latest add treemap-blocks

Value blocks tiled to fill the frame, arriving largest first.

import { TreemapBlocks } from "@/remotion/primitives/treemap-blocks";

<TreemapBlocks
  blocks={[
    { label: "Atoms", value: 46 },
    { label: "Blocks", value: 31 },
    { label: "Signals", value: 26 },
  ]}
  staggerInFrames={12}
/>

Squarified, not sliced

The layout is the Bruls–Huizing–van Wijk squarified algorithm: rows grow along the shorter side of whatever space is left, and a row closes as soon as adding the next value would worsen its aspect ratio. Slice-and-dice layouts turn small values into long splinters that cannot be labelled and misread badly at a glance; keeping every tile near square is the only reason a treemap is legible.

The layout is pure geometry over the values, so the same data always produces the same map.

Labels

A block prints its name and value only when the tile can hold them — a label that overflows its own rectangle reads as a rendering fault. In a long-tailed set the small tiles are deliberately left blank; the area still carries them.

Motion

Blocks scale up from their own centres in descending order, so the map builds outward from its dominant value. With exitAtInFrames the smallest leave first and the map collapses back onto that value.

Use bubble-chart-pack when the values should not tile — a treemap implies the parts make up a whole.

Squarified layout (Bruls, Huizing & van Wijk): rows grow along the shorter free side and close when the next value would worsen the aspect ratio. Slice-and-dice turns small values into unlabelable splinters. A tile prints its label only when it can hold it — overflowing type reads as a rendering fault, and the area still carries the small values.

Agent notes

Install first, then import the copied source component locally. AI guide →

Import
@/remotion/primitives/treemap-blocks
  • Use when: frame-level motion primitives and reusable animation wrappers.
  • Customize: blocks, width, height, gap, plus copied source for timing, layout, colors, and typography.
  • Rule: do not import this component from the remotion-ui npm package; it is copied into your project.

Usage

Example
import { TreemapBlocks } from "@/remotion/primitives/treemap-blocks"; <TreemapBlocks blocks={[ { label: "Atoms", value: 46 }, { label: "Blocks", value: 31 }, { label: "Signals", value: 26 }, ]} staggerInFrames={12} />

API Reference

PropTypeDescription
blocksChartDatum[]`{ label, value, color? }`. Area is proportional to value.
widthnumberBox the tiles fill.
heightnumberBox height.
gapnumberSpace between tiles.
cornerRadiusnumberTile corner radius, clamped on small tiles.
showSharebooleanPercentage of the total, printed beside the value.
durationInFramesnumberLength of one tile's arrival.
staggerInFramesnumberFrames between tiles, largest first.
exitAtInFramesnumberFrame the map collapses on, smallest first.
framenumberFrame override — pass the parent frame inside a `<Sequence>`.

Related

On this page