---
title: Lightbox for Astro
description: "Astro image zoom and media previews built on Dialog."
sidebar:
    label: "Lightbox"
    badge: new
seo:
    title: Lightbox for Astro | Shadcn & Tailwind CSS
related:
    - /components/dialog
    - /components/lightbox-carousel
    - /components/lightbox-grid
---

```astro
---
import { Image } from "astro:assets"
import {
  Lightbox,
  LightboxContent,
  LightboxTrigger,
} from "@/components/ui/lightbox"
import type { RemoteImageProps } from "astro:assets"

const image = {
  src: "https://images.unsplash.com/photo-1470770841072-f978cf4d019e?w=1200&h=800&auto=format&fit=crop",
  alt: "Mountains reflected in a lake",
  width: 1200,
  height: 800,
  widths: [352, 704, 1056, 1200],
} satisfies RemoteImageProps
---

<div class="mx-auto w-full max-w-sm p-4">
  <Lightbox>
    <LightboxTrigger
      hoverZoom
      aria-label="View image: Mountains reflected in a lake"
    >
      <Image
        {...image}
        layout="constrained"
        fit="cover"
        sizes="auto, (max-width: 24rem) calc(100vw - 2rem), 22rem"
        loading="eager"
      />
    </LightboxTrigger>
    <LightboxContent
      label="Mountains reflected in a lake"
      caption="A quiet mountain lake."
    >
      <Image
        {...image}
        layout="full-width"
        fit="contain"
        sizes="min(1200px, 90vw, calc((100vh - 10rem) * 1.5))"
        loading="lazy"
      />
    </LightboxContent>
  </Lightbox>
</div>
```

## Usage

```astro
---
import { Image } from "astro:assets"
import { Lightbox, LightboxContent, LightboxTrigger } from "@/components/ui/lightbox"
import lake from "../assets/lake.jpg"
---

<Lightbox>
  <LightboxTrigger hoverZoom aria-label="Enlarge mountain lake">
    <Image src={lake} alt="Mountains reflected in a lake" />
  </LightboxTrigger>
  <LightboxContent label="Mountain lake" caption="A quiet morning.">
    <Image src={lake} alt="Mountains reflected in a lake" loading="lazy" />
  </LightboxContent>
</Lightbox>
```

`Lightbox` is a direct export of `Dialog`. `LightboxTrigger` is a thumbnail
button. `LightboxContent` includes the overlay, close button, hidden accessible
title, media container, and optional caption.

Set `label` to name the dialog. It does not replace the image's `alt` text.
`hoverZoom` adds a small preview scale on hover and respects reduced motion.
Keep links and buttons out of `LightboxTrigger`; it is already a button.

## Captions and media

Use `caption` for plain text. Use the `caption` slot for links or other markup.
The slot takes precedence over the prop.

```astro
<LightboxContent label="Mountain lake">
  <Image src={lake} alt="Mountains reflected in a lake" loading="lazy" />
  <span slot="caption">Photograph by <a href="#photographer">Alex Morgan</a>.</span>
</LightboxContent>
```

The default slot accepts an image, video, iframe, or custom layout. Put media
directly in the slot. `mediaClass` changes the inner container and its direct
child sizing; `class` changes the dialog panel.

Direct images, pictures, and videos stay centered and keep their aspect ratio.
The media container fits around them and caps their width at 90% of the
viewport or the available width, whichever is smaller. In the default variant,
click beside the media to close the lightbox. Carousels, iframes, and custom
layouts use the full media width.

```astro
<LightboxContent
  label="Document preview"
  mediaClass="mx-auto max-w-3xl *:h-[min(70dvh,720px)]"
>
  <iframe src={previewUrl} title="Document preview" class="border-0" />
</LightboxContent>
```

Give iframes a title and an explicit height or aspect ratio. The lightbox does
not stop video or iframe playback when it closes.

### Image loading

