Lightbox
lightboxA photo gallery whose thumbnails fly into a full-screen viewer and back again. Arrow keys, a thumbnail strip and swipe move between photos, and it is a Base UI dialog underneath, so focus is trapped and returns to the thumbnail you opened.
import { Lightbox } from "@/components/forme/lightbox/lightbox";
const photos = [
{
src: "/images/coast.webp",
alt: "A rocky coastline at dusk",
caption: "Cap de Creus, blue hour",
},
{
src: "/images/dunes.webp",
alt: "Sand dunes at golden hour",
caption: "Erg Chebbi, last light",
},
{
src: "/images/forest.webp",
alt: "Pines fading into violet fog",
caption: "Black Forest, 6 a.m.",
},
{
src: "/images/lake.webp",
alt: "Mountains reflected in a still lake",
caption: "String Lake, Wyoming",
},
{ src: "/images/meadow.webp", alt: "Wildflowers at sunset", caption: "Val d'Orcia in June" },
{ src: "/images/aurora.webp", alt: "Aurora over a mountain ridge", caption: "Senja, Norway" },
];
export function LightboxDemo() {
return (
<Lightbox
label="Travel photographs"
images={photos}
className="w-full sm:auto-rows-[10rem]"
thumbClassName={(index) => (index === 0 ? "sm:col-span-2 sm:row-span-2" : undefined)}
/>
);
}Install
Adds the component, its registry dependencies, and the token stylesheet you import once.
API reference
Read from the source, so it is the API of the file you install. A prop marked * is required.
Lightbox
A gallery whose thumbnails open into a full-screen viewer — and the photo itself flies from the grid into place, then flies back when you close it.
| Prop | Type | Default | Description |
|---|---|---|---|
images* | readonly LightboxImage[] | — | |
label* | string | — | Accessible name for the gallery. |
className | string | — | |
thumbClassName | (index: number) => string | undefined | — | Classes for each thumbnail button, e.g. a span for a featured image. |
Related


Dialog
A modal built on the Base UI primitive, so the focus trap, the inert background, Esc to close and the return of focus all come from one well tested place. The backdrop fades and the panel scales in, both in and out, and everything comes from the foundation tokens.
overlays

Drawer
A bottom sheet on the Base UI dialog, so it keeps the focus trap, Esc and focus return. Drag it down by the handle or header and it follows your finger, then springs back or closes when pulled past a third of its height or flicked.
overlays

Dropdown
A menu of actions revealed from a trigger. Grouped, with labels, a destructive variant, checkbox items, and full keyboard and typeahead support from the Base UI menu primitive — Forme adds only the surface and the motion.
overlays