Skip to main content
Version: 1.0.2

Masonry

Overview

The Masonry component creates Pinterest-style layouts that optimize vertical space by arranging items of varying heights into responsive columns.

It supports responsive breakpoints, gaps, balanced column heights, and entrance animations.

Preview

Item 1
Item 4 (tallest)
Item 2 (taller)
Item 3

Installation

npx @mindfiredigital/ignix-ui add masonry

Variants

Item 1
Item 4
Item 2
Item 5
Item 3
Item 6

Usage

Basic Example

function Gallery() {
return (
<Masonry columns={3} mobile={1} gap="normal">
{images.map((src, i) => (
<img key={i} src={src} className="rounded shadow" />
))}
</Masonry>
);
}

Balanced Columns

<Masonry columns={4} mobile={2} gap="small" balanced>
{items.map((item, i) => (
<Card key={i} {...item} />
))}
</Masonry>

With Animation

<Masonry columns={3} animation="scale-in">
{products.map((p) => (
<ProductCard key={p.id} product={p} />
))}
</Masonry>

Props

PropTypeDefaultDescription
columnsnumber3Number of columns at desktop.
mobilenumber1Number of columns at mobile breakpoint.
gap"none" | "small" | "normal" | "large" | string"normal"Gap between items.
balancedbooleantrueIf true, items are distributed evenly to balance column heights.
animation"none" | "fade-in" | "scale-in" | "slide-up""none"Defines entrance animation for items.
classNamestring""Custom class names for wrapper.