v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS
Lightbox
Inspect images with native modal focus and zoom controls.
Interactive preview
Usage
import { Lightbox } from "@devvy-ui/react";
<Lightbox open={open} onOpenChange={setOpen} images={images} />API reference
Native HTML attributes, className, style and a forwarded ref are supported. Component-specific props:
| Prop | Type | Default | Description |
|---|---|---|---|
| images | GalleryImage[] | required | Image sources, descriptions and captions. |
| index / onIndexChange | number / callback | local 0 | Controlled image selection. |
| Dialog visibility/focus props | DialogProps | required | Modal behavior. |
Accessibility & behavior
Platform Behavior & Guidelines
Composes Dialog, image navigation, zoom range and an overflow region for panning. Image errors retain alt text. Use returnFocusRef for pointer invokers that browsers do not focus.
Source ownership
Run npx @devvy-ui/cli init once in your React project, then add the source:
npx @devvy-ui/cli add lightboxMake the source yours.
Start from the canonical implementation used by the package and registry. Change the code, keep the MIT notice, and build the behavior your project needs.
Lightbox.tsxREACT / TSX
Edit your own copy. Downloaded source uses your changes; the component preview above uses the shipped version. Run the source installer first to include shared helpers.