Catalog drawer — Storefront block
Prostorefront-catalog-drawer · for catalog pages
Catalog drawer
A single "Filters (n)" button above a full-width grid, the facets in a drawer: for small catalogues and calm pages
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-drawerUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontCatalogDrawer from '@/components/trame/blocks/storefront/storefront-catalog-drawer.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>
<StorefrontCatalogDrawer 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
- Cart table: a long cart or a trade buyer: Product, Quantity, Price in columns, the totals under the table.
- Cart with suggestions added sheet: a sheet across the top of the page that confirms the addition and puts one companion product forward beside the cart: one obvious add-on (care, a gift box, a refill).
- Cart with suggestions folded rail: a classic narrow drawer whose suggestions fold under the lines, one large card at a time: a shop where the cart comes first and suggestions stay discreet.
- Cart with suggestions side column: a wide drawer after an addition: a column of suggestion cards against the cart, for a shop with several good companions to its products.
- 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.