Skip to content

Components

Gallery, lightbox and compare

Three components about pictures: the gallery is the index, the lightbox is one item, and the compare slider is the difference between two.

import { ImageCompare, ImageGallery, Lightbox } from "@luc/ui";

Gallery

A grid of thumbnails is an index; every image carries an `alt`, because a set of unlabelled pictures is a blank page to a screen reader.

Lightbox

The viewer is built on the shared Dialog, so focus trapping, Escape, scroll locking and focus restore all come from the same place; the arrow keys walk the set and + / − zoom.

Arrow keys walk the set, + and − zoom, Escape closes.

Before and after

The wipe is a real `range` input rather than custom pointer handling, which is why keyboard stepping, click-to-position and the accessible name all come from the platform.

Same capture after processingRaw capture before processing

Public API

All three render; none of them decodes, resizes, caches or uploads.

Component props
PropTypeDefaultNotes
GalleryImage.altstring—Required on every image — a gallery without labels is unusable.
ImageGallery.columns2 | 3 | 4—Grid column preset.
ImageGallery.lightboxboolean—Whether the built-in viewer opens on activation; turn it off to handle `onOpen` yourself.
ImageCompare.valuenumber—0–100, the share of the frame given to the “before” image.
ImageCompare.before/afterCompareImage—The `src` and `alt` of each of the two images.
Luc UI v1.0Media overviewdark theme