Gallery

Responsive thumbnail grid with selection, hover actions, and empty state.

Install

npx shadcn@latest add https://substrate.georgedrury.co.uk/r/gallery

Examples

Default

Sample 1
Sample 2
Sample 3
Sample 4
Sample 5
Sample 6
"use client"

import { useState } from "react"

Empty state

No images generated yet
import { Gallery, GalleryEmpty } from "@/components/substrate/gallery"

export default function GalleryEmptyDemo() {

Theme variables

VariableTailwind classFallbackDescription
--gallery-selectionring-gallery-selection--primarySelection ring colour

Components

ComponentDescription
GalleryCSS grid container with configurable columns and gap
GalleryItemAspect-square cell with selection ring, hover overlay, and click handler
GalleryImage<img> with object-cover filling the item
GalleryActionButton overlaid on hover in the top-right corner of an item
GalleryEmptyFull-width placeholder spanning all columns

Props

PropTypeDefaultDescription
columnsnumber3Number of grid columns
gapnumber2Gap between items (in 0.25rem units)

GalleryItem

PropTypeDefaultDescription
selectedbooleanfalseShows selection ring
onSelect() => void—Click handler

GalleryImage

Extends React.ComponentProps<"img">.

GalleryAction

Extends React.ComponentProps<"button">.