Skip to main content

molecules

Lightbox dialog

The shared native dialog for the lightbox, with a close button, the enlarged media, and an optional caption.

Specimens

Image dialog The dialog is closed, so the frame looks empty. It opens only when a media figure with zoom triggers it through the lightbox script.
A sample enlarged image
The caption sits beside the image at large widths.
{{ 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.

ParamTypeDescription
srcstringImage URL. Used when neither picture nor video is set.
picturestringPre-rendered <picture>/<img> HTML. Wins over src.
videoobject{ src, poster }. Wins over picture and src.
altstringAlt text for src. First choice for the dialog’s aria-label.
captionstringShown beside the media at lg and up, and below it under lg.
widthnumberIntrinsic width of src. Set with height to reserve the aspect ratio while the image loads.
heightnumberIntrinsic 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.