Treemap Blocks
Nested rectangles sized by value. Install with npx remotion-ui@latest add treemap-blocks.
PrimitiveData & mediaAdvanced
$ npx remotion-ui@latest add treemap-blocksValue 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 →
@/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-uinpm package; it is copied into your project.
Usage
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
| Prop | Type | Default | Description |
|---|---|---|---|
| blocks | ChartDatum[] | required | `{ label, value, color? }`. Area is proportional to value. |
| width | number | 820 | Box the tiles fill. |
| height | number | 460 | Box height. |
| gap | number | 8 | Space between tiles. |
| cornerRadius | number | 12 | Tile corner radius, clamped on small tiles. |
| showShare | boolean | true | Percentage of the total, printed beside the value. |
| durationInFrames | number | 20 | Length of one tile's arrival. |
| staggerInFrames | number | 6 | Frames between tiles, largest first. |
| exitAtInFrames | number | undefined | Frame the map collapses on, smallest first. |
| frame | number | undefined | Frame override — pass the parent frame inside a `<Sequence>`. |