Skip to content

Product gallery

Preview Available in release assets

Show product media without coupling image selection to variant, inventory, or price truth.

Show code
<section class="thin-product-gallery" aria-labelledby="gallery-title">
  <h2 id="gallery-title">Canvas tote images</h2>
  <div class="thin-reel">
    <figure data-media-item>
      <a href="tote-front-large.jpg" data-lightbox-open="tote-lightbox" data-media-index="0">
        <img src="tote-front.jpg" alt="Canvas tote, front view">
      </a>
      <figcaption>Front</figcaption>
    </figure>
    <figure data-media-item>
      <a href="tote-detail-large.jpg" data-lightbox-open="tote-lightbox" data-media-index="1">
        <img src="tote-detail.jpg" alt="Canvas tote stitching detail">
      </a>
      <figcaption>Stitching detail</figcaption>
    </figure>
  </div>
  <output data-media-status>Image 1 of 2</output>
</section>

Each authored example uses the production assets and includes copyable markup.

Anatomy

  • Product heading
  • Linked media reel
  • Captions
  • Status

Variants and sizes

  • Mixed ratio — shown above
  • Long gallery — shown above

Rendered fixtures exercise authored content and constrained layouts with the same production assets.

  • Selected image — shown above
  • Image failure — shown above
  • No JavaScript — shown above

Interaction and keyboard behavior

Native scrolling and links remain canonical; enhancement tracks only the visible media index.

Accessibility

Describe each product view and do not infer product selection from gallery navigation.

Contract
CAROUSEL · APG pattern
Basis
APG Carousel for slide selection, with native image links as fallback
Behavior guarantees
  • Selects media and announces a bounded position; it never owns product variants, inventory, pricing, or image truth.
Evidence
  • tests/unit/library/media.test.ts
  • tests/unit/library/advanced-component-contracts.test.ts

API

Use .thin-product-gallery, linked data-media-item figures, and optional lightbox attributes.

Behavior tier: dependency-free

Structured host, property, and example tables are not authored for this item yet. Use the summary above and the primary example.

Fallback

Every image remains an ordinary link or a natively scrollable figure without enhancement.

Assets and dependencies

  • /foundation.css
  • /layouts.css
  • /components.css
  • /behaviors.js

Dependencies: None

Source: packages/ui/src/items/media/style.ts

Composition

Derived from the examples and style specs, not authored.

Composes