Theme Playground

Commerce

ImageLightbox

Controlled fullscreen image viewer with keyboard navigation plus zoom, pan, and pinch support for product and editorial galleries.

Best for

product detail gallerieseditorial image storieshigh-resolution asset viewingshared-element-ready fullscreen viewing

Import

import { ImageLightbox } from "@enadhq/enad-react-sdk/client/storefront"

When to use it

Use ImageLightbox when product images or editorial photography need a fullscreen viewing experience with zoom, pan, and multi-image navigation. It is the standard viewer for PDP image galleries where visitors want to inspect details at full resolution.

The lightbox is controlled for visibility: the parent page manages open state and decides what triggers it, whether that is a dedicated button, a thumbnail click, or a product image tap.

Composition notes

ImageLightbox is a controlled fullscreen overlay:

  • images is an array of ImageAsset objects with src, optional alt, and optional stable id values.
  • open and onOpenChange manage visibility.
  • activeIndex and onActiveIndexChange let the parent decide which image is currently visible. Use them with thumbnail grids or ProductImage to open directly to the clicked image and keep the inline gallery in sync.
  • defaultActiveIndex is available when the parent wants the viewer to manage active-image state after the initial open.
  • showThumbnails toggles a thumbnail rail at the bottom of the viewer for quick navigation between images.
  • viewTransitions exposes a progressive-enhancement hook for shared-element continuity when the host app supports it.

Behavior and theming guidance

The viewer supports keyboard navigation with Left, Right, and Escape, touch swipe between images, and pinch-to-zoom on mobile. Zoom and pan are powered by react-zoom-pan-pinch.

The overlay covers the full viewport with a dark background. The thumbnail rail sits at the bottom and marks the current image clearly without overpowering the main media. Keep the image array manageable for smooth thumbnail rendering, and keep ImageAsset.id stable when you enable view transitions so the browser can treat the hero image and fullscreen image as the same asset.

Examples

Live examples you can edit directly in the sandbox.

2 examples

Open from a primary action

A simple launch pattern for PDPs or editorial pages where the viewer opens from a dedicated control.

Launch from thumbnails with shared state

A natural PDP flow where the clicked thumbnail decides the fullscreen image and the parent keeps both gallery layers in sync.

Component Sets

Preview the first example across the available component-set presets to compare tone, spacing, and structural defaults.

Props

PropTypeDefaultDescription
imagesImageAsset[]
No description yet.
openboolean
No description yet.
onOpenChange(open: boolean) => void
No description yet.
activeIndexnumber
No description yet.
defaultActiveIndexnumber0
No description yet.
onActiveIndexChangestring
No description yet.
showThumbnailsbooleantrue
No description yet.
viewTransitionsstring
No description yet.
classNamestring
No description yet.