Skip to main content
BlocksImage & GalleryMasonry grid with hover captions

shadcn/ui Image & Gallery block for React AriaMasonry grid with hover captions

Classic three-column CSS masonry gallery for shadcn/ui built from plain image tiles with break-inside-avoid, a centred eyebrow and heading, and a gradient overlay that reveals the project name and year on hover or focus. No JavaScript, just CSS columns and group-hover utilities. Good for portfolio and case-study index pages.

Free@shadcnpro/aria/gallery-01

Preview

Installation

npx shadcn@latest add @shadcnpro/aria/gallery-01

First time? Add the @shadcnpro registry to components.json as shown in Installation. Free blocks install without a license key.

Let your AI editor install it

The shadcn/ui Pro MCP server lets Cursor, Claude Code and VS Code find and install blocks like Masonry grid with hover captions from one prompt. It is included in every Pro plan.

Copy the code

Paste it into components/blocks/gallery-01.tsx.

components/blocks/gallery-01.tsx
'use client';

const photo = (id: string, w = 800) =>
  `https://images.unsplash.com/photo-${id}?auto=format&fit=crop&w=${w}&q=80`;

const projects = [
  {
    id: '1600585154340-be6161a56a0c',
    name: 'Harbour House',
    year: 2026,
    alt: 'Bright living room with harbour light',
    aspect: 'aspect-[4/5]',
  },
  {
    id: '1487958449943-2429e8be8625',
    name: 'Atrium Offices',
    year: 2025,
    alt: 'Concrete atrium with skylight',
    aspect: 'aspect-[4/3]',
  },
  {
    id: '1600607687939-ce8a6c25118c',
    name: 'Vinha Loft',
    year: 2025,
    alt: 'Loft interior in oak and plaster',
    aspect: 'aspect-square',
  },
  {
    id: '1600047509807-ba8f99d2cdde',
    name: 'Fjeld Cabin',
    year: 2024,
    alt: 'Cabin exterior at dusk',
    aspect: 'aspect-[3/4]',
  },
  {
    id: '1518005020951-eccb494ad742',
    name: 'Lantern Library',
    year: 2024,
    alt: 'Curved reading room facade',
    aspect: 'aspect-[4/3]',
  },
  {
    id: '1512917774080-9991f1c4c750',
    name: 'Courtyard Villa',
    year: 2023,
    alt: 'Villa with courtyard pool',
    aspect: 'aspect-[4/5]',
  },
  {
    id: '1600573472550-8090b5e0745e',
    name: 'Slate Townhouse',
    year: 2025,
    alt: 'Townhouse kitchen in dark stone',
    aspect: 'aspect-square',
  },
  {
    id: '1505691938895-1758d7feb511',
    name: 'Tidewater Spa',
    year: 2026,
    alt: 'Spa suite in soft morning light',
    aspect: 'aspect-[4/3]',
  },
  {
    id: '1511818966892-d7d671e672a2',
    name: 'Atrium Offices',
    year: 2025,
    alt: 'Geometric facade detail',
    aspect: 'aspect-[3/4]',
  },
];

/**
 * Centred heading over a three-column CSS masonry of nine project photos; each tile reveals the project name and year on hover.
 */
export default function Gallery01() {
  return (
    <section className="w-full py-16 sm:py-24">
      <div className="mx-auto w-full max-w-6xl px-6">
        <div className="mx-auto max-w-2xl text-center">
          <p className="font-medium text-primary text-sm">Selected work</p>
          <h2 className="mt-2 text-balance font-semibold text-3xl text-foreground tracking-tight sm:text-4xl">
            Nine rooms, eight cities, one way of working
          </h2>
          <p className="mt-4 text-pretty text-lg text-muted-foreground">
            A cross-section of Studio Marrow projects from Copenhagen to the
            Algarve. Hover any image for the project and year.
          </p>
        </div>

        <div className="mt-12 columns-2 gap-4 md:columns-3">
          {projects.map((project) => (
            <a
              className="group relative mb-4 block break-inside-avoid overflow-hidden rounded-xl bg-muted"
              href="#"
              key={project.id}
            >
              <img
                alt={project.alt}
                className={`${project.aspect} w-full object-cover transition-transform duration-500 group-hover:scale-[1.03]`}
                loading="lazy"
                src={photo(project.id)}
              />
              <div className="absolute inset-0 flex items-end bg-gradient-to-t from-black/70 via-black/20 to-transparent p-4 opacity-0 transition-opacity duration-300 group-hover:opacity-100 group-focus-visible:opacity-100">
                <div className="text-white">
                  <p className="font-semibold">{project.name}</p>
                  <p className="text-sm text-white/80">{project.year}</p>
                </div>
              </div>
            </a>
          ))}
        </div>
      </div>
    </section>
  );
}

Use it

Import it where you need it and update the import path to match your project.

Usage
import Gallery01 from '@/components/blocks/gallery-01';

export default function Page() {
  return <Gallery01 />;
}

Overview

Masonry grid with hover captions is a free image & gallery block for shadcn/ui and React Aria. It is built from plain markup and Tailwind CSS, and installs as a single file you own and can edit.

It only uses semantic tokens such as bg-background, text-muted-foreground and border-border, so it follows your theme, radius and fonts and switches with dark mode. It is responsive from desktop to mobile; the width controls above the preview show each size. The same layout is in the shadcn/ui Pro Figma kit, so design and code start from one source.

Component library
React Aria (react-aria-components)
Also available for
Radix UI, Base UI
Built with
Plain markup and Tailwind CSS
npm packages
None
Files
components/blocks/gallery-01.tsx
Access
Free, installs without a license key

Frequently asked questions

Pricing, installation and React Aria details for Masonry grid with hover captions.