Skip to content
Eskais UI

Overlays

Lightbox

A UI SDK Dialog that shows one image of a set: previous and next (buttons and arrow keys), a counter, the caption, an open-original link and fit or actual size. Dark variants follow the theme with no flash; agents get next, previous and goTo.

Example

Installation

npx shadcn@latest add @eskais/lightbox

Usage

Import
import { lightbox } from "@/components/ui/lightbox-primitive"import { ThemedImage } from "@/components/ui/themed-image"import { Lightbox, lightboxLabels, ThemedImage } from "@/components/ui/lightbox"

API reference

ThemedImage

PropTypeDefault
srcrequiredstring–
srcDarkShown instead of `src` while the page is dark. Both are rendered and CSS picks one, so nothing flashes.string–

Also takes ImgHTMLAttributes except src.

Lightbox

PropTypeDefault
itemsrequiredreadonly LightboxItem[]–
indexnumber–
defaultIndexnumber0
onIndexChangeIndexChange–
openboolean–
defaultOpenboolean–
onOpenChangeDialogProps["onOpenChange"]–
controllerDialogProps["controller"]–
finalFocusWhere focus goes on close; by default the trigger, or what was focused before it opened.ComponentProps<typeof DialogContent>["finalFocus"]–
labelsPartial<LightboxLabels>–
classNamestring–
childrenRendered inside the dialog root, like a `DialogTrigger`.ReactNode–

Other exports

lightboxlightboxLabelstype LightboxIndexChangeReasontype LightboxOptionstype ThemedImagePropstype LightboxItemtype LightboxLabelstype LightboxProps

Accessibility

  • Arrow keys move between images with a counter; focus returns to what opened it.
  • Sized in % of the top layer, never viewport units.

Agent actions

Agents see Image viewer with next, previous and goTo(index).

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.