Use separate thumbnail and enlarged images so each can have suitable dimensions
and `sizes`. Astro can reuse matching image transforms. Keep the enlarged image
lazy. If you use `srcset`, specify the expected display width in `sizes`.
With `sizes="auto"`, the browser can use a 300px fallback for an image that
determines its own width. Use `priority` only for a key thumbnail visible on
initial page load.
See [Astro's image options](https://docs.astro.build/en/reference/modules/astro-assets/).

## Panel view

The default variant uses a dark backdrop and fills the screen. Set
`variant="panel"` for a centered panel.

```astro
---
import { Image } from "astro:assets"
import {
  Lightbox,
  LightboxContent,
  LightboxTrigger,
} from "@/components/ui/lightbox"
---

<div class="mx-auto w-full max-w-sm p-4">
  <Lightbox>
    <LightboxTrigger
      hoverZoom
      aria-label="View image: Mountains reflected in a lake"
    >
      <Image
        width={1200}
        height={800}
        class="aspect-3/2 w-full object-cover"
        src="https://images.unsplash.com/photo-1470770841072-f978cf4d019e?w=1200&h=800&auto=format&fit=crop"
        alt=""
        loading="lazy"
      />
    </LightboxTrigger>
    <LightboxContent
      variant="panel"
      label="Mountains reflected in a lake"
      caption="A quiet mountain lake."
    >
      <Image
        width={1200}
        height={800}
        src="https://images.unsplash.com/photo-1470770841072-f978cf4d019e?w=1200&h=800&auto=format&fit=crop"
        alt="Mountains reflected in a lake"
        loading="lazy"
      />
    </LightboxContent>
  </Lightbox>
</div>
```

## Installation

### Command

```sh
bunx --bun shadcn@latest add @gnostic/lightbox
```

### Manual

Complete the [Installation guide](/docs/installation) first. Then copy the component files below.

No extra packages are required.

#### src/components/ui/lightbox/index.ts

```ts
// Dialog supplies the root behavior. Lightbox supplies the media layout.
export { default as Lightbox } from '@/components/ui/dialog/dialog.astro'
export { default as LightboxContent } from './lightbox-content.astro'
export { default as LightboxTrigger } from './lightbox-trigger.astro'
export { default as LightboxImage } from './lightbox-image.astro'
export type {
    LightboxContentProps,
    LightboxImageProps,
    LightboxItemImage,
    LightboxProps,
    LightboxTriggerProps,
} from './types.ts'
```

#### src/components/ui/lightbox/types.ts

```ts
import type { ImageMetadata } from 'astro'
import type { LocalImageProps, RemoteImageProps } from 'astro:assets'

import type { LightboxPopupVariantProps } from './lightbox-variants.ts'
import type { DialogOptions } from '@/components/ui/dialog/types.ts'

/** Options for the dialog that shows the enlarged view. */
export type LightboxProps = Omit<DialogOptions, 'alertDialog'>

/** Props for the thumbnail button. */
export interface LightboxTriggerProps {
    /**
     * Scale the preview on hover.
     * Adds the class `hover:scale-105`.
     *
     * @default false
     */
    hoverZoom?: boolean
}

/** Props for the enlarged media view. */
export interface LightboxContentProps {
    /** Accessible name, rendered as a visually hidden dialog title. */
    label: string
    /** Text below the media. The caption slot takes precedence. */
    caption?: string
    /** Classes for the media container. */
    mediaClass?: string
    /**
     * `panel` centers the media in a dialog.
     * `default` fills the screen and uses a dark backdrop.
     *
     * @default 'default'
     */
    variant?: LightboxPopupVariantProps['variant']
    /**
     * Show the close button.
     *
     * @default true
     */
    showCloseButton?: boolean
    /** Extra classes for the backdrop. */
    overlayClass?: string
}

/** Options for the image zoom. Astro Image props apply to the thumbnail. */
export interface LightboxImageProps {
    /** Image to show on zoom. By default the zoom uses the thumbnail source. */
    zoomImage?: LocalImageProps | RemoteImageProps
}

type ImageSource =
    | { src: ImageMetadata; width?: number; height?: number }
    | { src: string; width: number; height: number; inferSize?: false }
    | { src: string; inferSize: true; width?: number; height?: number }

// Keep Astro's widths and densities options mutually exclusive.
type ViewProps<T = LocalImageProps> = T extends LocalImageProps
    ? Omit<T, 'src' | 'alt'>
    : never

/** Shared source and per-view Astro Image props for a grid tile or carousel slide. */
export type LightboxItemImage = ImageSource & {
    /** Description of the image and accessible name for its control. */
    alt: string
    /** Astro Image props for the thumbnail. Use CSS classes to crop the visible area. */
    thumbnail?: ViewProps
    /** Astro Image props for the enlarged view. */
    content?: ViewProps
}
```

#### src/components/ui/lightbox/lightbox-item-images.ts

```ts
import type { LocalImageProps, RemoteImageProps } from 'astro:assets'

import type { LightboxItemImage } from './types.ts'

/** Resolve the Astro props for both views of a gallery image. */
export function getLightboxImages(
    image: LightboxItemImage,
    view: 'zoom' | 'dialog',
) {
    if (!image?.alt?.trim())
        throw new Error('A lightbox image requires alt text.')
    const { thumbnail, content, ...source } = image

    function props(
        options: typeof thumbnail,
        widths: number[],
        sizes: string,
    ): LocalImageProps | RemoteImageProps {
        if (options?.densities) return { ...source, ...options }
        return {
            ...source,
            ...options,
            widths: options?.widths ?? widths,
            sizes: options?.sizes ?? sizes,
            densities: undefined,
        }
    }

    // A standalone zoom selects the larger candidates from the thumbnail's srcset.
    const widths =
        view === 'zoom' && !content
            ? [320, 640, 960, 1200, 1920]
            : [320, 640, 960]
    return {
        preview: props(thumbnail, widths, 'auto, 100vw'),
        enlarged: props(
            content,
            [640, 1200, 1920],
            view === 'zoom'
                ? '90vw'
                : '(min-width: 72rem) 70rem, calc(100vw - 4rem)',
        ),
    }
}
```

#### src/components/ui/lightbox/lightbox-image.astro

```astro
---
import type { ComponentProps } from "astro/types"
/**
 * Astro Image component with image zoom lightbox functionality.
 */
import { Image } from "astro:assets"
import { cn } from "cn"

import type { LightboxImageProps } from "./types.ts"

type Props = ComponentProps<typeof Image> & LightboxImageProps

const {
  zoomImage,
  widths = Astro.props.densities ? undefined : [100, 250, 500, 1000, 1250],
  class: className,
  ...props
} = Astro.props
---

<Image
  {...({ ...props, widths } as ComponentProps<typeof Image>)}
  data-slot="lightbox-image-trigger"
  role="button"
  tabindex={0}
  aria-label={`Enlarge image: ${props.alt}`}
  aria-expanded="false"
  class={cn(
    "focus-visible:outline-ring cursor-zoom-in focus-visible:outline-2 focus-visible:outline-offset-4 aria-expanded:opacity-0",
    className,
  )}
/>

{zoomImage && (
  <template data-lightbox-zoom>
    <Image {...zoomImage} />
  </template>
)}

<script>
  // Image-only zoom. Dialog remains the container for captions and carousels.
  type LightboxInstance = {
    close: (immediate?: boolean, restoreFocus?: boolean) => void
  }
  const selector = '[data-slot="lightbox-image-trigger"]'
  // only one image can be zoomed at a time
  let active: LightboxInstance | undefined

  /**
   * Open the lightbox with the given image
   */
  function open(image: HTMLImageElement) {
    // check the loading status of the image before opening the lightbox
    if (!image.complete || !image.naturalWidth) return
    active?.close(true, false)

    const rect = image.getBoundingClientRect()
    if (!rect.width || !rect.height) return

    // create the overlay element as a button so clicking outside the zoomed image closes it
    const overlay = document.createElement("button")
    overlay.type = "button"
    overlay.dataset.slot = "lightbox-overlay"
    overlay.setAttribute("aria-label", "Close enlarged image")
    overlay.className =
      "fixed inset-0 z-[100] m-0 size-full cursor-zoom-out border-0 bg-transparent p-0 text-foreground focus-visible:outline-none"

    // Fade only the backdrop so the image stays opaque throughout the zoom.
    const backdrop = document.createElement("span")
    backdrop.dataset.slot = "lightbox-backdrop"
    backdrop.setAttribute("aria-hidden", "true")
    backdrop.className =
      "pointer-events-none absolute inset-0 bg-background/95 backdrop-blur-sm"

    // Do not copy thumbnail classes, IDs, or responsive layout constraints.
    const template = image.nextElementSibling
    const fullImage =
      template instanceof HTMLTemplateElement &&
      template.hasAttribute("data-lightbox-zoom")
        ? template.content.querySelector("img")
        : null
    const zoomed = fullImage
      ? document.importNode(fullImage, true)
      : document.createElement("img")
    if (!fullImage) {
      zoomed.alt = image.alt
      zoomed.sizes = "90vw"
      zoomed.srcset = image.srcset
      zoomed.src = image.currentSrc || image.src
    }
    zoomed.dataset.slot = "lightbox-image"
    zoomed.draggable = false
    zoomed.classList.add(
      "absolute",
      "m-0",
      "max-h-none",
      "max-w-none",
      "origin-top-left",
      "object-contain",
    )

    const ratio =
      fullImage?.width && fullImage.height
        ? fullImage.width / fullImage.height
        : image.naturalWidth / image.naturalHeight
    const width = Math.min(
      window.innerWidth * 0.9,
      window.innerHeight * 0.9 * ratio,
    )
    const height = width / ratio
    const left = (window.innerWidth - width) / 2
    const top = (window.innerHeight - height) / 2

    Object.assign(zoomed.style, {
      width: `${width}px`,
      height: `${height}px`,
      left: `${left}px`,
      top: `${top}px`,
    })

    // scale the thumbnail to the zoomed image
    const thumbnailTransform = () => {
      const bounds = image.getBoundingClientRect()
      return `translate(${bounds.left - left}px, ${bounds.top - top}px) scale(${bounds.width / width}, ${bounds.height / height})`
    }
    const { matches: isReducedMotion } = window.matchMedia(
      "(prefers-reduced-motion: reduce)",
    )
    const timing: KeyframeAnimationOptions = {
      duration: isReducedMotion ? 0 : 300,
      easing: "cubic-bezier(0.2, 0, 0, 1)",
      fill: "both",
    }

    const events = new AbortController()
    let closing = false
    let removed = false

    overlay.append(backdrop, zoomed)
    document.body.append(overlay)
    image.setAttribute("aria-expanded", "true")
    overlay.focus({ preventScroll: true })

    let movement = zoomed.animate(
      [{ transform: thumbnailTransform() }, { transform: "none" }],
      timing,
    )
    let fade = backdrop.animate([{ opacity: 0 }, { opacity: 1 }], timing)

    function remove(restoreFocus: boolean) {
      if (removed) return
      removed = true
      events.abort()
      movement.cancel()
      fade.cancel()
      overlay.remove()
      image.setAttribute("aria-expanded", "false")
      if (active === instance) active = undefined
      if (restoreFocus && image.isConnected)
        image.focus({ preventScroll: true })
    }

    function close(immediate = false, restoreFocus = true) {
      if (immediate) return remove(restoreFocus)
      if (closing) return
      closing = true
      const transform = getComputedStyle(zoomed).transform
      const opacity = getComputedStyle(backdrop).opacity
      movement.cancel()
      fade.cancel()
      movement = zoomed.animate(
        [{ transform }, { transform: thumbnailTransform() }],
        timing,
      )
      fade = backdrop.animate([{ opacity }, { opacity: 0 }], timing)
      void movement.finished.then(
        () => remove(restoreFocus),
        () => {},
      )
    }

    const instance = { close }
    active = instance
    const { signal } = events
    overlay.addEventListener("click", () => close(), { signal })
    document.addEventListener(
      "keydown",
      (event) => {
        if (event.key === "Escape") {
          event.preventDefault()
          close()
        } else if (event.key === "Tab") {
          // Return to the thumbnail before the browser moves to the next control.
          close(true)
        }
      },
      { signal },
    )
    document.addEventListener(
      "scroll",
      () => {
        // A scroll queued before opening must not close the new zoom.
        const bounds = image.getBoundingClientRect()
        if (bounds.top !== rect.top || bounds.left !== rect.left) close(true)
      },
      {
        capture: true,
        passive: true,
        signal,
      },
    )
    window.addEventListener("resize", () => close(true), { signal })
  }

  // Delegation also covers examples inserted after the first page load.
  document.addEventListener("click", (event) => {
    const image = event.target
    if (image instanceof HTMLImageElement && image.matches(selector))
      open(image)
  })
  document.addEventListener("keydown", (event) => {
    const image = event.target
    if (!(image instanceof HTMLImageElement) || !image.matches(selector)) return
    if (event.key === "Enter" || event.key === " ") {
      event.preventDefault()
      if (!event.repeat) open(image)
    }
  })
  document.addEventListener("astro:before-swap", () =>
    active?.close(true, false),
  )
</script>
```

#### src/components/ui/lightbox/lightbox-content.astro

```astro
---
import type { HTMLAttributes } from "astro/types"

import { cn } from "cn"
import {
  DialogClose,
  DialogDescription,
  DialogOverlay,
  DialogPortal,
  DialogTitle,
} from "@/components/ui/dialog"
import {
  lightboxOverlayVariants,
  lightboxPopupVariants,
} from "./lightbox-variants.ts"
import type { LightboxContentProps } from "./types.ts"

type Props = HTMLAttributes<"div"> & LightboxContentProps

const {
  class: className,
  label,
  caption,
  mediaClass,
  overlayClass,
  showCloseButton = true,
  style: styleProp,
  variant = "default",
  ...props
} = Astro.props

if (!label?.trim()) throw new Error("LightboxContent requires a label.")

const style =
  typeof styleProp === "string"
    ? `z-index: calc(var(--dialog-content-stack-index, 0) * 2 + 101); ${styleProp}`
    : {
        "z-index": "calc(var(--dialog-content-stack-index, 0) * 2 + 101)",
        ...styleProp,
      }
---

<DialogPortal>
  <DialogOverlay
    class={cn(lightboxOverlayVariants({ variant }), overlayClass)}
  />
  <div
    data-slot="dialog-content"
    data-variant={variant}
    hidden
    class={cn(lightboxPopupVariants({ variant }), className)}
    style={style}
    {...props}
  >
    {showCloseButton && (
      <DialogClose
        variant="ghost"
        size="icon-sm"
        class={cn(
          "pointer-events-auto absolute top-4 right-4",
          variant === "default" && "text-white hover:bg-white/12",
        )}
      />
    )}
    <DialogTitle class="sr-only" data-lightbox-title>
      {label}
    </DialogTitle>
    <div
      data-slot="lightbox-media"
      class={cn(
        "size-full *:pointer-events-auto *:mx-auto *:h-auto *:max-h-[calc(100dvh-10rem)] *:w-full *:object-contain",
        "has-[>:where(img,picture,video)]:mx-auto has-[>:where(img,picture,video)]:size-fit has-[>:where(img,picture,video)]:max-w-[min(100%,90dvw)]",
        "[&>:where(img,picture,video)]:w-auto [&>:where(img,picture,video)]:max-w-full",
        "[&>picture]:block [&>picture>img]:h-auto [&>picture>img]:max-h-[calc(100dvh-10rem)] [&>picture>img]:w-auto [&>picture>img]:max-w-full",
        mediaClass,
      )}
    >
      <slot />
    </div>
    {(caption || Astro.slots.has("caption")) && (
      <DialogDescription
        class={cn(
          "pointer-events-auto shrink-0 text-center",
          variant === "default" && "mx-auto w-fit max-w-full text-white/80",
        )}
      >
        <slot name="caption">{caption}</slot>
      </DialogDescription>
    )}
  </div>
</DialogPortal>
```

#### src/components/ui/lightbox/lightbox-trigger.astro

```astro
---
import type { HTMLAttributes } from "astro/types"

import { cn } from "cn"
import type { LightboxTriggerProps } from "./types.ts"

type Props = Omit<HTMLAttributes<"button">, "type"> & LightboxTriggerProps

const { hoverZoom = false, class: className, ...props } = Astro.props

// The button clips the scale.
// hoverZoom adds hover:scale-105 on the preview.
---

<button
  data-slot="dialog-trigger"
  class={cn(
    "bg-muted grid w-full cursor-zoom-in overflow-hidden rounded-xl border-0 p-0 focus-visible:outline-2 focus-visible:outline-offset-3 focus-visible:outline-ring",
    className,
  )}
  {...props}
  type="button"
>
  <span
    data-slot="lightbox-preview"
    class={cn(
      "min-h-0 w-full [&_img]:pointer-events-none [&_img]:block [&_img]:max-w-full",
      hoverZoom &&
        "transition-transform duration-300 hover:scale-105 ease-in-out motion-reduce:transform-none motion-reduce:transition-none",
    )}
  >
    <slot />
  </span>
</button>
```

#### src/components/ui/lightbox/lightbox-variants.ts

```ts
import { cva, type VariantProps } from 'class-variance-authority'

/**
 * Classes for the enlarged panel.
 * `panel` centers the media. `default` fills the screen.
 */
export const lightboxPopupVariants = cva(
    'data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 duration-100 outline-none motion-reduce:animate-none!',
    {
        defaultVariants: {
            variant: 'default',
        },
        variants: {
            variant: {
                panel: 'bg-popover text-popover-foreground ring-foreground/10 @container/dialog fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-6xl -translate-x-1/2 -translate-y-1/2 gap-3 overflow-y-auto rounded-xl p-4 pt-14 text-sm ring-1 sm:max-w-6xl',
                default:
                    'pointer-events-none fixed inset-0 flex flex-col justify-center gap-4 overflow-visible bg-transparent px-3 py-16 text-white shadow-none ring-0',
            },
        },
    },
)

/**
 * Extra classes for the backdrop.
 * DialogOverlay supplies the base backdrop. These classes replace its color.
 * `panel` keeps that base. `default` uses a dark backdrop.
 */
export const lightboxOverlayVariants = cva('', {
    defaultVariants: {
        variant: 'default',
    },
    variants: {
        variant: {
            panel: '',
            default: 'bg-black/90',
        },
    },
})

export type LightboxPopupVariantProps = VariantProps<
    typeof lightboxPopupVariants
>
export type LightboxOverlayVariantProps = VariantProps<
    typeof lightboxOverlayVariants
>
```

Component classes use the preset configured during project setup. Select the same preset in the docs before copying Manual source. To change installed component classes, edit or reinstall their source. See [Theming](/docs/theming) for details.


## Simple image zoom

Use `LightboxImage` for a single image that expands from its position on the page.
It uses a small browser script and has no Dialog container. It accepts Astro
`Image` props, including `src`, `alt`, `widths`, and `sizes`.

By default, the zoom uses the thumbnail image. Pass Astro Image props in
`zoomImage` to use a separate crop, size, or source for the enlarged view.
The browser loads this image when the zoom opens.

Click the image, or use Enter or Space, to open it. Click again or press Escape
to close it. Scrolling, resizing, and page changes also close the zoom.
The animation respects reduced motion. Use the Dialog parts above for captions
and other media, or Lightbox Carousel for a gallery.

```astro
---
import { LightboxImage } from "@/components/ui/lightbox"

import image from "@/assets/images/beach-on-alien-planet.png"
---

<LightboxImage
  src={image}
  alt="Beach on alien planet"
  class="h-auto w-full max-w-sm rounded-2xl"
  fit="cover"
/>
```

## Custom composition

Use standard [Dialog parts](/ui/components/dialog) for custom titles, controls,
and panels. `LightboxContent` supplies its own title and caption; do not add a
second `DialogTitle` or `DialogDescription` inside it. Set `showCloseButton={false}`
only when the content includes another close control.

[Lightbox Carousel](/ui/components/lightbox-carousel) adds navigation between
items. [Lightbox Grid](/ui/components/lightbox-grid) arranges independent lightboxes.

## API reference

Source: [Lightbox registry item](/ui/r/lightbox.json).

### LightboxProps

Root options are inherited from Dialog.

<AutoTypeTable path="../../packages/ui/src/components/ui/lightbox/types.ts" name="LightboxProps" />

### LightboxImageProps

<AutoTypeTable path="../../packages/ui/src/components/ui/lightbox/types.ts" name="LightboxImageProps" />

### LightboxItemImage

Grid and carousel items share this image prop. Both use the source and alt text
for the thumbnail and the enlarged view. Use `thumbnail` or `content` for
per-view Astro Image props.

<AutoTypeTable path="../../packages/ui/src/components/ui/lightbox/types.ts" name="LightboxItemImage" />

### LightboxContent slots

| Prop | Type | Default | Description |
| - | - | - | - |
| `caption?` | `Astro content` | `caption prop` | Places a caption below the media. Use this slot to include links or other markup. |

### LightboxContentProps

<AutoTypeTable
    path="../../packages/ui/src/components/ui/lightbox/types.ts"
    name="LightboxContentProps"
/>

### LightboxTriggerProps

<AutoTypeTable
    path="../../packages/ui/src/components/ui/lightbox/types.ts"
    name="LightboxTriggerProps"
/>

## Migration

Replace `LightboxTitle` with the `label` prop. Put media directly inside
`LightboxContent` and move any `LightboxMedia` classes to `mediaClass`. Replace
`LightboxDescription` with `caption` or the `caption` slot. Rename
`variant="viewport"` to `variant="default"` or omit it. For custom panels,
import `DialogPortal`, `DialogOverlay`, and `DialogClose` from Dialog.

## Keyboard and layout

Dialog manages focus, Escape, outside clicks, and scroll locking. A close
control must remain available. Check tall media and long captions on a phone.
