Xzero UI
Pro library

Lightbox galleryPro

A masonry grid where photos zoom from their slot into a viewer you can swipe, pinch, and drag away.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/lightbox-gallery
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/lightbox-gallery

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { LightboxGallery } from "@/components/xzero/lightbox-gallery/lightbox-gallery";

const photos = [
  { src: "/trip/harbor.jpg", width: 1600, height: 1067, alt: "Boats in a harbor at dawn", title: "Harbor", caption: "May 2026" },
  { src: "/trip/alley.jpg", width: 1067, height: 1600, alt: "Narrow alley with lanterns", title: "Old town" },
  { src: "/trip/cliffs.jpg", width: 1600, height: 1200, alt: "Cliffs over the sea" },
];

export function TripPhotos() {
  return <LightboxGallery images={photos} label="Trip photos" minColumnWidth={180} />;
}

API reference

LightboxGallery

A masonry grid of photos that open in a fullscreen viewer. The tapped photo zooms out of its grid slot and flies back to the slot of whichever photo is showing when the viewer closes.

PropTypeDefaultDescription
images (required){ src: string; width: number; height: number; alt: string; title?: string; caption?: string }[]–Photos in reading order. width and height are the intrinsic size, which sets the aspect ratio in the grid, zoom, and return flight. title and caption are the two caption lines.
minColumnWidthnumber150Columns are added while each stays at least this wide, in px. There are always at least two.
gapnumber8Gap between photos in px.
labelstring"Photo gallery"Accessible name of the gallery and its viewer.
classNamestring–Class on the root region.

Keyboard interactions

KeysAction
Enter / SpaceOpen the focused photo in the viewer.
Arrow Left / Arrow RightPrevious or next photo in the viewer.
+ / - / 0Zoom in, zoom out, or reset zoom.
EscapeClose the viewer; focus returns to the matching grid photo.
TabCycles within the viewer's controls while it is open.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in galleries

Guidance for AI tools

Lightbox gallery: A masonry grid where photos zoom from their slot into a viewer you can swipe, pinch, and drag away. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components