Masonry
A Pinterest-style multi-column layout that arranges items to minimize vertical gaps.
When to Use
- For image galleries or card grids with varying heights
- When items have different sizes and you want a dense layout
- For responsive multi-column content without fixed row heights
Import
Examples
Basic Masonry
Items flow into columns, filling vertical space efficiently.
Column Counts
Control the number of columns.
Custom Gutter
Set different horizontal and vertical gaps.
Responsive Columns
Pass a breakpoint object to adjust columns at different screen sizes.
API
MasonryProps
columns—number | ResponsiveObject— Number of columns (default:2)gutter—number | [number, number]— Gap between items, or [horizontal, vertical] (default:0)items—any[]— Array of data items (used withitemRender)itemRender—(item: any, index: number) => ReactNode— Custom render function for itemssequential—boolean— Whether to render items sequentially (default:false)className—string— Custom CSS classstyle—CSSProperties— Inline styles