Product Card Grid
A shop or collection grid of product cards: photo, a Sale badge on discounted items, name, a star rating with review count, price (with the original price struck through when on sale), and an Add to cart button. A pure CSS zoom on hover keeps the block a static server component.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its button, badge, media-slot dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/product-card-grid.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/ecommerce/ecommerce15.tsx instead.
Usage
The file also exports ecommerce15Demo, 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 { Ecommerce15, ecommerce15Demo } from "@/components/blocks/ecommerce/ecommerce15"; export default function Page() { return <Ecommerce15 {...ecommerce15Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Shop bestsellers" | Heading above the grid; the whole header block is skipped when both heading and description are unset. |
| description | string | undefined | Supporting copy under the heading. |
| products | ProductCardItem[] | [] | The product cards to render, in order. |
| className | string | none | Extra classes for the outer section element. |
Types
interface ProductCardItem { name: string; price: string; originalPrice?: string; rating: number; reviewCount: number; image?: { src: string; alt: string }; onSale?: boolean; }
Behavior notes
- Fully static server component: the Add to cart button has no click handler and the image zoom on hover is pure CSS (group-hover:scale-105), so nothing here needs client-side JavaScript.
- The star rating rounds `rating` to the nearest whole star to decide how many of the 5 icons render filled; it does not render partial/half-filled stars.
- The strikethrough original price and the Sale badge only render when a card sets onSale and originalPrice; a card can be onSale without an originalPrice, in which case only the badge shows.
- A card without an image falls back to a centered ShoppingBag icon rather than a blank box.
- The grid is a fixed 2/3/4-column responsive layout regardless of item count; passing more than 8 items wraps to additional rows rather than shrinking the cards.
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.