Xzero UI
Pro library

Product detailPro

A product page with a swipeable gallery, finish and size variants, add to bag that confirms in place, shipping, a reviews summary, and details.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/product-detail
Live · keyboard ready

Use this as the product page of a store. Pass the product with its finishes, sizes and stock, return your cart request from onAddToCart, and send back in stock alerts through onNotify.

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/product-detail

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { ProductDetail } from "@/components/xzero/blocks/product-detail/product-detail";

export function ProductPage({ product }) {
  return (
    <ProductDetail
      product={product}
      onAddToCart={selection => fetch("/api/cart", { method: "POST", body: JSON.stringify(selection) })}
      onNotify={selection => subscribeRestock(selection)}
    />
  );
}

API reference

ProductDetail

A product page with a swipeable gallery and thumbnails, finish and size variants, a quantity stepper, add to bag that confirms in place, shipping promises, a reviews summary, and a details accordion.

PropTypeDefaultDescription
productDetailProductsample lampThe product with finishes, sizes, reviews, shipping lines, and detail sections.
defaultFinishstringfirst finishInitial finish id.
defaultSizestringfirst sizeInitial size id.
onAddToCart(selection: DetailSelection) => void | Promise<void>–Adds the selection. Return a promise to show Adding until it settles; a rejection shows Try again. Without it the preview simulates a short request.
onNotify(selection) => void–Called when someone asks to be told when a sold out finish and size is back.
onWishlistChange(saved: boolean) => void–Called when the heart is toggled.
defaultCartCountnumber0Items already in the bag.
maxQuantitynumber9Upper bound of the stepper.
currency, localestring"USD", "en-US"Price formatting.
classNamestring–Extra class on the root.

DetailProduct

PropTypeDefaultDescription
id, name, collection, summary (required)string–Identity, breadcrumb collection, and a one or two sentence summary.
finishes (required){ id, name, swatch, images }[]–Each finish has its own photos; switching finish crossfades the gallery in place.
sizes (required){ id, name, price, note?, soldOutIn? }[]–Price per size. soldOutIn lists finish ids in which the size is out of stock.
rating, reviewCount, distribution (required)number, number, [5 numbers]–Average, total, and counts for 5 to 1 stars.
shipping (required){ title, text }[]–Delivery, returns, and warranty lines.
sections (required){ id, title, body }[]–Accordion sections. The first opens by default.

Keyboard interactions

KeysAction
Arrow left / Arrow rightOn the gallery, show the previous or next photo. In the finish and size groups, move the selection.
TabMove from the gallery to thumbnails, variants, the stepper, add to bag, and the accordion.
Enter / SpaceChoose a thumbnail, toggle an accordion section, or add to bag.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Guidance for AI tools

Blocks are complete, self-contained screens with sample data. Replace the sample data and connect the callbacks described above. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components