modal lightbox image gallery photo preview modal lightbox image gallery photo preview zoom fullscreen image lightbox modal photo gallery overlay
Modal Image
Fetch pattern JSON:
curl https://webspire.de/patterns/modal/image.json image.html
<div class="flex min-h-64 items-center justify-center">
<button type="button" onclick="this.nextElementSibling.hidden=false" class="rounded-lg bg-[var(--ws-modal-action-bg)] px-5 py-2.5 text-sm font-medium text-[var(--ws-modal-action-text)] shadow transition hover:opacity-90">View Image</button>
<div class="ws-modal fixed inset-0 z-50 flex items-center justify-center bg-[var(--ws-modal-overlay)] backdrop-blur-sm" hidden>
<div role="dialog" aria-modal="true" aria-labelledby="modal-image-caption" class="relative mx-4 w-full max-w-4xl">
<!-- Close button -->
<button type="button" onclick="this.closest('.ws-modal').hidden=true" class="absolute -top-12 right-0 flex h-9 w-9 items-center justify-center rounded-full bg-white/10 text-white transition hover:bg-white/20" aria-label="Close">
<svg class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"/>
</svg>
</button>
<!-- Image area -->
<div class="relative overflow-hidden rounded-2xl">
<div class="aspect-[16/10] bg-gradient-to-br from-indigo-400 via-purple-400 to-pink-400"></div>
<!-- Previous button -->
<button type="button" class="absolute left-3 top-1/2 flex h-10 w-10 -translate-y-1/2 items-center justify-center rounded-full bg-black/30 text-white transition hover:bg-black/50" aria-label="Previous image">
<svg class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5L8.25 12l7.5-7.5"/>
</svg>
</button>
<!-- Next button -->
<button type="button" class="absolute right-3 top-1/2 flex h-10 w-10 -translate-y-1/2 items-center justify-center rounded-full bg-black/30 text-white transition hover:bg-black/50" aria-label="Next image">
<svg class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5"/>
</svg>
</button>
</div>
<!-- Caption -->
<p id="modal-image-caption" class="mt-3 text-center text-sm text-white/80">Mountain landscape at sunset — Photo by Jane Doe</p>
</div>
</div>
</div>
Details
Responsive Dark Mode Tailwind Only SSR Safe Copy & Paste Requires JS
Stable Published
modallightboximagegalleryphotopreview
Slots
| Name | Required | Description |
|---|---|---|
| image | Yes | Large image display area. |
| navigation | No | Previous and next arrow buttons. |
| caption | No | Image caption text below the image. |
Image lightbox modal with a large 16:10 image area (gradient placeholder), close X button above, previous/next navigation arrows on the sides, and a caption below. Replace the gradient with an <img> element for production use.