All docs

Guides

Gallery — Configuration Guide

Display a collection of images in a uniform grid, mosaic, or horizontal strip layout with captions, links, and hover effects.

Gallery — Configuration Guide

This guide explains how to configure the Gallery section in the theme editor. The section displays a collection of images in a uniform grid, masonry (mosaic) layout, or horizontal strip, with optional captions, links, hover effects, and caption overlays.

Location

  • Theme editor: Add the "Gallery" section to any page template.
  • Dedicated page template: templates/page.gallery.json
  • Section source: sections/gallery.liquid

Section Settings

Layout

SettingTypeDefaultDescription
LayoutSelectGridGrid — uniform rows with merchant-selected aspect ratio. Mosaic — masonry/Pinterest-style layout preserving natural image ratios. Strip — horizontal scrolling single row.
Columns (desktop)Number4Number of columns on desktop screens. Applies to grid and mosaic variants.
Columns (mobile)Number2Number of columns on mobile screens. Applies to grid and mosaic variants.
Aspect ratioSelectSquare (1:1)Grid and strip variants. Controls how images are cropped: Square (1:1), Portrait (4:5), Landscape (3:2), or Natural (no crop). Mosaic always uses natural ratios regardless of this setting.
SpacingSelectMediumControls the gap between gallery items: Tight (6–8px), Medium (token-based), Wide (32–40px).
Caption styleSelectBelow imageHow captions display: Below image (default text below), Overlay (bottom) (gradient overlay at bottom of image), Overlay (center) (dark tint with centred text).
Hover effectSelectNoneDesktop-only effect on hover: None, Zoom (subtle scale up), Lift (slight raise with shadow). Automatically disabled when the user prefers reduced motion.
Enable lightboxCheckboxOffWhen enabled, clicking an image without a link opens a full-screen image viewer with zoom, prev/next navigation, and caption display.

Style

SettingTypeDefaultDescription
Color schemeColor schemescheme-1Controls the section's background colour and text colour.
Padding topSelectMediumTop spacing: None, Small, Medium, Large.
Padding bottomSelectMediumBottom spacing: None, Small, Medium, Large.

Image Blocks

Each image in the gallery is an Image block. Add as many as needed. Block order in the editor determines display order on the storefront.

SettingTypeDescription
ImageImage pickerThe image to display. Blocks with no image are skipped.
CaptionTextOptional text shown below or overlaid on the image. Leave blank to hide.
LinkURLOptional destination URL. Makes the image clickable. Leave blank to disable.
FeaturedCheckboxWhen checked, this image spans two columns in grid layout. Has no visual effect in mosaic or strip layouts.

How It Works

  1. Grid variant displays all images in a uniform CSS grid. Images are cropped to the selected aspect ratio (default: square). All cells are the same size, creating clean rows. Featured items span two columns.

  2. Mosaic variant displays images in a CSS column-count masonry layout. Each image keeps its natural aspect ratio, so columns have staggered heights — Pinterest-style.

  3. Strip variant displays images in a single horizontal scrolling row with scroll-snap. On desktop, prev/next arrow buttons appear on hover for navigation.

  4. Column count is merchant-controllable for both desktop and mobile. The same setting applies to grid (grid-template-columns) and mosaic (column-count). Strip variant ignores columns — items size automatically.

  5. Spacing controls the gap between items across all variants. Tight is ideal for editorial/lookbook layouts; wide gives each image more breathing room.

  6. Caption styles:

    • Below image — small muted text beneath the image (default)
    • Overlay (bottom) — white text over a gradient at the bottom of the image
    • Overlay (center) — white text centred on a dark tint over the image
  7. Hover effects (desktop only, respects reduced motion preference):

    • Zoom — image subtly scales up on hover
    • Lift — the entire item lifts up with a soft shadow
  8. Captions also serve as fallback alt text when the image has no explicit alt text set.

  9. Links wrap the image in an anchor tag. When an image has both a link and no alt text, the caption is used as the link's aria-label for accessibility.

  10. Single image — when only one image block has content, the grid collapses to a single centred column with a max-width of 680px.

  11. Color scheme applies a background colour and text colour to the entire section, including caption text.

  12. Lightbox — when enabled, images without a link become clickable. Tapping opens a full-screen overlay with the high-resolution image. Use arrow buttons or keyboard arrows to navigate between images. Click the image to toggle zoom (fit ↔ full resolution with pan). Press ESC or click the backdrop/close button to exit. A counter ("1 / 6") and the image caption are shown below the navigation controls.

Empty-State Safety

  • If no image blocks exist or all blocks have blank images, the section renders nothing.
  • Missing captions are simply not rendered — no empty <figcaption> appears.
  • Missing links result in images without anchor wrappers — no dead links.
  • Missing alt text falls back to caption text, then to empty alt attribute.

Practical Tips

  • Consistent ratios: For grid variant, use images that look good when cropped to the selected ratio. Square works well for product shots; landscape for scenery.
  • Natural mode: Set aspect ratio to "Natural" in grid mode if you want each image to show uncropped but still in uniform columns (effectively Variant B — Mixed Ratios).
  • Mosaic: Best for collections with varied aspect ratios where you want a dynamic, editorial feel.
  • Strip: Great for lifestyle or editorial galleries that benefit from horizontal browsing. Arrow buttons appear on desktop hover.
  • Featured images: Use sparingly in grid layout to create visual hierarchy — featured blocks span two columns, drawing attention to hero images.
  • Column count: 3–4 works well for desktop product galleries. Use 1–2 for mobile to keep images large enough to be meaningful.
  • Caption overlays: Best used with darker images or when the caption is short. Overlay center works well for category labels.
  • Captions: Keep them short — they appear in small text. Good for image credits, product names, or location tags.
  • Alt text: Set alt text on the image asset itself in Shopify Admin (Files). This is preferred over relying on caption fallback for accessibility.
  • Lightbox: Best for detailed product shots or editorial photography where customers benefit from viewing full-resolution images. Note that images with link URLs bypass the lightbox — clicking navigates to the link instead.

Troubleshooting

ProblemSolution
Section doesn't appearEnsure at least one Image block has an image assigned. The section skips rendering when no images are present.
Images look stretched or weirdly croppedChange the aspect ratio setting. Try "Natural" to show images at their original proportions.
Mosaic looks like a regular gridMosaic needs images with different aspect ratios to create the staggered effect. If all images are the same ratio, there's nothing to stagger.
Captions not showingCheck the Image block's Caption field is populated. Empty captions are intentionally hidden.
Colours look wrongCheck the Color scheme setting. Make sure it matches the intended palette for the page context.
Hover effect not visibleHover effects only appear on desktop with a mouse. They are automatically disabled for touch devices and users who prefer reduced motion.
Strip arrows don't appearArrow buttons only render for the Strip layout variant and only appear on desktop hover (hidden on touch devices).
Featured checkbox has no effectThe Featured flag only causes images to span two columns in Grid layout. It has no visual effect in Mosaic or Strip layouts.
Lightbox doesn't openThe lightbox only opens on images without a link URL. If an image has a link, clicking navigates to that URL instead. Also ensure the "Enable lightbox" checkbox is turned on.