Gallery

Pictures with captions in a grid, in masonry columns or on a carousel. A click opens one in a lightbox, stepped through with its arrows or the arrow keys.

Gallery

Your headline goes here

A short line about the pictures goes here.

  • Caption 1
  • Caption 2
  • Caption 3
  • Caption 4
  • Caption 5
  • Caption 6
import { Gallery, type GalleryItem } from "@produkto/ui/Gallery";

const items: GalleryItem[] = [
  {
    src: "https://picsum.photos/id/10/1200/900",
    alt: "Picture 1",
    caption: "Caption 1",
  },
  {
    src: "https://picsum.photos/id/11/1200/900",
    alt: "Picture 2",
    caption: "Caption 2",
  },
  {
    src: "https://picsum.photos/id/15/1200/900",
    alt: "Picture 3",
    caption: "Caption 3",
  },
  {
    src: "https://picsum.photos/id/16/1200/900",
    alt: "Picture 4",
    caption: "Caption 4",
  },
  {
    src: "https://picsum.photos/id/17/1200/900",
    alt: "Picture 5",
    caption: "Caption 5",
  },
  {
    src: "https://picsum.photos/id/28/1200/900",
    alt: "Picture 6",
    caption: "Caption 6",
  },
];

const Example = () => (
  <Gallery
    description="A short line about the pictures goes here."
    eyebrow="Gallery"
    items={items}
    title="Your headline goes here"
  />
);

export default Example;

Usage

import { Gallery, type GalleryItem } from "@produkto/ui/Gallery";
const items: GalleryItem[] = [
  { src: "/one.jpg", alt: "Picture 1", caption: "Caption 1", width: 1200, height: 900 },
  { src: "/two.jpg", alt: "Picture 2", width: 900, height: 1200 },
];

<Gallery
  layout="grid | masonry | carousel"
  columns={3}
  eyebrow="Gallery"
  title="Your headline goes here"
  description="A short line about the pictures goes here."
  items={items}
/>

Examples

Masonry

layout="masonry" flows the pictures down CSS columns at their own shape. width and height hold each one's place before it loads.

Gallery

Your headline goes here

A short line about the pictures goes here.

  • Caption 1
  • Caption 3
  • Caption 5
  • Caption 7
  • Caption 9
import { Gallery, type GalleryItem } from "@produkto/ui/Gallery";

const items: GalleryItem[] = [
  {
    src: "https://picsum.photos/id/10/900/1200",
    alt: "Picture 1",
    caption: "Caption 1",
    width: 900,
    height: 1200,
  },
  {
    src: "https://picsum.photos/id/11/1200/800",
    alt: "Picture 2",
    width: 1200,
    height: 800,
  },
  {
    src: "https://picsum.photos/id/15/1000/1000",
    alt: "Picture 3",
    caption: "Caption 3",
    width: 1000,
    height: 1000,
  },
  {
    src: "https://picsum.photos/id/16/1200/900",
    alt: "Picture 4",
    width: 1200,
    height: 900,
  },
  {
    src: "https://picsum.photos/id/17/900/1200",
    alt: "Picture 5",
    caption: "Caption 5",
    width: 900,
    height: 1200,
  },
  {
    src: "https://picsum.photos/id/28/1200/800",
    alt: "Picture 6",
    width: 1200,
    height: 800,
  },
  {
    src: "https://picsum.photos/id/29/1000/1000",
    alt: "Picture 7",
    caption: "Caption 7",
    width: 1000,
    height: 1000,
  },
  {
    src: "https://picsum.photos/id/37/1200/900",
    alt: "Picture 8",
    width: 1200,
    height: 900,
  },
  {
    src: "https://picsum.photos/id/13/900/1200",
    alt: "Picture 9",
    caption: "Caption 9",
    width: 900,
    height: 1200,
  },
];

const Example = () => (
  <Gallery
    description="A short line about the pictures goes here."
    eyebrow="Gallery"
    items={items}
    layout="masonry"
    title="Your headline goes here"
  />
);

export default Example;

One wide over three

layout="strip" sets the first picture wide across the row and the next three under it.

Gallery

Your headline goes here

A short line about the pictures goes here.

