Lightbox

A grid of pictures. Click one and it grows out of its place into a viewer; swipe, use arrows or keys to move on. Overlays.

Open playground

About

Lightbox is a React component in the Overlays category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { Lightbox } from "@ashutoshswamy/smoui" and set images, columns.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { Lightbox } from "@ashutoshswamy/smoui";

<Lightbox columns={3} images={[{ src: "/a.jpg", alt: "Dawn", caption: "First light" }, { src: "/b.jpg", alt: "Harbor" }]} />

Props 2

images

Without `src` a mesh is drawn from `alt`.

{ src?; alt; caption? }[]
columns

Grid columns.

numberdefault 3