Gallery

A grid of images that open in a lightbox.

Source

Product screenshots

Select a screenshot to inspect it.

Experiments: compare variants and inspect results.
Business intelligence: query your data in PostHog.

Photos and merch in columns

Images keep their proportions in CSS columns.

The Toronto builder community.
A mug hog from the PostHog EU page.
PostHog on campus at UC Davis.
Merch for the PostHog startup program.

Usage

These are defaults, not laws. Break one when you have a good reason, or when it makes the design more cohesive or more interesting.

  • Use Gallery for a set of screenshots or photos that users may want to see larger.
  • Give each image width and height from its metadata to stop layout shift, and write alt text. A caption does not replace alt text.
  • Do not put links or buttons in thumbnails or captions.

API

Gallery is a site component. It uses the library Dialog for an image lightbox.

Gallery

PropTypeDefaultDescription
itemsGalleryItem[]–The images in keyboard and lightbox order.
labelstring–Names the image group and the lightbox.
layout'grid' | 'columns''grid'Uses rows or CSS columns.
columns1 | 2 | 3 | 43Sets the maximum column count. Narrow containers show one column.
classNamestring–Adds classes to the outer container.
framebooleantrueShows the raised surface around each thumbnail.
renderThumbnail(item: GalleryItem) => ReactNode–Replaces the thumbnail content. Gallery keeps the button and lightbox behavior.
showThumbnailCaptionsbooleantrueShows captions below thumbnails. Lightbox captions remain visible.

GalleryItem

PropTypeDefaultDescription
imageLightstring–The image URL. It also serves dark mode when imageDark is absent.
imageDarkstring–The optional dark image URL.
altstring–Describes the image and names its thumbnail button.
captionReactNode–The visible caption below the image.
width / heightnumber–The intrinsic dimensions from image metadata.