Skip to content

Lightbox

Fullscreen dialog for viewing image or video media, with optional gallery navigation.

Forest path
Morning light through a forest path.
<LightboxStory {...args} media={imageMedia[0]} />
Forest path
Morning light through a forest path.
1 / 3
<LightboxStory {...args} media={imageMedia} />
<LightboxStory {...args} media={videoMedia} />
Forest path
Morning light through a forest path.
1 / 3
<LightboxStory {...args} media={mixedMedia} />
Forest path
Morning light through a forest path.
1 / 3
<LightboxStory {...args} media={imageMedia} />
Forest path
Morning light through a forest path.
<LightboxStory {...args} media={imageMedia[0]} />
<LightboxStory {...args} media={videoMedia} />
Mountain lake
A clear alpine lake below snow-covered mountains.
2 / 3
<ControlledIndexStory {...args} />
Forest path
Morning light through a forest path.
<HookStory />
Forest path
Mountain lake
Desert ridge
Forest path
Morning light through a forest path.
1 / 3
<HookGalleryStory />

Fullscreen dialog for viewing image or video media, with optional gallery navigation.

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the dialog.
data-testidstringTest ID applied to the dialog.
defaultIndexnumber0Initial gallery index for uncontrolled usage.
hasAutoPlaybooleanfalseWhether videos autoplay when opened.
hasZoombooleanfalseWhether images can be double-clicked to zoom.
indexnumberControlled gallery index.
isOpen*booleanWhether the lightbox is open.
media*LightboxMedia | ReadonlyArray<LightboxMedia>Media to display.
onIndexChange(index: number) => voidCalled when gallery index changes.
onOpenChange*(isOpen: boolean) => voidCalled when the lightbox requests an open-state change.
refRef<HTMLDialogElement>Ref forwarded to the dialog element.
styleCSSPropertiesInline styles applied to the dialog.