Masonry Layout
Cards of different heights packed into columns with no row gaps, like Pinterest.
columns: 3 / grid-template-rows: masonryWhen to use it
For image galleries and inspiration boards.
Common mistake
For content where order matters, a regular grid is clearer.
Accessibility
The visual order differs from source order; make sure tabbing still makes sense.
Name in code
| HTML/CSS | columns: 3 / grid-template-rows: masonry |
|---|---|
| React | react-masonry-css |
| Jetpack Compose | LazyVerticalStaggeredGrid |
| SwiftUI | Custom Layout |
Ready prompt for your coding agent
Add a Masonry Layout to this screen.
What it is: Cards of different heights packed into columns with no row gaps, like Pinterest.
Implement with: columns: 3 / grid-template-rows: masonry (HTML/CSS).
Accessibility: The visual order differs from source order; make sure tabbing still makes sense.
When to use it: For image galleries and inspiration boards.
Avoid: For content where order matters, a regular grid is clearer.
Reuse the project's existing design tokens, spacing and component conventions.
Or compose a whole page from this element and others →
Prompts are in English for the most precise results with coding agents.