DS0
Components

MasonryGrid

A Pinterest-style masonry layout for items with varying heights.

Overview

MasonryGrid arranges child elements in a Pinterest-style column layout where items of varying heights are packed efficiently without gaps.

Usage

<MasonryGrid columns={3} gap={16}>
  {items.map(item => (
    <Card key={item.id}>
      <img src={item.image} alt={item.title} />
      <p>{item.description}</p>
    </Card>
  ))}
</MasonryGrid>

API Reference

PropTypeDefaultDescription
columnsnumber | { sm: number, md: number, lg: number }3Number of columns
gapnumber16Gap between items in pixels
childrenReactNodeMasonry items
ComponentWhen to Use Instead
GridUniform-height grid layout
StackSingle-axis linear layout

On this page