Skip to main content

Product Gallery

Product Gallery

The product's photos: one main image, a strip of thumbnails and a full-size view.

The thumbnails are a real tablist — arrow keys move between them, and the whole strip is one tab stop. Picking a variation lights up its photo, without either component knowing about the other.

Props: thumbnails on or off and where they sit, open images full size, the frame, and the product to read from.

Props

PropTypeDefaultWhat it does
Thumbnailschoice: below, left, rightbelowWhere the strip goes. Beside the image it folds back underneath on a narrow container, so a product page laid out in two columns still works on a phone.
Show the thumbnail stripon / offonOff leaves the main image alone — the right choice in a card, where a strip of five thumbnails is bigger than the card.
Open images full sizeon / offonAdds a button that opens the photo at its original size, with the arrow keys to move between photos and Escape to leave.
Frame → Aspect ratiotext1The shape of the main image, e.g. 1, 4/5 or 3/2. The photo is fitted whole inside it, so the box never changes height when somebody picks another one.
Frame → Thumbnail sizetext4.5rem
Frame → Corner radiustextvar(--fe-woo-radius, 0.75rem)
Colours → Frame backgroundtextvar(--fe-woo-panel, #f3f4f6)
Colours → Selected thumbnailtextvar(--fe-woo-accent, #111827)
Colours → Bordertextvar(--fe-woo-border, #d1d5db)
Producttext{this.fecommerce.id}Left alone it follows the product being shown, which is what a product template wants. Inside a loop it follows each card's own product.
First imagetext{this.featuredImage}Rendered by the server so the page shows the product before any script runs, and so the browser starts fetching it immediately. The runtime replaces it with whichever photo is selected; leave it alone unless the first image should be something other than the featured one.
First image alt texttext{this.title}Only for that first render. Once the runtime is up, each photo uses the alt text of its own attachment, which is where a shop should be writing it.

Variables of its own

VariableDefaultWhat it controls
--fe-woo-gallery-selectedvar(--fe-woo-accent, #111827)The outline around the thumbnail being shown.
--fe-woo-gallery-ratio1The shape of the main image — 1, 4/5, 3/2. The photo is fitted whole inside it, so the box never changes height.
--fe-woo-gallery-thumb-size4.5remHow big each thumbnail is.
--fe-woo-gallery-thumb-ratio1Their shape, independent of the main image's.
--fe-woo-gallery-columnsrepeat(auto-fill, minmax(var(--fe-woo-gallery-thumb-size, 4.5rem), 1fr))The whole grid-template-columns of the strip, if the automatic fit is not what you want.
--fe-woo-gallery-control-bgvar(--fe-woo-surface, #ffffff)The buttons floating over the photo: full size, and the arrows.
--fe-woo-gallery-control-colorvar(--fe-woo-color, #111827)Their glyph.
--fe-woo-gallery-backdroprgb(17 24 39 / 80%)What darkens the page behind the full-size view.
--fe-woo-gallery-swap240msHow long a photo takes to change.
--fe-woo-gallery-swap-zoom300msHow long the zoom of that change lasts.
--fe-woo-gallery-swap-shift100%How far the outgoing photo slides.