For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
Shadcn Labs/

Product Gallery

A hero image with a thumbnail strip. The chosen thumbnail grows into the hero while the old hero shrinks back into its slot. A React component built on View Transitions, installed with the shadcn CLI.

Northline

Summit Insulated Bottle

4.8 · 1,204 reviews

$38 · 750 ml

Keeps drinks cold for 24 hours and hot for 12. Leak-proof cap, powder-coated steel.

Installation

$ pnpm dlx shadcn@latest add @transition-kit/product-gallery

Usage

import {
  ProductGallery,
  ProductGalleryMain,
  ProductGalleryThumbnails,
} from "@/components/transitions/product-gallery";
const images = [
  { id: "front", src: "/shoe-front.jpg", alt: "Front view" },
  { id: "side", src: "/shoe-side.jpg", alt: "Side view" },
  { id: "sole", src: "/shoe-sole.jpg", alt: "Sole detail" },
];
 
<ProductGallery images={images} className="max-w-sm">
  <ProductGalleryMain />
  <ProductGalleryThumbnails />
</ProductGallery>;
const [index, setIndex] = useState(0);
 
<ProductGallery images={images} index={index} onIndexChange={setIndex}>
  <ProductGalleryMain />
  <ProductGalleryThumbnails />
</ProductGallery>;

API Reference

ProductGallery

PropTypeDefaultDescription
imagesProductGalleryImage[]-Images available in the gallery.
indexnumber-Controlled selected image index.
defaultIndexnumber0Initial selected index when uncontrolled.
onIndexChange(index: number) => void-Called with the target index after the new image decodes.

ProductGalleryImage

FieldTypeDefaultDescription
idstring-Stable identity that pairs the hero and thumbnail images.
altstring-Image label used for the thumbnail name and the live-region announcement.
srcstring-Image URL rendered as an <img> with object-fit: cover.
nodeReact.ReactNode-Custom content rendered instead of src; it should fill its box.

ProductGalleryMain

PropTypeDefaultDescription
controlsbooleantrueShows previous/next buttons over the image.