Contact Us

MasonryGallery

DOC-00120 reference implementor, developer

A CSS columns-based masonry layout for images. Uses the columns CSS property (not CSS Grid) for a true masonry effect where items fill columns top-to-bottom. Composes LightboxImage for lightbox integration, sharing the same GalleryItem type as Gallery.

File: src/core/components/ui/MasonryGallery.astro

Props

PropTypeDefaultNotes
itemsGalleryItem[]requiredArray of gallery items (shared type with Gallery)
columnsnumber3Number of masonry columns
gap"sm" | "md" | "lg""md"Gap between items
groupstringauto-generatedLightbox group name for navigation grouping
classstringAdditional CSS classes

Usage

---
import MasonryGallery from "@core/components/ui/MasonryGallery.astro";
import Lightbox from "@core/components/ui/Lightbox.astro";

const images = [
  { src: "/images/tall.jpg", alt: "Tall image" },
  { src: "/images/wide.jpg", alt: "Wide image", caption: "A caption" },
  { src: "/images/square.jpg", alt: "Square image" },
];
---

<MasonryGallery items={images} columns={3} />

{/* Page-level Lightbox required */}
<Lightbox />

Accessibility

  • Each image is wrapped in a <figure> with optional <figcaption> for captions.
  • Uses LightboxImage for accessible image markup with proper alt text.
  • Does not include its own <Lightbox> — relies on the page-level Lightbox contract.
  • CSS columns layout may order items differently than source order in some browsers. Items flow top-to-bottom within each column rather than left-to-right across rows.
REQ-00044 implemented The theme shall include a limited set of composite components.
REQ-00272 implemented The theme shall provide layout and content components covering standard content block patterns (separator, button group, columns, media-text, pullquote, reading time, table, gallery, masonry gallery, cover, timeline).

Search

Search across pages and articles. Use arrow keys to navigate results.

Search across pages and articles.

Loading search...

Search is unavailable. Please try again later.

    No results for ""

    Try different keywords or fewer words.