Back to Components
Components

Masonry Grid

Pinterest-style masonry layout using CSS columns for cards of varying heights.

Short card

120px tall

Tall card

200px tall

Medium card

150px tall

Another tall

180px tall

Compact

100px tall

Standard

160px tall

Dependencies

  • clsx
  • tailwind-merge

Files

  • components/ui/masonry-grid.tsx

Installation

Using shadcn CLI

npx shadcn add masonry-grid --url https://ui.hampton.io

Manual installation

Copy the component file to your project and install dependencies:

npm install clsx tailwind-merge