Staaarter

Category Cards Grid

A grid of category cards with overlay photos; each card reveals a "Shop now" link on hover, built for a storefront's top-level navigation section. Every card is itself a link, so "Shop now" is a visual cue rather than the only clickable target.

By Staaarter Team
Ecommerce
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/category-cards-grid.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/ecommerce/ecommerce30.tsx instead.

Usage

The file also exports ecommerce30Demo, 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 { Ecommerce30, ecommerce30Demo } from "@/components/blocks/ecommerce/ecommerce30";

export default function Page() {
  return <Ecommerce30 {...ecommerce30Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Shop by category"Heading above the category grid.
descriptionstring"Browse the full catalog, organized the way you actually shop."Supporting sentence under the heading.
categoriesCategoryCard[][]Category cards to render in the grid.
classNamestringnoneExtra classes for the outer section element.

Types

type CategoryCard = {
  name: string;
  itemCount: number;
  href: string;
  image?: { src: string; alt: string };
};

Behavior notes

  • Fully static server component: the entire card is a real Next.js Link to href, the name and item count are always visible, and only the "Shop now" label and arrow fade/slide in on hover via pure CSS (group-hover), no JavaScript involved.
  • A category without an image falls back to a centered Package icon on a muted background instead of a broken image.
  • The dark gradient overlay is always present (not just on hover) so the name and count stay legible against any photo.
  • itemCount is rendered as a plain number ('42 items'); it is not recalculated from any live inventory source.