Skip to main content

Examples

Complete, copyable components that run on the page - portfolio grid with captions and crossfade, photos in an article, product carousel, Tailwind lightbox, custom caption and counter, and a custom viewer.

Each example runs on this page with the real package. The code under it is the same file, so you can copy it unchanged. Every example takes a photos prop: pass your own PhotoItem[].

Portfolio grid

Columns with a caption under each photo. The column count follows the container width, and the lightbox crossfades between photos.

River canyon with moss-covered walls
Moss Canyon
Dandelion seed heads in evening light
Seed Heads
Wall covered in open book pages
Paper Wall
Orange tulips at the edge of a forest
Forest Tulips
Sea of clouds under a blue sky
Above the Clouds
Road through tall trees in fog
Fog Road

Photos in an article

A lead photo and an album share one PhotoGroup, so the lightbox moves through all photos of the article in one order.

A slow week in the hills

Green mountain ridge with a footpath
Green Ridge

We walked the ridge every morning before the heat. The grass turned amber by evening, and the old stones in the meadow made a good place to rest.

Tall grass backlit by the setting sun
Large stones in a green meadow
Road through tall trees in fog

Open any photo: the arrows move through the whole article, not only one block.

A carousel with thumbnails next to the product details. Select the large photo to open the lightbox.

Print, 50 × 70 cm

Moss Canyon

Archival pigment print on matte cotton paper. Swipe through the photos, or select one to see it large.

Custom caption and counter

The built-in lightbox with its own counter, a two-line caption, and a wider mat around the photo.

River canyon with moss-covered walls
Dandelion seed heads in evening light
Wall covered in open book pages
Orange tulips at the edge of a forest
Sea of clouds under a blue sky
Road through tall trees in fog

Tailwind lightbox

A lightbox built from the lower-level components and styled only with Tailwind utilities. Your app needs Tailwind; see Style and theme.

River canyon with moss-covered walls
Dandelion seed heads in evening light
Wall covered in open book pages
Orange tulips at the edge of a forest
Sea of clouds under a blue sky
Road through tall trees in fog
City skyline at dusk under a dramatic sky
Bicycle in front of a yellow shopfront
Green mountain ridge with a footpath
Tall grass backlit by the setting sun
Large stones in a green meadow
Tools and ropes hanging in a workshop

Custom viewer in plain CSS

Your own markup and CSS. Nuxt Photo still handles gestures, zoom, keyboard, and focus.