Interaction JS behaviour

Lightbox

A gallery whose thumbnail grows into a full-screen viewer (View Transitions when available, a FLIP otherwise): wheel, pinch or double-tap zoom, pan, swipe for next/previous, keyboard, captions and a counter — in a native dialog.

Real scenarios

The component as it is used in a product — not a specimen grid.

A travel journal

Open a photo: the thumbnail itself grows into the viewer (a View Transition in Chromium and Safari, a FLIP elsewhere). Scroll or pinch to zoom around the pointer, double-tap to toggle, drag to pan; at 1× swipe sideways for the next one or down to close. Keyboard: arrows, +, −, 0, Escape.

Product detail shots

A tight square strip under a product title — the same viewer, four columns.

Right to left

Here “next” is to the left: the arrow keys and the swipe both follow the reading direction, and the counter speaks Persian.

Important props

Important props
Prop Type Default What it does
images array [] Each image: src, thumb (optional), alt and caption.
columns / ratio int / string 3 / '4 / 3' The grid’s columns and the thumbnails’ aspect ratio.
label string 'Gallery' The viewer’s accessible name.
openLabel string '{alt}, image {index} of {total}' Each thumbnail button’s name.

Snippet

<x-nx::lightbox :images="$photos" :columns="4" label="عکس‌های سفر" />