Staaarter

Photo Book Spread Viewer

Photographs presented as printed book spreads on a soft panel: two plates share a page with a center rule down the middle. Round controls turn to the next spread, two images at a time, and a bar index below the controls tracks progress through the whole book.

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/photo-book-spread-viewer.json

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

Usage

The file also exports gallery8Demo, 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 { Gallery8, gallery8Demo } from "@/components/blocks/gallery/gallery8";

export default function Page() {
  return <Gallery8 {...gallery8Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"The book"Section heading.
descriptionstring"Turn the pages to move through the full set, two plates per spread."Short subheading under the heading.
photosGalleryPhoto[]nonePhotos to paginate, two per spread.
classNamestringnoneExtra classes for the outer section element.

Types

interface GalleryPhoto {
  id: string;
  caption?: string;
  image?: MediaSlotImage;
}

Behavior notes

  • The round prev/next controls are real client-side state: each click moves spreadIndex by two, and the bar index below highlights the current page from that same state, no page reload.
  • Prev/next disable at the first and last spread rather than wrapping around, matching how a physical book runs out of pages.
  • An odd-numbered photos array leaves the final spread's right plate blank, same as a printed book's inside back cover.