Lightbox
Component preview
A modal viewer that enlarges one media item and may let the user move through a related collection.
Build pack
Choose the task and destination. Technical names stay in English.
In your own words
Documented aliases: image viewer, media viewer, photo overlay
Try it
Compare all three behaviors
Shared comparison scenario: A project item opens a focused overlay while the underlying workspace remains unavailable until the user finishes or closes it.
This context stays fixed. Switch concepts to observe the mission, edge case, and specimen specific to each behavior.
Lightbox
Lightbox is a media-specific modal composition; a general Modal dialog handles tasks and an Alert dialog handles a consequential decision.
Your task
Open the second image, move to the next one with the keyboard, then close and return to the same thumbnail.
Edge case to verify
A failed image load preserves the caption and navigation, reports the failure in text, and never leaves an empty modal.
Mission
Open the second image, move to the next one with the keyboard, then close and return to the same thumbnail.
Select a marker directly on the specimen, or use the list below, to see its role. Hide the markers to operate the lab without obstruction.
Backdrop
The layer that separates a modal surface from inactive page content.
Contain focus
While modal, keyboard focus stays inside the surface until it closes.
Navigate media
Previous and next controls move through the collection without leaving the viewer.
Dismiss with Escape
Escape closes the temporary surface and returns focus to a sensible control.
Gallery view
Gallery view
Media expanded
Media expanded
Gallery view → Media expanded
A thumbnail is activated and its media opens with caption and navigation context.
Media expanded → Gallery view
Close or Escape dismisses the lightbox and restores focus to the originating thumbnail.
Dialog.Root
Equivalence caveat: Dialog supplies modal containment only; media navigation, captioning, loading, zoom, and gesture behavior are an explicit composition.
Verify binding sourceW3C WAI · standard · 2026-07-16
Claim covered: Lightbox: modal dialog labeling, initial focus, focus containment, Escape dismissal, and focus return guidance.
Radix Primitives · documentation · 2026-07-16
Claim covered: Lightbox: documented Radix Dialog parts, modal focus management, portals, overlay, and dismissal hooks.
Verified on 2026-07-16 · rev. 1