Contact Us

Gallery

DOC-00118 reference implementor, developer

A CSS grid image gallery that composes LightboxImage for lightbox integration. Images are arranged in a configurable grid with optional captions. Clicking an image opens the page-level Lightbox overlay.

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

Props

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

GalleryItem type (from src/lib/gallery-types.ts):

type GalleryItem = {
  src: string;
  alt: string;
  hires?: string;
  caption?: string;
};

Usage

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

const images = [
  { src: "/images/photo-1.jpg", alt: "Photo 1", caption: "First image" },
  { src: "/images/photo-2.jpg", alt: "Photo 2" },
  { src: "/images/photo-3.jpg", alt: "Photo 3", caption: "Third image" },
];
---

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

{/* Page-level Lightbox required — Gallery does not include its own */}
<Lightbox />

Accessibility

  • Each image is wrapped in a <figure> element with an optional <figcaption> for captions.
  • Images use LightboxImage which renders accessible <a> + <img> markup with proper alt text.
  • Gallery does not include its own <Lightbox> — it relies on the page-level Lightbox contract. A <Lightbox /> component must be present on the page for lightbox functionality.
  • Without JavaScript, clicking an image follows the link to the full-size image (progressive enhancement).
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.