Skip to content
English

Usage

import { ShopGrid } from './ShopGrid.jsx'

// Without callbacks the grid runs on its sample shelf. Wire it to your shop:
<ShopGrid
  locale="en"
  currency="USD"
  items={catalog.products}     // [{ id, type, name, notes, price, was, rating, reviews, stock, badge, image }]
  categories={[{ id: 'beans', label: 'Beans' }, { id: 'gear', label: 'Brewing gear' }]}
  saved={wishlist.ids}
  bagCount={bag.count}
  loading={catalog.loading}
  error={catalog.error}
  onRetry={catalog.reload}
  onAdd={(product) => bag.add(product.id)}
  onSave={(id, saved) => wishlist.toggle(id, saved)}
  onOpenBag={() => router.push('/bag')}
/>

Props

PropTypeDefaultWhat it does
locale'en' | 'zh-CN' | 'es' | 'ja''en'Language of the built-in text and sample shelf.
itemsArray<{ id, type, name, notes?, price, was?, rating?, reviews?, stock?, badge?: 'new' | 'sale', image?, art?, tone? }>sample shelfThe products. `type` puts a product in one of the `categories`, which make the filter tabs; `image` is its picture (without it, a plain box is drawn); `was` shows a struck price and the saving; a `stock` of five or fewer is shown.
categoriesArray<{ id, label }>labels.types, then any other type on the shelfThe filter tabs, in order. Only categories that have products on the shelf are shown, each with its count.
currencystringby localeISO currency code for every price.
savedstring[][]Ids already saved; their hearts start filled.
bagCountnumber0Items already in the bag, shown on the bag button.
loadingbooleanfalseShows skeleton cards while the shelf loads.
errorboolean | stringfalseShows the error banner with a retry button; a string replaces its sentence.
onAdd(item) => Promise<void>—Quick add. The card button spins until it resolves, then shows a check.
onSave(id, saved) => void—A heart was filled or emptied.
onOpenBag / onRetry() => void—The bag button, and the retry button of the error banner.
labelsobject—Replaces any built-in text (keys as in copy.js), including the names of the kinds.
classNamestring—Added to the root element; other attributes go there too.

Add it to your project

Copy the prompt into Codex or Claude Code. The agent reads the published source, shows you what it will write and adds the block together with the components it is built from.

ShopGrid.jsxshop-grid.csscopy.jskit.jsxkit.cssui/base-button/ui/like-button/ui/empty-state/ui/status-tag/ui/alert-banner/ui/rating-stars/ui/select/ui/text-input/ui/skeleton-shimmer/ui/sliding-tabs/tokens.cssREADME.md

The block, its stylesheet and text, the shared kit, the components it uses and tokens.css install together into one folder.