Price breakdown stacked bar — Storefront block
Prostorefront-price-breakdown-stacked-bar · for product, home, landing, story pages
Price breakdown stacked bar
One segmented bar and its legend: 3 to 6 lines read at a glance
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-price-breakdown-stacked-barUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontPriceBreakdownStackedBar from '@/components/trame/blocks/storefront/storefront-price-breakdown-stacked-bar.vue'
const props = {
eyebrow: "Transparence",
title: "Why this bag costs $89",
lead: "Every dollar, from the leather to our margin. The figures are from the latest production run.",
total: 8900,
lines: [
{
label: "Full-grain leather",
amount: 2400,
note: "Tanned in the USA, certified chrome-free."
},
{
label: "Workshop labor",
amount: 3100,
note: "Four hours of work, paid above the industry minimum."
}
],
compare: {
title: "At a retailer",
total: 17800,
lines: [
{
label: "Making",
amount: 5500
},
{
label: "Distribution and shipping",
amount: 3300
}
]
},
closing: "If a figure looks wrong to you, write to us: we answer.",
footnote: "March run; all prices include tax.",
options: {
currency: "USD"
}
}
</script>
<template>
<StorefrontPriceBreakdownStackedBar v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| eyebrow | string | Wordswhat this is ("Transparency") |
| title* | string | Wordsthe section’s title ("Why this bag costs €89") |
| lead | string | Wordsone or two sentences under the title |
| total* | number | Datathe price the lines explain, in cents, as the merchant set it |
| lines* | Line[] | what the price is made of, line by line |
| compare | Compare | the other route to compare with, e.g. "At a reseller" |
| closing | string | Wordsa closing sentence, as the merchant wrote it |
| footnote | string | Wordswhere the figures come from and their date |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Line lines[] · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhere the money goes ("Raw materials") |
| amount* | number | Datathe merchant’s own amount for this line, in cents |
| note | string | Wordsone line saying what it covers |
Compare compare · 3 props
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordswhat the other route is ("At a reseller") |
| total* | number | Dataits price in cents, from the merchant’s own sourced figures |
| lines* | Line[] | the other route’s cost lines |
Line compare.lines[] · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhere the money goes ("Raw materials") |
| amount* | number | Datathe merchant’s own amount for this line, in cents |
| note | string | Wordsone line saying what it covers |
Options options · 3 props
| Prop | Type | Description |
|---|---|---|
| showBars | boolean | false: hides the bars beside the figures |
| currency | string | DesignISO 4217, the shop’s by default |
| 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 |
| 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
A storefront section, for product, home, landing, story pages; it uses clsx, motion, tailwind-merge.
More storefront blocks
- Preorder banner: a pre-order announced between two sections or above a product page: the picture, the date, what is paid now, one button.
- Preorder product split: the pre-order is the page’s subject: a large picture beside the date, the two payments side by side and the terms.
- Preorder products cards: a ship window, a reserved-of-total meter and a reserve button: a limited run in preorder; the merchant’s own products and figures only.
- Preorder timeline steps: when the payment plan is the doubt (a deposit, a balance at shipping): the product small above, each step of the order drawn with its date and amount.
- Price routes two ledgers: two short ledgers, the usual route against selling direct, ending in two totals: a brand selling direct.
- Price story figures: a short account, three or four key figures and a closing sentence, no ledger: reasons that are not only cost.
- Product close ups film: tall close-ups in a row that scrolls sideways, each name over its foot, the piece leading the row as its first card: a product page band that shows the making quality without a long read.
- Product close ups index: a numbered list of the details beside one large close-up that changes as a detail is chosen, the piece’s card under the list: a few details with real explanations, read one at a time.