---
title: "Product Gallery · UI SDK — StyleX Blocks"
description: "Editorial storefront product gallery pairing a two-column collection header, segmented category filter, live bag counter with toast feedback, selectable finish swatches, edition badges, and a responsive 1:1 studio product grid."
url: "https://stylexblocks.com/block/ui-sdk/product-gallery/"
agent:
  instructions: "Use this search API to find relevant components and blocks across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://stylexblocks.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Product Gallery block

Editorial storefront product gallery pairing a two-column collection header, segmented category filter, live bag counter with toast feedback, selectable finish swatches, edition badges, and a responsive 1:1 studio product grid.

- Behavior engine: UI SDK
- Category: [Content](https://stylexblocks.com/blocks/content.md)
- Built with: [Aspect Ratio](https://stylexblocks.com/components/ui-sdk/aspect-ratio.md), [Badge](https://stylexblocks.com/components/ui-sdk/badge.md), [Button](https://stylexblocks.com/components/ui-sdk/button.md), [Card](https://stylexblocks.com/components/ui-sdk/card.md), [Color Swatch](https://stylexblocks.com/components/ui-sdk/color-swatch.md), [Grid](https://stylexblocks.com/components/ui-sdk/grid.md), [Heading](https://stylexblocks.com/components/ui-sdk/heading.md), [Icon](https://stylexblocks.com/components/ui-sdk/icon.md), [Section](https://stylexblocks.com/components/ui-sdk/section.md), [Segment Group](https://stylexblocks.com/components/ui-sdk/segment-group.md), [Separator](https://stylexblocks.com/components/ui-sdk/separator.md), [Stack](https://stylexblocks.com/components/ui-sdk/stack.md), [Text](https://stylexblocks.com/components/ui-sdk/text.md), [Toast](https://stylexblocks.com/components/ui-sdk/toast.md)
- HTML page: https://stylexblocks.com/block/ui-sdk/product-gallery/

## Install

Configure the project once (sets the behavior engine and import aliases):

```sh
npx stylexblocks init --style ui-sdk
```

Then add the item as source you own:

```sh
npx stylexblocks add product-gallery
```

Equivalent: `npx shadcn add @stylexblocks/product-gallery`. Registry item JSON: https://stylexblocks.com/r/ui-sdk/product-gallery.json

## Usage

```tsx
import { ProductGallery } from "#components/blocks/ui-sdk/product-gallery.tsx";

export function Example() {
  return (
    <div style={{ minHeight: "100dvh" }}>
      <ProductGallery />
    </div>
  );
}
```

## Source

`components/blocks/ui-sdk/product-gallery.tsx`

```tsx
import * as stylex from "@stylexjs/stylex";
import { useCallback, useMemo, useRef, useState } from "react";
import { AspectRatio } from "#components/ui/ui-sdk/aspect-ratio.tsx";
import { Badge } from "#components/ui/ui-sdk/badge.tsx";
import { Button } from "#components/ui/ui-sdk/button.tsx";
import { Card } from "#components/ui/ui-sdk/card.tsx";
import { ColorSwatch } from "#components/ui/ui-sdk/color-swatch.tsx";
import { Grid } from "#components/ui/ui-sdk/grid.tsx";
import { Heading } from "#components/ui/ui-sdk/heading.tsx";
import { Icon } from "#components/ui/ui-sdk/icon.tsx";
import { Section } from "#components/ui/ui-sdk/section.tsx";
import { SegmentGroup } from "#components/ui/ui-sdk/segment-group.tsx";
import { Separator } from "#components/ui/ui-sdk/separator.tsx";
import { HStack, VStack } from "#components/ui/ui-sdk/stack.tsx";
import { Text } from "#components/ui/ui-sdk/text.tsx";
import { Toast, Toaster } from "#components/ui/ui-sdk/toast.tsx";
import { semanticColors } from "@stylexblocks/ui/semantic-tokens/colors.stylex.ts";
import { semanticRadii } from "@stylexblocks/ui/semantic-tokens/radii.stylex.ts";
import { semanticShadows } from "@stylexblocks/ui/semantic-tokens/shadows.stylex.ts";
import {
  accentPalette,
  amberPalette,
  greenPalette,
} from "@stylexblocks/ui/themes/palettes.ts";
import { durations } from "@stylexblocks/ui/tokens/durations.stylex.ts";
import { fonts } from "@stylexblocks/ui/tokens/fonts.stylex.ts";
import { lineHeights } from "@stylexblocks/ui/tokens/line-heights.stylex.ts";
import { radii } from "@stylexblocks/ui/tokens/radii.stylex.ts";
import { spacing } from "@stylexblocks/ui/tokens/spacing.stylex.ts";
import type { StyleOverrideProps } from "#lib/recipe-props.ts";

// ─── Types & Demo Data ──────────────────────────────────────────────────────

export type ProductGalleryCategory = "all" | "lighting" | "ceramics" | "desk-tools";

export type ProductGalleryFinishId =
  | "chalk"
  | "bronze"
  | "moss"
  | "graphite"
  | "silver"
  | "champagne"
  | "washi"
  | "hinoki"
  | "charcoal"
  | "sandstone"
  | "kuro"
  | "celadon"
  | "bone"
  | "terracotta"
  | "slate"
  | "oat"
  | "espresso"
  | "brass"
  | "steel";

export interface ProductGalleryFinish {
  id: ProductGalleryFinishId;
  label: string;
}

export interface ProductGalleryItem {
  id: string;
  name: string;
  category: Exclude<ProductGalleryCategory, "all">;
  categoryLabel: string;
  description: string;
  price: number;
  editionBadge?: string;
  editionTone?: "accent" | "amber" | "green" | "neutral";
  finishes: readonly ProductGalleryFinish[];
  imageSrc: string;
  imageAlt: string;
}

interface BagEntry {
  key: string;
  productId: string;
  name: string;
  finishLabel: string;
  price: number;
  quantity: number;
}

const DEFAULT_PRODUCTS: readonly ProductGalleryItem[] = [
  {
    id: "kiri-dome-lamp",
    name: "Kiri Dome Task Lamp",
    category: "lighting",
    categoryLabel: "Lighting",
    description:
      "Spun aluminum dome lamp with a weighted travertine plinth and stepless 2700K touch dimmer.",
    price: 240,
    editionBadge: "New",
    editionTone: "accent",
    finishes: [
      { id: "chalk", label: "Chalk Aluminum" },
      { id: "bronze", label: "Smoked Bronze" },
      { id: "moss", label: "Moss Anodized" },
    ],
    imageSrc: "/images/blocks/product-gallery/kiri-dome-lamp.webp",
    imageAlt:
      "Kiri Dome Task Lamp in spun chalk aluminum casting warm downward light onto a travertine base",
  },
  {
    id: "sora-linear-bar",
    name: "Sora Linear Desk Bar",
    category: "lighting",
    categoryLabel: "Lighting",
    description:
      "Asymmetric solid-milled light bar engineered to brighten notebooks without screen glare.",
    price: 295,
    editionBadge: "Limited 50",
    editionTone: "amber",
    finishes: [
      { id: "graphite", label: "Bead-Blasted Graphite" },
      { id: "silver", label: "Raw Silver" },
      { id: "champagne", label: "Warm Champagne" },
    ],
    imageSrc: "/images/blocks/product-gallery/sora-linear-bar.webp",
    imageAlt:
      "Sora Linear Desk Bar suspended on twin graphite stanchions illuminating a desk plane",
  },
  {
    id: "haku-paper-lantern",
    name: "Haku Paper Lantern",
    category: "lighting",
    categoryLabel: "Lighting",
    description:
      "Hand-pleated Mino washi shade set on oiled hinoki struts for calm ambient evening light.",
    price: 165,
    editionBadge: "Numbered",
    editionTone: "neutral",
    finishes: [
      { id: "washi", label: "Unbleached Washi" },
      { id: "hinoki", label: "Smoked Hinoki" },
      { id: "charcoal", label: "Charcoal Rib" },
    ],
    imageSrc: "/images/blocks/product-gallery/haku-paper-lantern.webp",
    imageAlt:
      "Haku Paper Lantern with hand-pleated warm washi shade resting on a minimalist timber tripod",
  },
  {
    id: "nami-pen-vessel",
    name: "Nami Fluted Pen Vessel",
    category: "ceramics",
    categoryLabel: "Ceramics",
    description:
      "Wheel-thrown stoneware cylinder carved with sixteen flutes and finished in matte ash glaze.",
    price: 68,
    editionBadge: "Restocked",
    editionTone: "green",
    finishes: [
      { id: "sandstone", label: "Raw Sandstone" },
      { id: "kuro", label: "Kuro Iron" },
      { id: "celadon", label: "Celadon Mist" },
    ],
    imageSrc: "/images/blocks/product-gallery/nami-pen-vessel.webp",
    imageAlt:
      "Nami Fluted Pen Vessel in matte sandstone stoneware holding a turned brass drafting stylus",
  },
  {
    id: "tani-catchall-dish",
    name: "Tani Catchall Dish",
    category: "ceramics",
    categoryLabel: "Ceramics",
    description:
      "Low-profile porcelain valet dish with a gently raised lip for keys, fountain pens, and tools.",
    price: 54,
    finishes: [
      { id: "bone", label: "Bone Matte" },
      { id: "terracotta", label: "Terracotta Clay" },
      { id: "slate", label: "Slate Ash" },
    ],
    imageSrc: "/images/blocks/product-gallery/tani-catchall-dish.webp",
    imageAlt:
      "Tani Catchall Dish in matte bone porcelain holding a brass key ring and minimalist fountain pen",
  },
  {
    id: "kumo-pourover-carafe",
    name: "Kumo Pour-Over Carafe",
    category: "ceramics",
    categoryLabel: "Ceramics",
    description:
      "Two-piece stoneware dripper and thermal server proportioned for a single unhurried morning pour.",
    price: 92,
    editionBadge: "Studio Pair",
    editionTone: "accent",
    finishes: [
      { id: "oat", label: "Oat Speckle" },
      { id: "espresso", label: "Espresso Glaze" },
      { id: "kuro", label: "Kuro Iron" },
    ],
    imageSrc: "/images/blocks/product-gallery/kumo-carafe.webp",
    imageAlt:
      "Kumo Pour-Over Carafe and matching conical stoneware dripper in speckled oat glaze",
  },
  {
    id: "moku-brass-paperweight",
    name: "Moku Brass Paperweight",
    category: "desk-tools",
    categoryLabel: "Desk Tools",
    description:
      "Solid lathe-turned C360 brass monolith with a cork foot that builds a warm patina with use.",
    price: 78,
    editionBadge: "Numbered",
    editionTone: "neutral",
    finishes: [
      { id: "brass", label: "Brushed Brass" },
      { id: "bronze", label: "Patinated Bronze" },
      { id: "steel", label: "Bead-Blasted Steel" },
    ],
    imageSrc: "/images/blocks/product-gallery/moku-paperweight.webp",
    imageAlt:
      "Moku Brass Paperweight shaped as a chamfered cylindrical brass monolith with cork foot",
  },
  {
    id: "tetsu-tray-ruler-set",
    name: "Tetsu Tray & Ruler Set",
    category: "desk-tools",
    categoryLabel: "Desk Tools",
    description:
      "Folded powder-coated steel organizer paired with an etched 20 cm millimeter scale and walnut rest.",
    price: 115,
    editionBadge: "Limited 50",
    editionTone: "amber",
    finishes: [
      { id: "charcoal", label: "Matte Charcoal" },
      { id: "chalk", label: "Chalk Aluminum" },
      { id: "moss", label: "Moss Anodized" },
    ],
    imageSrc: "/images/blocks/product-gallery/tetsu-tray-set.webp",
    imageAlt:
      "Tetsu folded steel desk tray holding an etched millimeter ruler and oiled walnut pencil rest",
  },
];

const CATEGORIES: readonly { id: ProductGalleryCategory; label: string }[] = [
  { id: "all", label: "All" },
  { id: "lighting", label: "Lighting" },
  { id: "ceramics", label: "Ceramics" },
  { id: "desk-tools", label: "Desk Tools" },
];

function formatPrice(amount: number): string {
  return `$${amount.toFixed(0)}`;
}

// ─── Inline Icons ───────────────────────────────────────────────────────────

function ArrowRightIcon() {
  return (
    <Icon
      size="sm"
      viewBox="0 0 20 20"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.75"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <path d="M4.5 10h11" />
      <path d="M11 5.5 15.5 10 11 14.5" />
    </Icon>
  );
}

function BagIcon() {
  return (
    <Icon
      size="sm"
      viewBox="0 0 20 20"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.65"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
    >
      <path d="M5 7h10l1 9.5a1 1 0 0 1-1 1.1H5a1 1 0 0 1-1-1.1L5 7Z" />
      <path d="M7.5 7V5.5a2.5 2.5 0 0 1 5 0V7" />
    </Icon>
  );
}

function PlusIcon() {
  return (
    <Icon
      size="xs"
      viewBox="0 0 16 16"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.8"
      strokeLinecap="round"
      aria-hidden="true"
    >
      <path d="M8 3.25v9.5M3.25 8h9.5" />
    </Icon>
  );
}

// ─── Styles ─────────────────────────────────────────────────────────────────

const finishSwatchStyles = stylex.create({
  chalk: { "--color": "#ece8e0" },
  bronze: { "--color": "#7b624c" },
  moss: { "--color": "#556859" },
  graphite: { "--color": "#3d434b" },
  silver: { "--color": "#c9cfd6" },
  champagne: { "--color": "#d9ccb6" },
  washi: { "--color": "#f4ead7" },
  hinoki: { "--color": "#b48c64" },
  charcoal: { "--color": "#2f3237" },
  sandstone: { "--color": "#d4c5b0" },
  kuro: { "--color": "#383533" },
  celadon: { "--color": "#9db0a4" },
  bone: { "--color": "#f0ebe3" },
  terracotta: { "--color": "#ba6d4f" },
  slate: { "--color": "#6b747e" },
  oat: { "--color": "#dfd4c3" },
  espresso: { "--color": "#4f3b2e" },
  brass: { "--color": "#c8a452" },
  steel: { "--color": "#9da5ae" },
});

const styles = stylex.create({
  root: {
    backgroundColor: semanticColors.bg,
    color: semanticColors.fg,
    fontFamily: fonts.body,
    minHeight: "100%",
    paddingBlock: {
      default: spacing._10,
      "@media (max-width: 640px)": spacing._6,
    },
    paddingInline: {
      default: spacing._6,
      "@media (max-width: 640px)": spacing._4,
    },
    width: "100%",
  },
  content: {
    gap: spacing._7,
    marginInline: "auto",
    maxWidth: "78rem",
    width: "100%",
  },
  headerGrid: {
    gap: {
      default: spacing._8,
      "@media (max-width: 820px)": spacing._5,
    },
    gridTemplateColumns: {
      default: "minmax(0, 1.15fr) minmax(0, 0.85fr)",
      "@media (max-width: 820px)": "1fr",
    },
  },
  headerLeft: {
    gap: spacing._3_5,
  },
  headline: {
    marginBlock: 0,
    maxWidth: "20ch",
    textWrap: "balance",
  },
  description: {
    lineHeight: lineHeights.lg,
    maxWidth: "52ch",
  },
  segmentScroll: {
    maxWidth: "100%",
    overflowX: "auto",
  },
  gallerySection: {
    width: "100%",
  },
  productGrid: {
    gridTemplateColumns: {
      default: "repeat(4, minmax(0, 1fr))",
      "@media (max-width: 1120px)": "repeat(3, minmax(0, 1fr))",
      "@media (max-width: 820px)": "repeat(2, minmax(0, 1fr))",
      "@media (max-width: 520px)": "1fr",
    },
    width: "100%",
  },
  mediaCard: {
    borderColor: {
      default: semanticColors.border,
      ":hover": semanticColors.borderEmphasized,
    },
    borderRadius: semanticRadii.panelLg,
    borderStyle: "solid",
    boxShadow: {
      default: semanticShadows.xs,
      ":hover": semanticShadows.md,
    },
    overflow: "hidden",
    position: "relative",
    transitionDuration: durations.moderate,
    transitionProperty: "border-color, box-shadow",
  },
  aspectFrame: {
    backgroundColor: semanticColors.bgMuted,
  },
  productImage: {
    display: "block",
    height: "100%",
    objectFit: "cover",
    width: "100%",
  },
  editionBadgeOverlay: {
    insetInlineStart: spacing._3,
    position: "absolute",
    top: spacing._3,
    zIndex: 1,
  },
  productDetails: {
    flexGrow: 1,
  },
  productName: {
    marginBlock: 0,
  },
  productDescription: {
    WebkitBoxOrient: "vertical",
    WebkitLineClamp: 2,
    display: "-webkit-box",
    lineHeight: lineHeights.md,
    overflow: "hidden",
  },
  swatchRow: {
    paddingTop: spacing._0_5,
  },
  swatchGroup: {
    flexShrink: 0,
  },
  swatchButton: {
    alignItems: "center",
    appearance: "none",
    backgroundColor: "transparent",
    borderColor: {
      default: "transparent",
      ":hover": semanticColors.borderEmphasized,
    },
    borderRadius: radii.full,
    borderStyle: "solid",
    borderWidth: "1.5px",
    cursor: "pointer",
    display: "inline-flex",
    justifyContent: "center",
    outlineColor: {
      default: null,
      ":focus-visible": semanticColors.accentFocusRing,
    },
    outlineOffset: {
      default: null,
      ":focus-visible": "2px",
    },
    outlineStyle: {
      default: null,
      ":focus-visible": "solid",
    },
    outlineWidth: {
      default: null,
      ":focus-visible": "1.5px",
    },
    paddingBlock: "2px",
    paddingInline: "2px",
    transitionDuration: durations.fast,
    transitionProperty: "border-color, transform",
  },
  swatchButtonSelected: {
    borderColor: semanticColors.fg,
  },
  finishLabel: {
    minWidth: 0,
  },
  productFooter: {
    marginTop: "auto",
    paddingTop: spacing._1_5,
  },
});

function editionPaletteFor(tone?: ProductGalleryItem["editionTone"]) {
  if (tone === "accent") return accentPalette;
  if (tone === "amber") return amberPalette;
  if (tone === "green") return greenPalette;
  return undefined;
}

export interface ProductGalleryProps extends StyleOverrideProps {
  /** Collection eyebrow label above the primary headline. */
  eyebrow?: string;
  /** Primary display headline for the gallery. */
  title?: string;
  /** Supporting editorial description in the split header. */
  description?: string;
  /** Label for the primary collection action button. */
  ctaLabel?: string;
  /** Curated product catalog displayed in the responsive grid. */
  items?: readonly ProductGalleryItem[];
  /** Initial active category filter. */
  initialCategory?: ProductGalleryCategory;
  /** Called when the primary header CTA is clicked. */
  onExploreAction?: () => void;
  /** Called when a product is added to the bag with its selected finish. */
  onAddToBag?: (
    item: ProductGalleryItem,
    finish: ProductGalleryFinish,
  ) => void;
}

/**
 * ProductGallery — editorial storefront product grid pairing a two-column
 * header, category segmented filter, live bag counter, finish swatches, and
 * square 1:1 studio product cards with instant add-to-bag toast feedback.
 */
export function ProductGallery({
  eyebrow = "Kōji Atelier · Desk Objects Collection",
  title = "Quiet tools for focused tables, cast in stone, brass, and warm light.",
  description = "Each piece is turned, kiln-fired, or milled in small Kyoto and Portland runs. Tactile finishes soften with daily use and bring stillness to the work surface.",
  ctaLabel = "Explore edition",
  items = DEFAULT_PRODUCTS,
  initialCategory = "all",
  onExploreAction,
  onAddToBag,
  palette,
  style,
}: ProductGalleryProps) {
  const queue = useMemo(() => Toast.createToaster(), []);
  const gridRef = useRef<HTMLDivElement | null>(null);

  const [category, setCategory] =
    useState<ProductGalleryCategory>(initialCategory);
  const [selectedFinishes, setSelectedFinishes] = useState<
    Record<string, ProductGalleryFinishId>
  >(() => {
    const initial: Record<string, ProductGalleryFinishId> = {};
    for (const item of items) {
      const first = item.finishes[0];
      if (first) initial[item.id] = first.id;
    }
    return initial;
  });
  const [bagEntries, setBagEntries] = useState<readonly BagEntry[]>([]);

  const categoryCounts = useMemo(() => {
    const counts: Record<ProductGalleryCategory, number> = {
      all: items.length,
      lighting: 0,
      ceramics: 0,
      "desk-tools": 0,
    };
    for (const item of items) {
      counts[item.category] += 1;
    }
    return counts;
  }, [items]);

  const visibleItems = useMemo(
    () =>
      category === "all"
        ? items
        : items.filter((item) => item.category === category),
    [category, items],
  );

  const bagCount = useMemo(
    () => bagEntries.reduce((sum, entry) => sum + entry.quantity, 0),
    [bagEntries],
  );

  const bagSubtotal = useMemo(
    () =>
      bagEntries.reduce((sum, entry) => sum + entry.price * entry.quantity, 0),
    [bagEntries],
  );

  const quantityByProductId = useMemo(() => {
    const map: Record<string, number> = {};
    for (const entry of bagEntries) {
      map[entry.productId] = (map[entry.productId] ?? 0) + entry.quantity;
    }
    return map;
  }, [bagEntries]);

  const handleSelectFinish = useCallback(
    (productId: string, finishId: ProductGalleryFinishId) => {
      setSelectedFinishes((prev) => ({ ...prev, [productId]: finishId }));
    },
    [],
  );

  const handleAdd = useCallback(
    (item: ProductGalleryItem, finish: ProductGalleryFinish) => {
      const key = `${item.id}:${finish.id}`;
      setBagEntries((prev) => {
        const existing = prev.find((entry) => entry.key === key);
        if (existing) {
          return prev.map((entry) =>
            entry.key === key
              ? { ...entry, quantity: entry.quantity + 1 }
              : entry,
          );
        }
        return [
          ...prev,
          {
            key,
            productId: item.id,
            name: item.name,
            finishLabel: finish.label,
            price: item.price,
            quantity: 1,
          },
        ];
      });
      onAddToBag?.(item, finish);
      const nextCount = bagCount + 1;
      queue.success(`Added ${item.name} to bag`, {
        description: `${finish.label} · ${formatPrice(item.price)} · ${nextCount} ${nextCount === 1 ? "object" : "objects"} in bag`,
      });
    },
    [bagCount, onAddToBag, queue],
  );

  const handleExplore = useCallback(() => {
    onExploreAction?.();
    gridRef.current?.scrollIntoView({ behavior: "smooth", block: "start" });
    queue.info("Kōji Atelier · Desk Objects Collection", {
      description: `${items.length} small-batch lighting, ceramic, and desk editions ready to inspect.`,
    });
  }, [items.length, onExploreAction, queue]);

  const handleBagSummary = useCallback(() => {
    if (bagEntries.length === 0) {
      queue.info("Your studio bag is empty", {
        description:
          "Choose a finish swatch and add any desk object from the gallery.",
      });
      return;
    }
    const previewNames = bagEntries
      .slice(0, 2)
      .map((entry) => `${entry.quantity}× ${entry.name} (${entry.finishLabel})`)
      .join(", ");
    const remaining =
      bagEntries.length > 2 ? ` +${bagEntries.length - 2} more` : "";
    queue.info(
      `Studio bag · ${bagCount} ${bagCount === 1 ? "object" : "objects"}`,
      {
        description: `${previewNames}${remaining} · Subtotal ${formatPrice(bagSubtotal)}`,
      },
    );
  }, [bagCount, bagEntries, bagSubtotal, queue]);

  const handleClearBag = useCallback(() => {
    setBagEntries([]);
    queue.info("Studio bag cleared", {
      description: "All objects have been removed from your bag.",
    });
  }, [queue]);

  const activeCategoryLabel =
    CATEGORIES.find((entry) => entry.id === category)?.label ?? "All";

  return (
    <VStack gap="0" palette={palette} style={[styles.root, style]}>
      <VStack render={<main />} style={styles.content}>
        <Grid render={<header />} align="end" style={styles.headerGrid}>
          <VStack align="start" style={styles.headerLeft}>
            {eyebrow ? (
              <Badge variant="subtle" size="md">
                {eyebrow}
              </Badge>
            ) : null}
            <Heading render={<h1 />} size="5xl" style={styles.headline}>
              {title}
            </Heading>
          </VStack>

          <VStack align="start" gap="4">
            <Text variant="muted" size="md" style={styles.description}>
              {description}
            </Text>
            <HStack wrap="wrap" gap="2.5">
              <Button
                variant="solid"
                size="md"
                palette={accentPalette}
                onClick={handleExplore}
              >
                {ctaLabel}
                <ArrowRightIcon />
              </Button>
              <Button
                variant="surface"
                size="md"
                onClick={handleBagSummary}
                aria-label={`Studio bag with ${bagCount} ${bagCount === 1 ? "object" : "objects"}`}
              >
                <BagIcon />
                <span>Bag</span>
                <Badge
                  variant={bagCount > 0 ? "solid" : "subtle"}
                  size="xs"
                  palette={bagCount > 0 ? accentPalette : undefined}
                >
                  {bagCount}
                </Badge>
                {bagCount > 0 ? (
                  <Text render={<span />} variant="muted" tabular="true">
                    · {formatPrice(bagSubtotal)}
                  </Text>
                ) : null}
              </Button>
            </HStack>
          </VStack>
        </Grid>

        <Separator />

        <HStack wrap="wrap" gap="3" justify="between">
          <div {...stylex.props(styles.segmentScroll)}>
            <SegmentGroup.Root
              size="sm"
              value={category}
              onValueChange={(next) =>
                setCategory(next as ProductGalleryCategory)
              }
              aria-label="Filter collection by category"
            >
              {CATEGORIES.map((entry) => (
                <SegmentGroup.Item key={entry.id} value={entry.id}>
                  {entry.label} ({categoryCounts[entry.id]})
                </SegmentGroup.Item>
              ))}
            </SegmentGroup.Root>
          </div>

          <HStack wrap="wrap" gap="2.5">
            <Text render={<span />} variant="muted" size="sm" tabular="true">
              Showing {visibleItems.length}{" "}
              {visibleItems.length === 1 ? "object" : "objects"}
              {category === "all" ? "" : ` in ${activeCategoryLabel}`}
            </Text>
            {bagCount > 0 ? (
              <Button variant="ghost" size="xs" onClick={handleClearBag}>
                Clear bag
              </Button>
            ) : null}
          </HStack>
        </HStack>

        <Section.Root
          aria-label="Desk Objects Collection gallery"
          style={styles.gallerySection}
        >
          <Section.Body>
            <Grid ref={gridRef} gap="6" style={styles.productGrid}>
              {visibleItems.map((product) => {
                const activeFinishId =
                  selectedFinishes[product.id] ?? product.finishes[0]?.id;
                const activeFinish =
                  product.finishes.find((f) => f.id === activeFinishId) ??
                  product.finishes[0];
                const inBagQty = quantityByProductId[product.id] ?? 0;

                return (
                  <VStack
                    key={product.id}
                    render={<article />}
                    gap="3"
                  >
                    <Card.Root
                      variant="outline"
                      size="sm"
                      style={styles.mediaCard}
                    >
                      {product.editionBadge ? (
                        <div {...stylex.props(styles.editionBadgeOverlay)}>
                          <Badge
                            variant="surface"
                            size="sm"
                            palette={editionPaletteFor(product.editionTone)}
                          >
                            {product.editionBadge}
                          </Badge>
                        </div>
                      ) : null}
                      <AspectRatio
                        ratio="square"
                        rounded="none"
                        style={styles.aspectFrame}
                      >
                        <img
                          src={product.imageSrc}
                          alt={product.imageAlt}
                          {...stylex.props(styles.productImage)}
                        />
                      </AspectRatio>
                    </Card.Root>

                    <VStack gap="2" style={styles.productDetails}>
                      <VStack gap="0.5">
                        <Text
                          render={<span />}
                          variant="subtle"
                          size="xs"
                          weight="medium"
                        >
                          {product.categoryLabel}
                        </Text>
                        <Heading
                          render={<h2 />}
                          size="lg"
                          style={styles.productName}
                        >
                          {product.name}
                        </Heading>
                      </VStack>

                      <Text
                        variant="muted"
                        size="sm"
                        style={styles.productDescription}
                      >
                        {product.description}
                      </Text>

                      {activeFinish ? (
                        <HStack gap="2" style={styles.swatchRow}>
                          <HStack
                            role="radiogroup"
                            aria-label={`${product.name} finish`}
                            gap="1.5"
                            style={styles.swatchGroup}
                          >
                            {product.finishes.map((finish) => {
                              const isSelected = finish.id === activeFinish.id;
                              return (
                                <button
                                  key={finish.id}
                                  type="button"
                                  role="radio"
                                  aria-checked={isSelected}
                                  aria-label={finish.label}
                                  title={finish.label}
                                  onClick={() =>
                                    handleSelectFinish(product.id, finish.id)
                                  }
                                  {...stylex.props(
                                    styles.swatchButton,
                                    isSelected && styles.swatchButtonSelected,
                                  )}
                                >
                                  <ColorSwatch
                                    size="xs"
                                    shape="circle"
                                    style={finishSwatchStyles[finish.id]}
                                  />
                                </button>
                              );
                            })}
                          </HStack>
                          <Text
                            render={<span />}
                            variant="caption"
                            truncate="true"
                            style={styles.finishLabel}
                          >
                            {activeFinish.label}
                          </Text>
                        </HStack>
                      ) : null}

                      <HStack
                        gap="2"
                        justify="between"
                        style={styles.productFooter}
                      >
                        <Text
                          render={<span />}
                          size="lg"
                          weight="semibold"
                          tabular="true"
                        >
                          {formatPrice(product.price)}
                        </Text>
                        {activeFinish ? (
                          <Button
                            variant="surface"
                            size="sm"
                            onClick={() => handleAdd(product, activeFinish)}
                            aria-label={`Add ${product.name} in ${activeFinish.label} to bag`}
                          >
                            <PlusIcon />
                            <span>Add</span>
                            {inBagQty > 0 ? (
                              <Badge
                                variant="subtle"
                                size="xs"
                                palette={accentPalette}
                              >
                                {inBagQty}
                              </Badge>
                            ) : null}
                          </Button>
                        ) : null}
                      </HStack>
                    </VStack>
                  </VStack>
                );
              })}
            </Grid>
          </Section.Body>
        </Section.Root>
      </VStack>

      <Toaster toaster={queue} />
    </VStack>
  );
}
```

Credit: Inspired by [Product Gallery](https://astryx.atmeta.com/playground?template=product-gallery) from Astryx (MIT License · Copyright (c) 2026 Meta Platforms, Inc.)
