---
title: "Image Gallery Module for Sanity + Next.js"
description: "A multi-row image gallery with captions, optional auto-scroll marquee and alternate directions, or a snap-scrolling strip when auto-scroll is off."
---

# Image gallery module

Rows of captioned images that either auto-scroll as a marquee or snap-scroll by hand.

[View source on GitHub](https://github.com/nuotsu/sanitypress/tree/main/src/modules/image-gallery) (schema + React component)

## Module fields

| Field | Type | Description |
| --- | --- | --- |
| `eyebrow` | string | Small label shown above the intro. |
| `intro` | Portable Text | Heading and copy, centered above the rows. |
| `rows` | array of `row` | Each row holds its own images. See row fields below. |
| `autoScroll` | boolean | Scrolls rows continuously. When off, rows snap-scroll by hand. Defaults to `true`. |
| `duration` | number | Seconds per full cycle. Defaults to 20. Shown when `autoScroll` is on. |
| `alternateScrollDirection` | boolean | Reverses every other row. Defaults to `true`. Shown when `autoScroll` is on. |
| `attributes` | `module-attributes` | Shared by every module: `uid` (HTML id for deep links), `hidden`, and `scopedCss`. |

## Row fields

| Field | Type | Description |
| --- | --- | --- |
| `images` | array of image | Images in the row, shown at a fixed 300px height. Supports hotspot cropping. |
| `images[].alt` | string | Alt text for the image. |
| `images[].caption` | string | Shown over the bottom-left corner of the image. |

Eyebrow

## Demo: Auto-scroll marquee

Two rows scroll in alternating directions, one full cycle every 20 seconds.

![](https://cdn.sanity.io/images/cyu7k2r0/production/fb64d6568a47381701e7803c7ee5b269028c111f-1537x1023.png)

![This is a sample alt](https://cdn.sanity.io/images/cyu7k2r0/production/2967fd36d6ba472ecf144ef166b9ae21640f48df-1344x896.png)

*This is a sample caption.*

![](https://cdn.sanity.io/images/cyu7k2r0/production/781b7bd29e8e351e894f35082458dc994323e185-1344x896.png)

![](https://cdn.sanity.io/images/cyu7k2r0/production/d7b6a45c5ca6bc89d3386e193cd2b9a82f99e1c3-1344x896.png)

![](https://cdn.sanity.io/images/cyu7k2r0/production/7b223c43847c47405686d63559843d207b1e1ad2-1537x1023.png)

![This is a sample alt](https://cdn.sanity.io/images/cyu7k2r0/production/3059ede8f8ed950b32e087bbdc523282f2e89b19-1448x1086.png)

*This is another sample caption.*

Frequently Asked Questions

## Image gallery module FAQ

### When should I use the Image gallery module?

Use it to show many images at once without a heavy grid: portfolios, event photos, product shots, or screenshots. Rows can scroll as a continuous marquee or snap-scroll by hand.

### How do I add the Image gallery module to a page?

In Sanity Studio, open the page, click Add item in its Modules field, and pick Image gallery. Fill in the fields, check it in the live Presentation preview, and publish. Modules can be reordered by dragging, and the same module can be used on any page as many times as you need.

### How do I customize the Image gallery module?

Add one or more rows of images with alt text and optional captions. Toggle autoScroll, set duration (seconds per cycle, 20 by default), and turn alternateScrollDirection on or off to reverse every other row.

Every module also has a Scoped CSS field (plus a uid for deep links and a hidden toggle), so you can restyle one instance without touching the rest of the site. For bigger changes, edit the module's React component and schema in src/modules/image-gallery in the repo.

Previous module

![Hero (split) module](https://cdn.sanity.io/images/cyu7k2r0/production/0f103b02c7a2622df55ff0b4b959a7e76a2cc297-2560x1322.png)

[Hero (split) module](/modules/hero-split)

Next module

![Logo list module](https://cdn.sanity.io/images/cyu7k2r0/production/1d682f8809ef7ee91d65db9d13379c515d7a103b-2560x416.png)

[Logo list module](/modules/logo-list)