import { Gallery, type GalleryItem } from "@produkto/ui/Gallery";

const items: GalleryItem[] = [
  {
    src: "https://picsum.photos/id/10/1200/900",
    alt: "Picture 1",
  },
  {
    src: "https://picsum.photos/id/11/1200/900",
    alt: "Picture 2",
  },
  {
    src: "https://picsum.photos/id/15/1200/900",
    alt: "Picture 3",
  },
  {
    src: "https://picsum.photos/id/16/1200/900",
    alt: "Picture 4",
  },
];

const Example = () => (
  <Gallery
    description="A short line about the pictures goes here."
    eyebrow="Gallery"
    items={items}
    layout="strip"
    title="Your headline goes here"
  />
);

export default Example;

Moving row

layout="marquee" drifts the pictures across the page without end on the kit's Marquee, each still opening large on a click.

Gallery

Your headline goes here

A short line about the pictures goes here.

import { Gallery, type GalleryItem } from "@produkto/ui/Gallery";

const items: GalleryItem[] = [
  {
    src: "https://picsum.photos/id/10/1200/900",
    alt: "Picture 1",
  },
  {
    src: "https://picsum.photos/id/11/1200/900",
    alt: "Picture 2",
  },
  {
    src: "https://picsum.photos/id/15/1200/900",
    alt: "Picture 3",
  },
  {
    src: "https://picsum.photos/id/16/1200/900",
    alt: "Picture 4",
  },
  {
    src: "https://picsum.photos/id/17/1200/900",
    alt: "Picture 5",
  },
  {
    src: "https://picsum.photos/id/28/1200/900",
    alt: "Picture 6",
  },
];

const Example = () => (
  <Gallery
    description="A short line about the pictures goes here."
    eyebrow="Gallery"
    items={items}
    layout="marquee"
    title="Your headline goes here"
  />
);

export default Example;

Columns

columns sets two to four pictures a row on a wide screen, here four without captions, centred on a muted band with an action under them.

Gallery

Your headline goes here

A short line about the pictures goes here.

import { Gallery, type GalleryItem } from "@produkto/ui/Gallery";
import type { BlockAction } from "@produkto/ui/Section";

const pictures: number[] = [10, 11, 15, 16, 17, 28, 29, 37];

const items: GalleryItem[] = pictures.map((picture, i) => ({
  src: `https://picsum.photos/id/${picture}/1200/900`,
  alt: `Picture ${i + 1}`,
}));

const actions: BlockAction[] = [
  { label: "Primary action", link: "#", appearance: "outline" },
];

const Example = () => (
  <Gallery
    actions={actions}
    align="center"
    columns={4}
    description="A short line about the pictures goes here."
    eyebrow="Gallery"
    items={items}
    muted
    title="Your headline goes here"
  />
);

export default Example;

API Reference

Gallery

GalleryProps · blocks/Gallery/Gallery.types.ts
PropTypeDefault
itemsGalleryItem[]-
layoutGalleryLayout"grid" | "masonry" | "carousel" | "strip" | "marquee""grid"
columnsGalleryColumns2 | 3 | 43
actionsBlockAction[]-
idstring-
eyebrowstring-
titleReactNode-
descriptionReactNode-
alignSectionAlign"start" | "center" | "end""start"
mutedbooleanfalse
classNamestring-

GalleryLightbox

GalleryLightboxProps
PropTypeDefault
itemsrequiredGalleryItem[]-
indexrequirednumber-
openrequiredboolean-
onOpenChangerequired(open: boolean) => void-
onIndexChangerequired(index: number) => void-

GalleryItem

used by items
PropTypeDefault
srcrequiredstring-
altrequiredstring-
captionstring-
widthnumber-
heightnumber-

BlockAction

used by actions
PropTypeDefault
appearanceButtonAppearance"solid" | "soft" | "outline" | "transparent"-
toneButtonTone"neutral" | "accent" | "destructive" | "success" | "warning" | "info"-
iconReactNode-
iconOnlyboolean-
borderRadiusBlockActionBorderRadius"none" | "xs" | "sm" | "base" | "lg" | "xl" | "full"-
labelrequiredstring-
linkrequiredstring-