Product story sticky story — Storefront block

Pro

storefront-product-story-sticky-story · for product pages

Product story sticky story

Pictures and short paragraphs scroll beside a buy card that stays in view: a craft or premium product with something to tell

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-sticky-story

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import StorefrontProductStoryStickyStory from '@/components/trame/blocks/storefront/storefront-product-story-sticky-story.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>
<StorefrontProductStoryStickyStory v-bind="props" />
</template>

Props

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

PropTypeDescription
product*ProductDatathe product, with its pictures, options and variants
breadcrumbBreadcrumb[]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
truststring[]Wordsa promise the merchant keeps ("Returns within 30 days")
actionsActionsthe page actions the block runs, each described below
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Product product · 22 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
images(string | Image)[]its pictures: an address, or an address with what that picture shows (its own alt)
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
descriptionstringWordsthe product’s presentation, in the merchant’s words
factsFact[]the product’s key facts, each a property and its value, e.g. "Material": "Full-grain leather"
variantsVariant[]every combination of options the product comes in, with its own price and stock
Option product.options[] · 2 props
PropTypeDescription
name*stringWordsthe option’s name, e.g. "Size"
values*string[]Wordsits values, e.g. "S", "M", "L"
Highlight product.highlights[] · 2 props
PropTypeDescription
label*stringWordsthe property ("Material", "Capacity")
value*stringWordsits value, as the merchant states it ("Washed linen", "50 cl")
Fact product.facts[] · 2 props
PropTypeDescription
label*stringWords"Material"
value*stringWords"Full-grain leather"
Variant product.variants[] · 5 props
PropTypeDescription
id*string | numberthe 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" }
pricenumberits own price in cents, when it differs
availablebooleanfalse: the variant is sold out
stocknumberthe variant’s real stock, when the merchant shows it
Breadcrumb breadcrumb[] · 4 props
PropTypeDescription
label*stringWordsthe link’s words, e.g. "See the collection"
actionstringActiona named action of the page
recordRecord<string, unknown>Datathe record the action applies to, passed to the host with it, if any
urlstringDesignan address outside the app
Section sections[] · 4 props
PropTypeDescription
title*stringWords"Leather"
text*stringWordsa short paragraph
imagestringPicturea picture: a root-relative path (/media/…) or an absolute URL
altstringWordswhat the picture shows
Actions actions · 3 props
PropTypeDescription
add*stringActionthe action the add-to-cart form posts to
wishliststringActiona named action of the page
sizeGuidestringActiona named action of the page
Options options · 4 props
PropTypeDescription
wishlistLabelstringWords"Add to favourites"
sizeGuideLabelstringWords"Size guide"
optionWithSizeGuidestringWordsthe name of the option the size guide belongs to ("Size")
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
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
  • 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 products from 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 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.
  • Product trust facts list: icon lines under the buy button, one fact per line: the usual place for delivery, returns and guarantee.
  • Product trust facts tiles: a 2 by 2 grid of small cards with a big figure and a caption: when the facts are numbers worth reading at a glance.

All 409 storefront blocks