molecules
Lightbox dialog
The shared native dialog for the lightbox, with a close button, the enlarged media, and an optional caption.
Specimens
{{ LightboxDialog.render({
alt: "A sample enlarged image",
caption: "The caption sits beside the image at large widths.",
src: (collections.projectPages | filterByKey("slug", "connecting-a-world-famous-dj-with-his-fans") | first).decisions.0.artifact.asset.url
}) }}Params
Pass one of src, picture, or video.
| Param | Type | Description |
|---|---|---|
src | string | Image URL. Used when neither picture nor video is set. |
picture | string | Pre-rendered <picture>/<img> HTML. Wins over src. |
video | object | { src, poster }. Wins over picture and src. |
alt | string | Alt text for src. First choice for the dialog’s aria-label. |
caption | string | Shown beside the media at lg and up, and below it under lg. |
width | number | Intrinsic width of src. Set with height to reserve the aspect ratio while the image loads. |
height | number | Intrinsic height of src. |
Notes
Callers own the trigger button and the root data-lightbox-el="root". Each instance adds a module script tag, which the browser dedupes.