Lightbox
A modal image and video viewer with gallery navigation.
A modal image and video viewer with gallery navigation.
Backed by Base UI Dialog for upstream behavior and configuration. Zenos owns the public API, styling, and composition shown on this page.
The examples use photographs from Unsplash by ConfinedRiley, Tim G, and Sebastian Schuster.
Import
Section titled “Import”import { Lightbox } from "@zentara-co/zenos-ui";Lightbox is a controlled or uncontrolled fullscreen viewer. The application owns the trigger so the same viewer can open from a button, thumbnail, or other product-specific surface.
Gallery
Section titled “Gallery”Pass an ordered media array to enable previous, next, counter, and arrow-key navigation. Control index when external triggers must open a specific item.
Zoom and pan
Section titled “Zoom and pan”Set hasZoom for images that benefit from close inspection. Users can double-click, press Enter or Space, or use + and − to change zoom. Arrow keys pan while zoomed, and pointer dragging is also supported.
Set a media item’s type to "video" to render native video controls. hasAutoPlay requests playback when the viewer opens; browser autoplay policy still applies.
API
| Prop | Type | Default | Description |
|---|---|---|---|
media | LightboxMedia | LightboxMedia[] | — | A single image or video, or an ordered gallery. |
open | boolean | — | Controlled open state. |
defaultOpen | boolean | false | Initial uncontrolled state. |
onOpenChange | (open: boolean, eventDetails) => void | — | Runs when visibility changes. |
index / defaultIndex | number | 0 | Controlled or initial gallery index. |
onIndexChange | (index: number) => void | — | Runs when gallery navigation requests another item. |
hasZoom | boolean | false | Enables image zoom and pan. |
hasAutoPlay | boolean | false | Starts video playback automatically. |
className / style | string / CSSProperties | — | Customizes the fullscreen viewer popup. |
Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props,
including className, style, aria-*, and data-*.
Accessibility
Section titled “Accessibility”Lightbox uses Base UI Dialog for modal focus management, Escape handling, outside interaction, and focus restoration. Every media item requires meaningful alt text, which also names the dialog and video. Captions describe the active item. Left and Right Arrow navigate a gallery when focus is on the viewer, and the counter announces index changes politely. Reduced-motion preferences disable viewer animations.