Lightbox

Full-screen media viewer with gallery navigation, keyboard controls, and zoom.

Gallery

Click any thumbnail to open the fullscreen viewer. Use the on-screen arrows, the keyboard / keys, or Esc to navigate and close.

5 images · click a thumbnail to open the lightbox

<div x-data="lightboxDemo(images)">
  <!-- Thumbnail strip -->
  <button @click="open(idx)" :class="{ 'sc-lightbox-thumb--active': idx === activeIndex }">
    <img :src="img.thumb" :alt="img.caption">
  </button>

  <!-- Fullscreen dialog (DaisyUI native <dialog>) -->
  <dialog class="modal sc-lightbox-dialog" x-ref="dialog" @keydown="onKeydown($event)">
    <div class="modal-box">
      <img :src="current?.src" @click="toggleZoom()">
      <button @click="prev()">‹</button>
      <button @click="next()">›</button>
    </div>
  </dialog>
</div>

Single image

When there's only one image, navigation controls and the counter are left out rather than disabled — there's nothing to navigate to.

Single image · no gallery controls

States

Beyond the open/closed dialog itself, a real lightbox needs a loading state for the full-resolution image and an empty state for a gallery prop with zero items.

Loading

Empty gallery

No images to display