Product grid — Storefront block
Prostorefront-product-grid · for catalog, home pages
Product grid
The catalogue’s standard grid, four columns on a wide screen: every product equal, so a visitor compares quickly
Documentation
Installation
One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).
pnpm dlx shadcn-vue@latest add @trame/storefront-product-gridUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontProductGrid from '@/components/trame/blocks/storefront/storefront-product-grid.vue'
const props = {
products: [
{
id: "p1",
name: "Trail Path running shoes",
price: 12900,
image: "https://images.unsplash.com/photo-1575987116913-e96e7d490b8a?w=1600&q=80",
images: [
"https://images.unsplash.com/photo-1575987116913-e96e7d490b8a?w=1600&q=80",
"https://images.unsplash.com/photo-1600100315760-ac46b65f6fdd?w=1600&q=80"
],
alt: "Tan leather hiking shoes on a red rock",
brand: "Summit Workshop",
badge: "New",
options: [
{
name: "Shoe size",
values: [
"39",
"40"
]
}
],
summary: "5 mm lugged sole, breathable upper and gusseted tongue. Fits true to size.",
rating: 4.6,
reviewCount: 38
},
{
id: "p2",
name: "Bivouac backpack 22 L",
price: 9500,
compareAt: 11900,
image: "https://images.unsplash.com/photo-1602845860431-35374f24f48d?w=1600&q=80",
images: [
"https://images.unsplash.com/photo-1602845860431-35374f24f48d?w=1600&q=80",
"https://images.unsplash.com/photo-1678606460531-7ce3b23242a3?w=1600&q=80"
],
alt: "A mustard canvas backpack with leather straps, resting in the grass",
brand: "Summit Workshop",
options: [
{
name: "Color",
values: [
"Midnight blue",
"Sand"
]
}
],
summary: "Ventilated back, removable hip belt, built-in rain cover.",
rating: 4.8,
reviewCount: 112
}
],
open: "product",
add: "cart.add",
pagination: {
total: 128,
page: 1,
pageSize: 8,
mode: "more",
action: "catalog",
unit: "produits"
},
options: {
showRating: true
}
}
</script>
<template>
<StorefrontProductGrid v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title | string | Wordsa title for the list, when the page needs one ("All products"); the page’s own h1 lives in CollectionHeader |
| products* | Product[] | Datathe products of this page of the catalogue, in the order the visitor chose |
| moreAction | string | Actionthe page the whole list lives on ("See all" beside the title); hidden when the app has no address for it |
| open | string | Actionthe page action a product opens; it receives the product |
| add | string | Actionthe page action that puts a product in the cart (a POST); it receives the product. Products with options open instead |
| pagination | Pagination | how the list is paged: the total, the page shown and the page action |
| banner | Banner | a banner cell inside the grid, with the merchant’s words |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Product products[] · 19 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe record’s id in the tool that answers it |
| name* | string | Wordsthe product’s name |
| price* | number | an amount in cents |
| compareAt | number | the price before the merchant’s reduction |
| currency | string | DesignISO 4217, EUR by default |
| image | string | null | Picturethe main picture; null or absent: the product has none yet |
| images | string[] | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| alt | string | Wordswhat the main picture shows |
| brand | string | Wordsthe brand or maker |
| category | string | Wordsthe product’s category, e.g. "Knitwear" |
| summary | string | Wordsone short line on the product |
| badge | string | Wordsa short tag the merchant set ("New", "Handmade") |
| rating | number | the average of the shop’s own stored reviews |
| reviewCount | number | how many stored reviews the rating averages |
| available | boolean | false: sold out; true or absent: can be bought |
| stock | number | the real stock, when the merchant shows it |
| maxQuantity | number | the most one order may hold of it, as the merchant set it (one per customer, a limited run) |
| options | Option[] | the product’s options and their values, e.g. sizes |
| highlights | Highlight[] | a few key facts the merchant set, shown on the product’s card |
Option products[].options[] · 2 props
| Prop | Type | Description |
|---|---|---|
| name* | string | Wordsthe option’s name, e.g. "Size" |
| values* | string[] | Wordsits values, e.g. "S", "M", "L" |
Highlight products[].highlights[] · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe property ("Material", "Capacity") |
| value* | string | Wordsits value, as the merchant states it ("Washed linen", "50 cl") |
Pagination pagination · 6 props
| Prop | Type | Description |
|---|---|---|
| total* | number | the real number of products matching, all pages together |
| page* | number | the page shown, from 1 |
| pageSize* | number | how many products a page holds |
| mode* | 'more' | 'pages' | "more": a link to the next page and a progress line; "pages": numbered links |
| action* | string | Actionthe page action that leads to a page of the list; it receives { page } |
| unit | string | Wordswhat is counted ("products") |
Banner banner · 5 props
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordswhat the cell says, in a few words ("New autumn collection") |
| text | string | Wordsone more sentence, if it helps |
| image | string | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| alt | string | Wordsthe picture’s description, when it shows something the words do not |
| action | Action | the banner’s call to action: its words and the page action |
Action banner.action · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe words on the button or link |
| action* | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action applies to, passed to the host with it, if any |
Options options · 6 props
| Prop | Type | Description |
|---|---|---|
| columns | 2 | 3 | 4 | columns on a wide screen, 4 by default (2: large cards for a few products); the grid adapts it to the count; the rows variant keeps one product per row |
| bannerAfter | number | the banner cell comes after this many products, 4 by default |
| showRating | boolean | show the shop’s own rating line under the price (only when the product has one) |
| names | 'display' | the products’ names: "display" sets them in the theme’s display face, a step larger (a brand whose names carry its voice, a serif shop); the text face by default |
| emptyText | string | Wordswhat the list says when there is no product |
| mood | 'inverse' | 'brand' | 'warm' | 'tint' | string | a band of the page that redefines the theme surfaces inside it |
What it asks your app for
The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).
| Member | What it is for |
|---|---|
| href | the address an action leads to, or null to hide what leads there |
| act | runs a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error } |
| can | whether the page has this action |
| money | formats a price, given in cents |
| asset | a picture’s address as your app serves it |
| Link | your router’s link component |
| cartCount | the cart badge’s number |
| cartDrawer | whether your app has a cart drawer |
| cartOpen | whether the cart drawer is open |
| label | your word for an interface key, or undefined to keep the block’s own |
The words it says itself, in English and French; label(key) replaces any of them:
| Key | English | French |
|---|---|---|
| cart.added | Added to the cart | Ajouté au panier |
| grid.choose | Choose options | Choisir les options |
| grid.empty | No product matches. | Aucun produit ne correspond. |
| grid.page | Page {n} | Page {n} |
| grid.pagination | Pagination | Pagination |
| grid.range | {from}–{to} of {total} {unit} | {from}–{to} sur {total} {unit} |
| grid.rating | Average rating {rating} out of 5 | Note moyenne {rating} sur 5 |
| grid.sale | Sale price | Prix réduit |
| grid.shown | {shown} of {total} {unit} | {shown} sur {total} {unit} |
| grid.soldOut | Sold out | Épuisé |
| grid.was | Price before reduction | Prix avant réduction |
| newsletter.already | You are already subscribed. | Vous êtes déjà inscrit. |
| newsletter.done | Done: you are subscribed. | C’est noté : vous êtes inscrit. |
| newsletter.invalid | Check the email address. | Vérifiez l’adresse e-mail. |
| newsletter.tooMany | Too many attempts, try again in a moment. | Trop de tentatives, réessayez dans un moment. |
Features
- Every word in the server HTML
- Same markup in Vue and React
- Theme tokens only: every theme, light and dark
- Shows what you give it, invents nothing
- Subtle motion: one short reveal; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
moreAction,open,cart.add,pagination,banner.action - Reads
productsfrom your app
A storefront section, for catalog, home pages; it uses @lucide/vue, class-variance-authority, clsx, reka-ui, tailwind-merge.
Built with
The components this block is made of; each one installs on its own too.
More storefront blocks
- Product features tabs: many features that fall into themes (matter, use, care): one tab per theme, picture cards inside.
- Product finder inline quiz: a few questions at once as chips on one card, the matching product appearing under the last answer: a short range.
- Product finder step quiz: one question at a time with picture tiles and a progress bar: a wider range where a need decides the model.
- Product hotspots markers: a product seen as a whole where details matter (a bag, a watch): numbered markers on one picture, the list beside it.
- Product information sheet drawer: Long materials, ingredients or care copy in a side panel opened from compact rows; the merchant’s own only.
- Product offer panel frequency: a product bought once or on subscription: two selectable cards, the saving as a number, a button that restates the choice.
- Product overview filmstrip: a strip of landscape pictures edge to edge, then the facts, the buy box and the description side by side: furniture and wide objects photographed in rooms.
- Product overview minimal spec: one picture, the options and a definition list of facts: a catalogue with few photos or technical goods.