Power-User Systems

Masonry

A Pinterest-style grid where every item drops into the shortest column, packed by measurement rather than by a shared row baseline.

Install

bun add clsx tailwind-merge

Then copy 2 files into your project:

  • components/registry/masonry/masonry.tsx
  • lib/utils.ts

Props

PropTypeDefaultDescription
minColumnWidthnumber240Target column width. The column count is derived from the container, not the viewport.
maxColumnsnumber4Ceiling on the derived column count, however wide the container gets.
gapnumber16Space between columns and between stacked items.
packing"balanced" | "sequential""balanced"Balanced packs into the shortest column; sequential keeps strict left-to-right order.
transitionnumber320How long an item takes to glide to a new slot. 0 snaps.
staggernumber45Delay added per item as a batch reveals.
revealOnScrollbooleantrueFade and rise each item in as it enters the viewport.
revealDistancenumber16How far an item rises on reveal.

What It Demonstrates

Layout animation
When an element's size or position changes, it animates to the new spot instead of snapping.
Stagger
Animate several items one after another with a small delay between each, creating a cascade.
Scroll reveal
Elements fade or slide into place as they enter the viewport.
Spatial consistency
Animating so an element keeps its identity and position across states, so users never lose track of where things went.
Layout thrashing
Animating properties like width, height, top, or left that force the browser to recalculate layout every frame, causing jank.
will-change
A CSS hint that an element is about to animate, so the browser can promote it to its own layer ahead of time.
Compositing
Letting the GPU move or fade an element on its own layer without redoing layout or paint.

Related Components

Appears In