Spend trend stacked bars — Charts block
Procharts-spend-trend-stacked-bars · for settings, account pages
Spend trend stacked bars
A plan with variable spend: three figures and a stacked bar chart of what each period cost
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/charts-spend-trend-stacked-barsUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import ChartsSpendTrendStackedBars from '@/components/trame/blocks/charts/charts-spend-trend-stacked-bars.vue'
const props = {
plan: {
name: "Team",
description: "Up to 10 members, 50 GB of files.",
price: 4900,
interval: "month",
renewsOn: "November 1, 2026",
status: "active",
statusLabel: "Active",
nextInvoice: 6100
},
payment: {
brand: "Visa",
last4: "4242",
expires: "08/28"
},
invoices: [
{
id: 1000,
number: "FA-2026-0120",
date: "September 1",
status: "open",
amount: 4900
},
{
id: 999,
number: "FA-2026-0119",
date: "August 1",
status: "paid",
amount: 6100
}
],
actions: {
change: "plans",
cancel: "cancel-subscription",
updatePayment: "payment",
downloadAll: "invoices-archive",
invoices: "invoices",
invoice: "invoice"
},
history: [
{
label: "May",
parts: [
{
label: "Subscription",
amount: 4900
},
{
label: "Seats",
amount: 0
}
]
},
{
label: "Jun",
parts: [
{
label: "Subscription",
amount: 4900
},
{
label: "Seats",
amount: 600
}
]
}
],
options: {
reading: "Usage accounts for most of the increase since May; the base subscription hasn’t changed."
}
}
</script>
<template>
<ChartsSpendTrendStackedBars v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| plan* | Plan | Datathe subscription |
| payment | Payment | Datathe card on file; absent: none yet |
| invoices | Invoice[] | Datathe invoice history, newest first |
| history* | History[] | Dataspend by period, oldest first |
| 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 |
Plan plan · 9 props
| Prop | Type | Description |
|---|---|---|
| name* | string | Wordsthe plan’s name |
| description | string | Wordsone line on what it includes |
| price* | number | an amount in cents |
| interval* | string | Wordsthe billing period, as written ("month", "year") |
| renewsOn | string | Wordsthe next renewal, as the billing provider wrote it |
| status | 'active' | 'trial' | 'past_due' | 'cancelling' | the plan’s status: active, trial, past_due, cancelling |
| statusLabel | string | Wordsthe status written out ("Active", "Trial") |
| nextInvoice | number | the total of the next invoice |
| currency | string | DesignISO 4217 |
Payment payment · 4 props
| Prop | Type | Description |
|---|---|---|
| brand* | string | Words"Visa" |
| last4* | string | Wordsthe last four digits only |
| expires | string | Wordsas written ("08/28") |
| holder | string | Wordsthe card holder’s name |
Invoice invoices[] · 7 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | the invoice’s id |
| number* | string | Wordsthe invoice’s number |
| date* | string | Wordsas the provider wrote it |
| status* | 'paid' | 'open' | 'failed' | 'void' | the invoice’s status: paid, open, failed, void |
| statusLabel | string | Wordsthe status written out ("Paid") |
| amount* | number | an amount in cents |
| currency | string | DesignISO 4217 |
History history[] · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe period ("Sept.") |
| parts* | Part[] | what the amount is made of, e.g. "Subscription", "Seats" |
Part history[].parts[] · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Words"Subscription", "Seats", "Use" |
| amount* | number | an amount in cents |
Actions actions · 7 props
| Prop | Type | Description |
|---|---|---|
| change | string | Actionchange plan |
| cancel | string | Actioncancel; opens the host’s confirmation |
| updatePayment | string | Actiona named action of the page |
| downloadAll | string | Actiona named action of the page |
| invoices | string | Actionthe full invoice list |
| invoice | string | Actiondownload one invoice (receives the invoice) |
| addon | string | Actiontoggle an add-on (receives the add-on) |
Options options · 4 props
| Prop | Type | Description |
|---|---|---|
| reading | string | Wordsone sentence reading the spend chart, as the merchant wrote it |
| footnote | string | Wordsa line on proration or taxes, as configured |
| visibleInvoices | number | how many invoices are shown before the rest fold |
| 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 |
| 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
- No motion; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
actions.change,actions.cancel,actions.updatePayment,actions.downloadAll,actions.invoices,actions.invoice,actions.addon - Reads
subscription,invoicesfrom your app
A charts section, for settings, account pages; it uses @lucide/vue, @vueuse/core, class-variance-authority, clsx, reka-ui, tailwind-merge.
More charts blocks
- Heatmap ranked rows: the rows sorted by their total, each one a thin strip of its cells, when which row leads matters more than the columns.
- Key metrics featured: The merchant’s own primary metric takes the lead beside a quiet list of supporting measures.
- Key metrics tiles: Centered figures on generous tiles for the merchant’s own headline measures, with context beneath.
- Metric grid ruled grid: an analytics page of the host’s own measures over a chosen period: one ruled grid of chart tiles sharing their borders, the first metric leading at two thirds, each with its value, this period against the previous and an area chart.
- Stat cards linked: figures about goals or finance, each with a status line that leads to the detail.
- Stat cards plain: two to six headline figures at a glance, each with its change when the server gives one.
- Stat cards strip: one calm bordered band of figures, to sit inside another card above a chart or a table.
- Stat cards trend: figures that come with their last points, to see the shape and not only the number.