Product story chapters — Storefront block
Prostorefront-product-story-chapters · for product pages
Product story chapters
The buy card first, beside one picture, then the story as numbered chapters with picture and words alternating sides: a product bought on its specification first, whose story rewards those who scroll on
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-product-story-chaptersUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontProductStoryChapters from '@/components/trame/blocks/storefront/storefront-product-story-chapters.vue'
const props = {
product: {
id: "trail-sentier",
name: "Trail Path running shoe",
brand: "Summit Workshop",
price: 12900,
compareAt: 15900,
currency: "USD",
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-1530792271526-7ddf516473b3?w=1600&q=80"
],
summary: "A light trail running shoe for long outings.",
description: "A light trail running shoe with a 5 mm lugged sole, designed for long outings on dry or wet trails. Breathable upper, welded tongue, supported heel.",
badge: "New",
rating: 4.6,
reviewCount: 38,
options: [
{
name: "Color",
values: [
"Midnight blue",
"Sand"
]
},
{
name: "Size",
values: [
"39",
"40"
]
}
],
variants: [
{
id: "0-39",
options: {
Couleur: "Midnight blue",
Taille: "39"
},
available: true,
stock: 12
},
{
id: "0-40",
options: {
Couleur: "Midnight blue",
Taille: "40"
},
available: true,
stock: 3
}
],
facts: [
{
label: "Weight",
value: "9.5 oz (EU size 42)"
},
{
label: "Drop",
value: "6 mm"
}
]
},
sections: [
{
title: "A sole that grips",
text: "5 mm lugs designed for dirt, dry rock and wet roots."
},
{
title: "An upper that breathes",
text: "Recycled mesh, welded rather than stitched: less rubbing, less water held."
}
],
trust: [
"Free returns within 30 days",
"Secure payment"
],
actions: {
add: "cart.add",
wishlist: "wishlist.add",
sizeGuide: "size-guide"
},
options: {
wishlistLabel: "Add to favorites",
sizeGuideLabel: "Size guide",
optionWithSizeGuide: "Size"
}
}
</script>
<template>
<StorefrontProductStoryChapters v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| product* | Product | Datathe product, with its pictures, options and variants |
| breadcrumb | Breadcrumb[] | the path to the product, from the home page; its last item is the product itself, shown as the current page |
| sections* | Section[] | the sections shown, in order |
| trust | string[] | Wordsa promise the merchant keeps ("Returns within 30 days") |
| actions | Actions | the page actions the block runs, each described below |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Product product · 22 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 | Image)[] | its pictures: an address, or an address with what that picture shows (its own alt) |
| 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 |
| description | string | Wordsthe product’s presentation, in the merchant’s words |
| facts | Fact[] | the product’s key facts, each a property and its value, e.g. "Material": "Full-grain leather" |
| variants | Variant[] | every combination of options the product comes in, with its own price and stock |
Option product.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 product.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") |
Fact product.facts[] · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Words"Material" |
| value* | string | Words"Full-grain leather" |
Variant product.variants[] · 5 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | the variant’s id, sent with cart.add |
| options* | Record<string, string> | the value of each option for this variant, by option name, e.g. { "Colour": "Navy" } |
| price | number | its own price in cents, when it differs |
| available | boolean | false: the variant is sold out |
| stock | number | the variant’s real stock, when the merchant shows it |
Breadcrumb breadcrumb[] · 4 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe link’s words, e.g. "See the collection" |
| action | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action applies to, passed to the host with it, if any |
| url | string | Designan address outside the app |
Section sections[] · 4 props
| Prop | Type | Description |
|---|---|---|
| title* | string | Words"Leather" |
| text* | string | Wordsa short paragraph |
| image | string | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| alt | string | Wordswhat the picture shows |
Actions actions · 3 props
| Prop | Type | Description |
|---|---|---|
| add* | string | Actionthe action the add-to-cart form posts to |
| wishlist | string | Actiona named action of the page |
| sizeGuide | string | Actiona named action of the page |
Options options · 4 props
| Prop | Type | Description |
|---|---|---|
| wishlistLabel | string | Words"Add to favourites" |
| sizeGuideLabel | string | Words"Size guide" |
| optionWithSizeGuide | string | Wordsthe name of the option the size guide belongs to ("Size") |
| 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
- Subtle motion: one short reveal; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
breadcrumb[],cart.add,actions.wishlist,actions.sizeGuide - Reads
productsfrom your app
A storefront section, for product pages; it uses @lucide/vue, @vueuse/core, 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
- Product showcase size run: each card shows its sizes, the unavailable ones struck through: clothing and shoes with real stock by size; the merchant’s own products and figures only.
- Product specs definition list: technical details as labelled rows, grouped and collapsible: the default for any product with specifications.
- Product specs tabbed: one group at a time behind a row of tabs, a bordered table for the chosen group and the key measurements as a strip of large values: technical products with 4 to 7 groups where one group at a time is enough.
- Product spotlight index: a numbered list of large product names and prices with one picture beside it that follows the name under the pointer, the lead product first: a range whose names carry it (four to twelve pieces), type-led and quiet; the merchant’s own products and figures only.
- Product spotlight: one product large with its facts, the others as thumbnails that swap it: a hero product among a range; the merchant’s own products and figures only.
- Product test results scored list: a product the merchant tested (weather, wear, battery): scenarios with a five-dot score and the result in words.
- Product transformation slider: a product that transforms something (a stain, a repair, a finish): the list beside a before-after slider.
- Product trust facts inline: one dotted line under the button: when the shop has one or two short facts and the buy box is already full.