Staaarter

Artist Room Index

Groups an exhibition into artist rooms, each pairing a sticky statement column with a grid of that artist's works. Opening any work shows it large alongside a small thumbnail of the next piece in the show, letting a visitor step straight into it without closing the viewer.

By Staaarter Team
Gallery
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its media-slot dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/artist-room-index.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/gallery/gallery9.tsx instead.

Usage

The file also exports gallery9Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Gallery9, gallery9Demo } from "@/components/blocks/gallery/gallery9";

export default function Page() {
  return <Gallery9 {...gallery9Demo} />;
}

Props

PropTypeDefaultDescription
eyebrowstringundefinedSmall label above the heading; omitted entirely when unset.
headingReactNodenoneSection heading.
descriptionstringundefinedSupporting copy under the heading.
roomsGallery9Room[]noneExhibition rooms, each with an artist statement and its own works grid.
classNamestringundefinedExtra classes for the outer section element.

Types

interface Gallery9Work {
  title: string;
  year: string;
  image?: { src: string; alt: string };
}

interface Gallery9Room {
  room: string;
  artist: string;
  statement: string;
  works: Gallery9Work[];
}

Behavior notes

  • Real client-side state: `openIndex` (number | null) tracks which work the viewer is showing, indexed into a flattened list of every room's works built fresh on each render (not stored in state, so it always reflects the current `rooms` prop).
  • The viewer supports ArrowLeft/ArrowRight and Escape via a keydown listener registered in useEffect only while a work is open, removed on close/unmount.
  • The 'next' thumbnail inside the open viewer is a real button, not decorative: clicking it sets `openIndex` straight to the next work in the flattened list, the same target ArrowRight would move to, so a visitor can step through the whole show without returning to the grid.
  • The statement column uses `md:sticky md:top-24` so it stays in view while its room's works grid scrolls past on larger screens; it's a static column on mobile.
  • Close button and the next-work thumbnail are real `<button>` elements with descriptive `aria-label`s.
  • "use client" component, so its demo props live in the sibling gallery9.demo.tsx file per this repo's client/demo-file-split rule, not in gallery9.tsx itself.