Product grid rows — Storefront block

Pro

storefront-product-grid-rows · for catalog, home pages

Product grid rows

A dense list, one product per row with its summary and options: for large catalogues and visitors who compare facts

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-grid-rows

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import StorefrontProductGridRows from '@/components/trame/blocks/storefront/storefront-product-grid-rows.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>
<StorefrontProductGridRows v-bind="props" />
</template>

Props

Each prop says who changes it: Words, Picture, Action, Design, Data.* required.

PropTypeDescription
titlestringWordsa 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
moreActionstringActionthe page the whole list lives on ("See all" beside the title); hidden when the app has no address for it
openstringActionthe page action a product opens; it receives the product
addstringActionthe page action that puts a product in the cart (a POST); it receives the product. Products with options open instead
paginationPaginationhow the list is paged: the total, the page shown and the page action
bannerBannera banner cell inside the grid, with the merchant’s words
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Product products[] · 19 props
PropTypeDescription
id*string | numberDatathe record’s id in the tool that answers it
name*stringWordsthe product’s name
price*numberan amount in cents
compareAtnumberthe price before the merchant’s reduction
currencystringDesignISO 4217, EUR by default
imagestring | nullPicturethe main picture; null or absent: the product has none yet
imagesstring[]Picturea picture: a root-relative path (/media/…) or an absolute URL
altstringWordswhat the main picture shows
brandstringWordsthe brand or maker
categorystringWordsthe product’s category, e.g. "Knitwear"
summarystringWordsone short line on the product
badgestringWordsa short tag the merchant set ("New", "Handmade")
ratingnumberthe average of the shop’s own stored reviews
reviewCountnumberhow many stored reviews the rating averages
availablebooleanfalse: sold out; true or absent: can be bought
stocknumberthe real stock, when the merchant shows it
maxQuantitynumberthe most one order may hold of it, as the merchant set it (one per customer, a limited run)
optionsOption[]the product’s options and their values, e.g. sizes
highlightsHighlight[]a few key facts the merchant set, shown on the product’s card
Option products[].options[] · 2 props
PropTypeDescription
name*stringWordsthe option’s name, e.g. "Size"
values*string[]Wordsits values, e.g. "S", "M", "L"
Highlight products[].highlights[] · 2 props
PropTypeDescription
label*stringWordsthe property ("Material", "Capacity")
value*stringWordsits value, as the merchant states it ("Washed linen", "50 cl")
Pagination pagination · 6 props
PropTypeDescription
total*numberthe real number of products matching, all pages together
page*numberthe page shown, from 1
pageSize*numberhow many products a page holds
mode*'more' | 'pages'"more": a link to the next page and a progress line; "pages": numbered links
action*stringActionthe page action that leads to a page of the list; it receives { page }
unitstringWordswhat is counted ("products")
Banner banner · 5 props
PropTypeDescription
title*stringWordswhat the cell says, in a few words ("New autumn collection")
textstringWordsone more sentence, if it helps
imagestringPicturea picture: a root-relative path (/media/…) or an absolute URL
altstringWordsthe picture’s description, when it shows something the words do not
actionActionthe banner’s call to action: its words and the page action
Action banner.action · 3 props
PropTypeDescription
label*stringWordsthe words on the button or link
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action applies to, passed to the host with it, if any
Options options · 6 props
PropTypeDescription
columns2 | 3 | 4columns 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
bannerAfternumberthe banner cell comes after this many products, 4 by default
showRatingbooleanshow 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
emptyTextstringWordswhat the list says when there is no product
mood'inverse' | 'brand' | 'warm' | 'tint' | stringa 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).

MemberWhat it is for
hrefthe address an action leads to, or null to hide what leads there
actruns a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error }
canwhether the page has this action
moneyformats a price, given in cents
asseta picture’s address as your app serves it
Linkyour router’s link component
cartCountthe cart badge’s number
cartDrawerwhether your app has a cart drawer
cartOpenwhether the cart drawer is open
labelyour 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:

KeyEnglishFrench
cart.addedAdded to the cartAjouté au panier
grid.chooseChoose optionsChoisir les options
grid.emptyNo product matches.Aucun produit ne correspond.
grid.pagePage {n}Page {n}
grid.paginationPaginationPagination
grid.range{from}–{to} of {total} {unit}{from}–{to} sur {total} {unit}
grid.ratingAverage rating {rating} out of 5Note moyenne {rating} sur 5
grid.saleSale pricePrix réduit
grid.shown{shown} of {total} {unit}{shown} sur {total} {unit}
grid.soldOutSold outÉpuisé
grid.wasPrice before reductionPrix avant réduction
newsletter.alreadyYou are already subscribed.Vous êtes déjà inscrit.
newsletter.doneDone: you are subscribed.C’est noté : vous êtes inscrit.
newsletter.invalidCheck the email address.Vérifiez l’adresse e-mail.
newsletter.tooManyToo 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 products from 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 figures: a product with real numbers to show (years of warranty, tests passed): the figures first, then the features in rows.
  • 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.

All 409 storefront blocks