Product Detail Page
A complete product detail section: a large main image with a row of clickable thumbnails that swap it, color swatches and a size button group, a price with an optional strikethrough original price, and an add-to-cart button. Built as the main content of a product page.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its button, media-slot dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/product-detail-page.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/ecommerce/ecommerce19.tsx instead.
Usage
The file also exports ecommerce19Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Ecommerce19, ecommerce19Demo } from "@/components/blocks/ecommerce/ecommerce19"; export default function Page() { return <Ecommerce19 {...ecommerce19Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| images | MediaSlotImage[] | none | Gallery images; the first is shown as the main image on load. |
| name | string | none | Product name, rendered as the page's h1. |
| rating | number | undefined | 0-5 rating; rounded to the nearest whole star for the filled-star count. Omit to hide the rating row entirely. |
| reviewCount | number | undefined | Review count shown next to the rating. |
| price | string | none | Pre-formatted current price, e.g. "$89.00". |
| originalPrice | string | undefined | Pre-formatted strikethrough price, shown only when set. |
| description | string | none | Product description paragraph. |
| colors | ColorOption[] | [] | Color swatches; hidden entirely when empty. |
| sizes | string[] | [] | Size options rendered as a button group; hidden entirely when empty. |
| className | string | none | Extra classes for the outer section element. |
Types
type MediaSlotImage = { src: string; alt: string }; type ColorOption = { name: string; hex: string; // literal CSS color, since these are real product swatches rather than a UI accent };
Behavior notes
- The thumbnail row is real client state: clicking a thumbnail swaps the large main image via a plain useState index, it isn't a carousel or slideshow.
- Color swatches are real native radio inputs (visually hidden, driven by useState) and the size list is a real controlled button group, so selecting either updates the on-screen "Color: ..." / "Size: ..." label live. Neither selection changes the displayed price in this demo, since there's no variant-pricing backend to look up against.
- "Add to cart" has no click handler; there's no cart to add to.
- colors and sizes each render nothing at all when their array is empty, rather than an empty fieldset.
More Ecommerce Blocks
View all →wishlist-manager
Wishlist Manager
Saved-items list with stock-status badges, move-to-cart and remove actions, and a real empty state.
product-information-tabs
Product Information Tabs
Tabbed product details with Description, Features, Specifications, Reviews, and Shipping panels.
collection-showcase-grid
Collection Showcase Grid
A large featured-collection hero card alongside a grid of smaller supporting collection tiles.
shop-by-brand-grid
Shop by Brand Grid
A grid of bordered brand tiles with a wordmark-style name, product count, and a hover affordance.
sale-countdown-timer
Sale Countdown Timer
A live days/hours/minutes/seconds countdown in default, compact, or full-width banner layouts.
gift-card-redemption-form
Gift Card Redemption Form
A code-entry form that validates against a fixed list of demo gift cards and shows a real success or error state.