Image gallery

One large picture with the others as thumbnails that swap into it.

Example

tsx
<Stack style={{ maxWidth: "24rem" }}>
  <ImageGallery
    images={[{ url: "/share.png", alt: "Picture 1" }, { url: "/apple-touch-icon.png", alt: "Picture 2" }, { url: "/logo.svg", alt: "Picture 3" }]}
    columns={3}
    aspectRatio="1 / 1"
    fit="contain"
    rounded
  />
</Stack>

Usage

Pages are built on the server: import the tags from @dash/server and return the tree. The browser runtime draws it.
tsx
import { ImageGallery } from "@dash/server";

Props

ImageGalleryProps

Prop
Type
Description
images (required)ImageGalleryItem[]
columns2 | 3 | 4Thumbnails per row (default 3), each that share of the large picture's width; a short last row is centered. Fewer on a very narrow box, so each stays a comfortable target.
aspectRatiostring | numberThe shape of the large picture and of every thumbnail: `"1 / 1"` (default), `"4 / 3"` or `1.5`.
fit"cover" | "contain"How each picture fills its box (default `cover`).
loading"lazy" | "eager"`lazy` (default) defers the large picture until it nears the viewport. Thumbnails are always lazy.
roundedboolean | "full"Corners follow the theme: `true` is `--radius`, `"full"` is `--radius-full`.
labelstringThe name of the group of pictures. Set by the client from `dash.imageGallery.label`.
pictureLabelstringThe name of a thumbnail with no `alt`, with `{{current}}` and `{{count}}`. Set by the client from `dash.imageGallery.picture`.
PreviousImage scrub
NextLink
On this page