vamsiy78

Masonry Grid

Galleries

About

A gap-free multi-column layout component for tiles of different heights, built on CSS columns so it never shifts on load, with responsive column counts and an optional scroll-reveal animation.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Masonry Grid to your project and fits it to your theme.

Code

How Masonry Grid is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { MasonryGrid, MasonryItem } from "@/components/ui/masonry-grid";
const tiles = [
  { h: "h-40", tone: "from-chart-1/40 to-chart-1/10", title: "Morning light" },
  { h: "h-28", tone: "from-chart-2/40 to-chart-2/10", title: "Workshop" },
  { h: "h-52", tone: "from-chart-3/40 to-chart-3/10", title: "Harbor" },
  { h: "h-32", tone: "from-chart-4/40 to-chart-4/10", title: "Studio wall" },
  { h: "h-44", tone: "from-chart-5/40 to-chart-5/10", title: "Field notes" },
  { h: "h-24", tone: "from-chart-1/30 to-chart-2/10", title: "Sketch" },
  { h: "h-36", tone: "from-chart-2/30 to-chart-3/10", title: "Terrace" },
  { h: "h-48", tone: "from-chart-3/30 to-chart-4/10", title: "Market" },
  { h: "h-28", tone: "from-chart-4/30 to-chart-5/10", title: "Ceramics" },
];
export default function MasonryGridDemo() {
  return (
    <MasonryGrid
      columns={{ base: 2, sm: 3 }}
      gap="sm"
      reveal
      className="w-full max-w-2xl"
    >
      {tiles.map((t) => (
        <MasonryItem key={t.title}>
          <figure className="overflow-hidden rounded-xl border bg-card shadow-xs">
            <div className={`${t.h} bg-gradient-to-br ${t.tone}`} />
            <figcaption className="px-3 py-2 text-xs font-medium">
              {t.title}
            </figcaption>
          </figure>
        </MasonryItem>
      ))}
    </MasonryGrid>
  );
}

Dependencies

More by vamsiy78

View all
  • Animated Beam

    Animated Beam

    53
  • Glow Border

    Glow Border

    16
  • Agent Roster

    Agent Roster

    13
  • Segmented Control

    Segmented Control

    12
  • FAQ Accordion Section

    FAQ Accordion Section

    3
  • API Key Field

    API Key Field

    3
  • Signature Pad

    Signature Pad

    1
  • Table Of Contents

    Table Of Contents

    1

More in Galleries

View all
  • Gallery Component

    Gallery Component

    48
  • Photo Deck

    Photo Deck

    80
  • Scattered About

    Scattered About

    80
  • Product Hover Showcase

    Product Hover Showcase

    121
  • Morph Gallery

    Morph Gallery

    4
  • Image Gallery

    Image Gallery

    97
  • Editorial Collage Hero

    Editorial Collage Hero

    530
  • About 3

    About 3

    459