Category leaders — Storefront block
Prostorefront-category-leaders · for home, catalog pages
Category leaders
Two to six categories with their lead product in a row: a way in by what each rayon is known for
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-category-leadersUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontCategoryLeaders from '@/components/trame/blocks/storefront/storefront-category-leaders.vue'
const props = {
title: "All our departments",
subtitle: "Twenty families of garden tools, sorted from A to Z.",
entries: [
{
id: 1,
name: "Brass and zinc",
count: 2,
lead: {
id: "Brass hose nozzle",
name: "Brass hose nozzle",
price: 4900
},
why: "our best seller of 2025"
},
{
id: 2,
name: "Flower boxes",
count: 9,
lead: {
id: "Oak planter, 31 in",
name: "Oak planter, 31 in",
price: 8900
},
why: "the newest"
}
],
note: "Number of models on sale as of the last catalog update.",
open: "category",
openProduct: "product",
options: {
unit: "models"
}
}
</script>
<template>
<StorefrontCategoryLeaders v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe section’s title ("All our departments") |
| subtitle | string | Wordsone sentence under the title, if it helps |
| entries* | Entry[] | Datathe categories to list, with their count and the product that leads each |
| note | string | Wordshow the numbers are computed or what they cover, written under the block |
| open | string | Actionthe page action a category opens; it receives the category |
| openProduct | string | Actionthe page action a lead product opens; it receives the product |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Entry entries[] · 8 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe record’s id in the tool that answers it |
| name* | string | Wordsthe category’s name |
| image | string | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| alt | string | Wordswhat the category’s picture shows |
| count | number | how many products it holds |
| summary | string | Wordsone short line on the category |
| lead | Lead | the category’s lead product, chosen by a real rule |
| why | string | Wordswhy this product leads, in a few words, as the merchant states the rule ("best seller in 2025") |
Lead entries[].lead · 5 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 |
| image | string | null | Picturethe main picture; null or absent: the product has none yet |
| alt | string | Wordswhat the main picture shows |
Options options · 2 props
| Prop | Type | Description |
|---|---|---|
| unit | string | Wordswhat a count counts ("models", "pieces"), written after the number |
| 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 |
|---|---|---|
| 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
- No motion; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
open,openProduct - Reads
categories,productsfrom your app
A storefront section, for home, catalog pages; it uses @lucide/vue.
More storefront blocks
- 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.
- Category photo grid direction reveal: photographic tiles whose brand veil slides in from the side the pointer enters by, caption always readable: a catalogue of 4 to 12 categories that all have pictures.
- Category photo grid lead and two: one tall lead tile beside two stacked: when exactly one category is the one to push.
- Category photo grid: tiles of one size, 1 to 12 categories with pictures: the plain way into a catalogue.
- Category tabs accordion: stacked panels, one per category, the first open: fits phones and long category names best.