Catalog top bar — Storefront block
Prostorefront-catalog-top-bar · for catalog pages
Catalog top bar
A bar of facet menus above a full-width grid: for catalogues with two to five facets, where the pictures should have all the room
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-catalog-top-barUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontCatalogTopBar from '@/components/trame/blocks/storefront/storefront-catalog-top-bar.vue'
const props = {
title: "Low Light, fall–winter",
intro: "Coats and knitwear cut in our studio, in wool that lasts. We repair everything we sell.",
results: {
items: [
{
id: "p1",
name: "Long wool coat, charcoal",
price: 42000,
image: "https://images.unsplash.com/photo-1782694308249-917d2599b46f?w=1600&q=80",
images: [
"https://images.unsplash.com/photo-1782694308249-917d2599b46f?w=1600&q=80",
"https://images.unsplash.com/photo-1790802195673-357071dfa500?w=1600&q=80"
],
alt: "A woman in a long dark coat by stone columns, in black and white",
brand: "Ostra",
badge: "New",
options: [
{
name: "Size",
values: [
"XS",
"S"
]
}
],
summary: "Double-faced virgin wool, hand-finished seams, falls below the knee.",
rating: 4.6,
reviewCount: 38
},
{
id: "p2",
name: "Black cotton trench",
price: 32000,
compareAt: 38000,
image: "https://images.unsplash.com/photo-1790802195673-357071dfa500?w=1600&q=80",
images: [
"https://images.unsplash.com/photo-1790802195673-357071dfa500?w=1600&q=80",
"https://images.unsplash.com/photo-1782694308249-917d2599b46f?w=1600&q=80"
],
alt: "A woman in a black trench coat and a gray slip dress on a city sidewalk",
brand: "Ostra",
options: [
{
name: "Color",
values: [
"Charcoal",
"Ecru"
]
}
],
summary: "Dense cotton gabardine, storm flap, belt with a horn buckle.",
rating: 4.8,
reviewCount: 112
}
],
total: 64,
facets: [
{
key: "categorie",
label: "Category",
values: [
{
value: "coats",
label: "Coats",
count: 18
},
{
value: "knitwear",
label: "Knitwear",
count: 14
}
]
},
{
key: "couleur",
label: "Color",
kind: "swatch",
values: [
{
value: "noir",
label: "Black",
count: 16,
color: "black"
},
{
value: "sable",
label: "Camel",
count: 12,
color: "tan"
}
]
}
],
sort: "pertinence"
},
action: "catalog",
open: "product",
add: "cart.add",
pagination: {
total: 64,
page: 1,
pageSize: 9,
mode: "more",
action: "catalog",
unit: "pieces"
},
options: {
sorts: [
{
value: "pertinence",
label: "Relevance"
},
{
value: "nouveautes",
label: "Newest"
}
],
unit: "pieces",
showRating: true
}
}
</script>
<template>
<StorefrontCatalogTopBar v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title | string | Wordsthe page’s title, an h2 here (the page’s h1 is CollectionHeader’s): "All our products" |
| intro | string | Wordsone sentence under the title, in the merchant’s words |
| results* | Results | Datathe filtered catalogue: what a tool answers for the page’s address |
| action* | string | Actionthe page the filters apply to: the form is a GET to its address, and "Clear all" leads back to 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 |
| keep | Record<string, string> | Dataparameters of the address the form must keep (a search query), sent as hidden fields |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Results results · 4 props
| Prop | Type | Description |
|---|---|---|
| items* | Item[] | the products of this page of the result |
| total* | number | the real number of products the filters give, all pages together |
| facets* | Facet[] | the facets of the current result, with their counts and what is selected |
| sort | string | Datathe order now in the address |
Item results.items[] · 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 results.items[].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 results.items[].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") |
Facet results.facets[] · 6 props
| Prop | Type | Description |
|---|---|---|
| key* | string | Datathe parameter of the address ("colour", "size") |
| label* | string | Wordsthe group’s title ("Colour") |
| kind | 'list' | 'swatch' | 'chips' | 'range' | list: checkboxes with counts; swatch: colour dots; chips: short values in a grid (sizes); range: a minimum and a maximum |
| values | Value[] | the values (not for a range) |
| range | Range | the bounds, for kind range |
| open | boolean | the group starts open in the column and the drawer; true by default |
Value results.facets[].values[] · 5 props
| Prop | Type | Description |
|---|---|---|
| value* | string | Datathe value sent in the address ("black", "42") |
| label* | string | Wordswhat the visitor reads ("Black", "42") |
| count | number | how many products the value gives, from the tool: never computed here. 0 disables the value |
| selected | boolean | the value is in the address now |
| color | string | Designa CSS colour for a swatch ("navy", "oklch(…)"); with `kind` swatch |
Range results.facets[].range · 5 props
| Prop | Type | Description |
|---|---|---|
| min* | number | the lowest value in the catalogue |
| max* | number | the highest value in the catalogue |
| from | number | the minimum now in the address |
| to | number | the maximum now in the address |
| unit | string | Wordsthe unit written after the numbers ("€") |
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") |
Options options · 8 props
| Prop | Type | Description |
|---|---|---|
| sorts | Sort[] | the orders offered; the first is the default |
| unit | string | Wordswhat the count counts ("products") |
| collapse | number | facet values shown before "See more", 6 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 the filters give nothing |
| layout | 'grid' | 'editorial' | 'rows' | the list’s arrangement, a grid by default |
| mood | 'inverse' | 'brand' | 'warm' | 'tint' | string | a band of the page that redefines the theme surfaces inside it |
Sort options.sorts[] · 2 props
| Prop | Type | Description |
|---|---|---|
| value* | string | Designa sort key the backend knows |
| label* | string | Words("Price, low to high") |
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 |
| catalog.clear | Clear all | Tout effacer |
| catalog.noMatch | No product matches these filters. | Aucun produit ne correspond à ces filtres. |
| filters.active | Active filters | Filtres actifs |
| filters.apply | Apply | Appliquer |
| filters.clear | Clear all | Tout effacer |
| filters.remove | Remove filter {label} | Retirer le filtre {label} |
| filters.sort | Sort by | Trier par |
| filters.title | Filters | Filtres |
| filters.view | View {total} results | Voir les {total} résultats |
| 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:
action,open,cart.add,pagination - Reads
products,facetsfrom your app
A storefront section, for catalog 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
- Catalog browse search tiles: a wide field, then the categories as picture tiles and the popular searches in a band: a shop where visitors browse as much as they type.
- Catalog filters bar: a slim bar of facet menus over a grid that sits in its own section, sort on the right: for catalogues with two to five facets.
- Catalog filters drawer: only a "Filters (n)" button that opens the drawer of facets and sort: for small catalogues and pages where the filters should stay out of the way.
- Category campaign banner in grid: four or five tiles and the merchant’s own announcement tile in the last cell: a campaign among categories.
- Category comparison compare table: three or four categories against the same specifications: a technical catalogue where the choice is a comparison.
- Category index alphabet: a long or picture-poor catalogue: every category as a link under its letter, from 3 to 60 of them.
- Category index inline: a short catalogue of 3 to 20 categories set large in one flowing paragraph, each count raised after its name: a confident, type-led way in for a shop with few or no pictures.
- Category index ladder: categories that differ on one measure (capacity, size, price band): a bar per row, proportional to the real value.