Collection story alternating split — Storefront block

Pro

storefront-collection-story-alternating-split · for catalog, landing, home pages

Collection story alternating split

A brand family or a maker series: picture and words swap sides chapter after chapter, a product strip under each

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-story-alternating-split

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import StorefrontCollectionStoryAlternatingSplit from '@/components/trame/blocks/storefront/storefront-collection-story-alternating-split.vue'

const props = {
eyebrow: "Fall edition",
title: "Three chapters for walking into winter",
intro: "From the first leaf-covered trail to the last campsite before the snow: what we pack, chapter by chapter.",
chapters: [
{
title: "October trails",
text: "Shorter days, slippery paths. A jacket that keeps the rain out, soles that grip.",
image: "https://images.unsplash.com/photo-1773515776505-c4e84e9f757e?w=1600&q=80",
alt: "A dirt path lined with trees in fall foliage",
products: [
{
id: 1,
name: "Alpage rain jacket",
price: 18900,
image: "https://images.unsplash.com/photo-1694561418303-16393986b86d?w=1600&q=80",
images: [
"https://images.unsplash.com/photo-1694561418303-16393986b86d?w=1600&q=80",
"https://images.unsplash.com/photo-1591047139829-d91aecb6caea?w=1600&q=80"
],
alt: "A man in profile wearing a dark green hooded rain jacket by a misty lake",
rating: 4.6,
reviewCount: 212,
badge: "New",
compareAt: 23900
},
{
id: 2,
name: "Sentier 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: "Hiking boots",
rating: 4.4,
reviewCount: 98
}
],
action: {
label: "See all trails",
action: "collection",
record: {
id: "sentiers"
}
}
},
{
title: "Camping by the water",
text: "One night outside is enough to test the gear. Light, compact, easy to pitch in the dark.",
image: "https://images.unsplash.com/photo-1576176539998-0237d1ac6a85?w=1600&q=80",
alt: "Two tents pitched on a meadow above a lake",
products: [
{
id: 3,
name: "Bivouac 40 L backpack",
price: 9500,
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, lying in the grass",
compareAt: 11900
},
{
id: 10,
name: "Two-person tent",
price: 24900,
image: "https://images.unsplash.com/photo-1682868796363-d2fb6a50dd3a?w=1600&q=80",
alt: "An orange tent by a lake, among green hills",
available: false
}
],
action: {
label: "See camping gear",
action: "collection",
record: {
id: "bivouac"
}
}
}
],
open: "product",
addAction: "cart-add",
options: {
showRating: true
}
}
</script>

<template>
<StorefrontCollectionStoryAlternatingSplit v-bind="props" />
</template>

Props

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

PropTypeDescription
eyebrowstringWordswhat the collection is ("Autumn edition")
title*stringWordsthe collection’s name, as a title
introstringWordsone or two sentences that open the story
chapters*Chapter[]one to five chapters, each with its picture and its products
openstringActionthe page action a product card opens; it receives the product
addActionstringActionthe page action that adds a product to the cart; it receives the product
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Chapter chapters[] · 6 props
PropTypeDescription
title*stringWordsthe chapter’s title ("October trails")
text*stringWordstwo sentences at most: what this chapter of the collection is about
imagestringPicturea picture: a root-relative path (/media/…) or an absolute URL
altstringWordswhat the picture shows, when the words do not say it
products*Product[]Datathe products of this chapter: three or four read best
actionActionthe chapter’s call to action: its words and the page action
Product chapters[].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 chapters[].products[].options[] · 2 props
PropTypeDescription
name*stringWordsthe option’s name, e.g. "Size"
values*string[]Wordsits values, e.g. "S", "M", "L"
Highlight chapters[].products[].highlights[] · 2 props
PropTypeDescription
label*stringWordsthe property ("Material", "Capacity")
value*stringWordsits value, as the merchant states it ("Washed linen", "50 cl")
Action chapters[].action · 3 props
PropTypeDescription
label*stringWordswhat happens ("See the whole chapter")
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action opens (a category), if any
Options options · 2 props
PropTypeDescription
showRatingbooleantrue: shows each product’s rating
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.ratingAverage rating {rating} out of 5Note moyenne {rating} sur 5
grid.saleSale pricePrix réduit
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
  • Expressive motion, within its budget; still under reduced motion
  • Real buttons and links, a visible focus
  • Asks your app through actions: chapters[].action, open, addAction
  • Reads products from your app

A storefront section, for catalog, landing, home pages; it uses @lucide/vue, class-variance-authority, clsx, motion, reka-ui, tailwind-merge.

More storefront blocks

  • 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.
  • Condition grades grade scale: a grading of used or restored goods: each grade in plain words with its price band.
  • Configurable purchase stacked: a modular product (a sofa, a bike, a shelf): each step chooses a part, and the price adds the choices to the product’s price.
  • Contact sheet: up to a dozen small numbered frames, the kept ones outlined, with a count under: the story of a shoot, honestly told.

All 409 storefront blocks