Masonry
A responsive, measurement-free gallery layout built on CSS columns. Direct children flow top-to-bottom then wrap into the next column, so columns stay height-balanced with no JavaScript measuring. Ordering is column-major.
Mountain trail
A short caption.
Harbor at dusk
A longer caption that wraps onto a couple of lines so this tile is noticeably taller than its neighbors.
Studio light
Canyon road
Varied heights are exactly what makes the masonry flow visible.
Quiet street
Another short one.
Open field
Installation
Copy the piece into your app — it compiles with your build and the code is yours:
puzzle add piece masonry
Requires the pieces.css tokens merged into your app styles (see Introduction).
Usage
import Masonry from '@/components/ui/Masonry.pzl';
<Masonry columns={ 3 } gap={ 4 }></Masonry>Responsive columns
One column on phones, two on small screens, three on large — resize the window to watch it reflow.
Each breakpoint value is a whole, whitelisted class string.
The column count is driven entirely by CSS media variants.
No ResizeObserver, no transforms, no layout thrash.
Just multi-column flow doing the balancing for you.
Gap
A larger gap between columns and rows.
The gap prop drives both the column gap and the vertical spacing between stacked items.
Supported steps: 0, 2, 3, 4, 6, 8.
Everything else falls back to 4.
Fixed column count
Four tight columns.
Great for dense thumbnail grids.
A fixed number.
Passed straight through.
Column-major order.
Items fill each column top-to-bottom before moving to the next.
Balanced heights.
No measuring.