# Product Gallery

- Page: <https://kznlabs.github.io/labsUI/components/product-gallery>

## Product Gallery (`product-gallery`, block)

A product page's photos: a swipeable Carousel with arrows and a wrapping row of thumbnails, each a labeled button to its slide. One photo stays a plain picture.

- Install: `npx @kznlabs/labsui add product-gallery`
- Docs: <https://kznlabs.github.io/labsUI/components/product-gallery>
- Brings: aspect-ratio, button, button-variants, carousel, utils
- npm: clsx@^2.1.1, lucide-react@1.63.0, motion@14.7.1, tailwind-merge@^3.7.0

### API

- `<ProductGallery>`: A product page's photos: a swipeable Carousel with thumbnails under it. One photo stays a plain picture.
  - `label: string`: Names the gallery for screen readers, e.g. "Clip camera photos".
  - `media: ReactNode[]`: Photos (`<img>`), one per slide.
  - `ratio?: number` = `1`: Media width/height, e.g. 1 for square.
  - `thumbnails?: ReactNode[]` = `media`: Smaller versions for the row of thumbnails. Defaults to `media`.

### Usage

```tsx
<ProductGallery label="Clip camera photos" media={[<img src={front} alt="Front" />, <img src={back} alt="Back" />]} />
```

### Example: product-photos.tsx

```tsx
import { ProductGallery } from "@/components/blocks/product-gallery";

type Photo = { src: string; thumb: string; alt: string };

export function ProductPhotos({ name, photos }: { name: string; photos: Photo[] }) {
  return (
    <ProductGallery
      label={`${name} photos`}
      media={photos.map((photo) => <img key={photo.src} src={photo.src} alt={photo.alt} />)}
      thumbnails={photos.map((photo) => <img key={photo.thumb} src={photo.thumb} alt="" />)}
    />
  );
}
```
