Collection feature split stats — Storefront block
Freestorefront-collection-feature-split-stats · for home pages
Collection feature split stats
A collection with its facts beside the picture: price range, number of pieces, brands
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-collection-feature-split-statsUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontCollectionFeatureSplitStats from '@/components/trame/blocks/storefront/storefront-collection-feature-split-stats.vue'
const props = {
title: "Featured this fall",
subtitle: "Two ways to dress for the season ahead.",
bands: [
{
id: "automne",
eyebrow: "Fall collection",
title: "The season’s warm pieces",
text: "Wool, fleece and heavy cotton, cut for layering. Sweater sizes go fast; the collection changes in January.",
tagline: "Stay warm without the weight.",
image: "https://images.unsplash.com/photo-1673712060934-34358642511b?w=1600&q=80",
alt: "Olive jackets hanging from a rail",
items: [
{
id: 1,
name: "Quilted jackets",
count: 12,
priceFrom: 12900
},
{
id: 2,
name: "Merino wool sweaters",
count: 9,
priceFrom: 7900
}
],
action: "category",
actionLabel: "See the collection",
count: 56,
meta: [
{
label: "Price",
value: "$19 to $249"
},
{
label: "Pieces",
value: "56"
}
],
chips: [
"Merino wool",
"Organic cotton"
],
quote: {
text: "I’ve worn this jacket for three winters and it hasn’t changed a bit.",
name: "A customer, Portland"
}
}
],
options: {
unit: "models"
}
}
</script>
<template>
<StorefrontCollectionFeatureSplitStats 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 ("Featured") |
| subtitle | string | Wordsone sentence under the title |
| bands* | Band[] | the collections to feature, in order; one for edit-card |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Band bands[] · 14 props
| Prop | Type | Description |
|---|---|---|
| id | string | number | Datathe band’s id |
| eyebrow | string | Wordswhat kind of collection it is ("Autumn collection", "New arrivals"), only if true |
| title* | string | Wordsthe collection’s name |
| text | string | Wordsone or two sentences on what is in it and why |
| tagline | string | Wordsa short line in italics (magazine) |
| image | string | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| alt | string | Wordswhat the picture shows |
| items | Item[] | Datathree or four named pieces of the collection, with their count and lowest price |
| action | string | Actionthe page action the collection opens |
| actionLabel | string | Wordsthe button’s words ("See the whole collection") |
| count | number | Datahow many products the collection holds, from the catalogue |
| meta | Meta[] | facts the merchant states: a rating from real reviews, a price range, a number of pieces |
| chips | string[] | Wordsbrands or materials of the collection |
| quote | Quote | a quote for the band, the merchant’s own or a real customer’s |
Item bands[].items[] · 4 props
| Prop | Type | Description |
|---|---|---|
| id | string | number | the item’s id |
| name* | string | Wordsthe item’s name |
| count | number | how many, as the host counted them |
| priceFrom | number | the lowest price in cents |
Meta bands[].meta[] · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhat the value is about |
| value* | string | Wordsthe value, as the merchant states it |
Quote bands[].quote · 2 props
| Prop | Type | Description |
|---|---|---|
| text* | string | Wordsthe merchant’s own words, or a real customer’s with permission |
| name | string | Wordsthe quote’s name |
Options options · 3 props
| Prop | Type | Description |
|---|---|---|
| unit | string | Wordswhat a count counts ("models") |
| flip | boolean | true: the bands start on the other side |
| 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 |
| 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
- Expressive motion, within its budget; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
bands[] - Reads
categories,productsfrom your app
A storefront section, for home pages; it uses @lucide/vue, class-variance-authority, clsx, motion, reka-ui, tailwind-merge.
More storefront blocks
- Collection banner split: the words on one half and the picture filling the other to the screen’s edge, the sub-categories as a ruled index with their counts: a collection with a tall picture and several sub-categories to jump to.
- Collection banner: a wide picture with the title card overlapping its edge: a collection with a strong picture or a campaign.
- Collection doors two doors: two collections side by side with one rule they share (new and classics, new and second-hand).
- Collection header centered: everything centred under the breadcrumb, large title: a short, curated collection or a brand’s page.
- Collection header plain: the title on the left and the merchant’s description on the right, then the sub-category chips: the calm top of a large catalogue.
- Collection pills hero banner: a full-bleed picture with the large title over it and the sub-collections as pills on its lower edge: an outdoor or fashion collection page.
- Collection poster overlay: a full-bleed picture with the collection’s name set huge over it and its pieces in a ribbon along the bottom: the season’s one big statement.
- Collection spec sheet hero then specs: a technical collection: an opening picture, one grid of every product, the merchant’s figures and a quote they supplied.