Product Detail with Gallery
A full product detail layout: a vertical thumbnail rail that swaps the large image on click, star rating, price with an optional strikethrough original price, color swatches, a size button group, and a fixed three-icon row for shipping, warranty, and returns.
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-with-gallery.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/ecommerce/ecommerce31.tsx instead.
Usage
The file also exports ecommerce31Demo, 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 { Ecommerce31, ecommerce31Demo } from "@/components/blocks/ecommerce/ecommerce31"; export default function Page() { return <Ecommerce31 {...ecommerce31Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| productName | string | none | Product title rendered as the page heading. |
| price | string | none | Pre-formatted current price, e.g. "$148.00". |
| originalPrice | string | none | Pre-formatted strikethrough price shown next to price, when the item is discounted. |
| rating | number | none | Average rating out of 5; the star row and count only render when this is set. |
| reviewCount | number | none | Number of reviews shown in parentheses next to the rating. |
| description | string | none | Product description paragraph. |
| images | MediaSlotImage[] | none | Gallery photos; one thumbnail is rendered per entry and the first is shown large by default. |
| colors | ColorOption[] | [] | Color swatches rendered as a radio group; hidden entirely when empty. |
| sizes | string[] | [] | Size labels rendered as a button-style radio group; hidden entirely when empty. |
| features | FeatureItem[] | [] | Up to 3 feature callouts, mapped by position to a fixed Truck/Shield/RotateCcw icon set. |
| className | string | none | Extra classes for the outer section element. |
Types
type MediaSlotImage = { src: string; alt: string }; type ColorOption = { name: string; hex: string }; type FeatureItem = { title: string; description: string };
Behavior notes
- The active thumbnail, active color, and active size are real client-side state (useState(0) each); clicking a thumbnail swaps the large image, and the color/size groups are genuine native radio inputs grouped by name, not decorative buttons.
- features only ever renders its first 3 entries; each is mapped by array position to a fixed Truck/Shield/RotateCcw icon, so the icon itself cannot be customized per item, only the title and description text.
- Add to cart is decorative: there is no cart in this standalone block, so clicking it does nothing.
- The color swatches are native <input type="radio"> elements visually hidden with sr-only and reskinned via the wrapping <label>, using has-[:checked]/has-[:focus-visible] so keyboard focus is still visible.
- rating and reviewCount are independent: rating alone still renders the star row, reviewCount only adds the parenthetical count when both are present.
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.