"use client";
import { Lightbox } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
images (required) | readonly LightboxImage[] | — | src, alt, caption, width, height, thumbnailSrc. |
closeLabel | string | from the message catalog | Accessible name of the close button (default from the message catalog). |
defaultOpen | boolean | — | Initial open state when uncontrolled. |
defaultValue | number | — | Index shown when opened (uncontrolled). |
loop | boolean | true | Wrap from the last image to the first (default true). |
onOpenChange | (open: boolean) => void | — | Called with the next open state. |
onValueChange | (index: number) => void | — | Called with the new value (only when it changes). |
open | boolean | — | Open state (controlled). |
thumbnails | boolean | — | Render a grid of thumbnail buttons that open the viewer. |
value | number | — | Current index (controlled). |
imagesrequiredreadonly LightboxImage[]
src, alt, caption, width, height, thumbnailSrc.
closeLabeldefault from the message catalogstring
Accessible name of the close button (default from the message catalog).
defaultOpenboolean
Initial open state when uncontrolled.
defaultValuenumber
Index shown when opened (uncontrolled).
loopdefault trueboolean
Wrap from the last image to the first (default true).
onOpenChange(open: boolean) => void
Called with the next open state.
onValueChange(index: number) => void
Called with the new value (only when it changes).
openboolean
Open state (controlled).
thumbnailsboolean
Render a grid of thumbnail buttons that open the viewer.
valuenumber
Current index (controlled).
Other props are passed to the root element (HTMLAttributes<HTMLDivElement>), including className, style, id and aria-* attributes.
const images = [
{ src: "/images/one.png", alt: "First" },
{ src: "/images/two.png", alt: "Second" },
];
<Lightbox images={images} thumbnails />