Shop by Category Grid
A shop-by-category grid for a store homepage or navigation landing page: each tile pairs a photo with a name and product count under a gradient overlay, and a Featured badge calls out one or two departments. Tiles link out when given an href, or render as static cards when they don't.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its badge, media-slot dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/shop-by-category-grid.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/ecommerce/ecommerce13.tsx instead.
Usage
The file also exports ecommerce13Demo, 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 { Ecommerce13, ecommerce13Demo } from "@/components/blocks/ecommerce/ecommerce13"; export default function Page() { return <Ecommerce13 {...ecommerce13Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Shop by category" | 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. |
| categories | CategoryItem[] | [] | The category tiles to render, in order. |
| className | string | none | Extra classes for the outer section element. |
Types
interface CategoryItem { name: string; productCount: number; href?: string; image?: { src: string; alt: string }; featured?: boolean; }
Behavior notes
- Fully static server component: there is no client state, filtering, or click handling anywhere in this block.
- A tile without an image falls back to a centered Package icon on a muted gradient rather than leaving a blank box, matching the placeholder used across other blocks that accept an optional photo.
- A tile only becomes a real link when its href is set; tiles without one render as a plain div with the same visuals, so the block works before a real category URL structure exists.
- 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 tiles.
- featured only renders the Featured badge; it does not change tile size, sort order, or layout position, so featured tiles stay wherever they sit in the categories array.
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.