Plan change dialog two pane — Billing block
Probilling-plan-change-dialog-two-pane · for settings, account, app pages
Plan change dialog two pane
An upgrade opened by a locked feature, inside the host’s dialog: the chosen plan’s benefits on one side; the plan switch, the billing cycle, the seats, what is due today and then, and one button on the other
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/billing-plan-change-dialog-two-paneUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import BillingPlanChangeDialogTwoPane from '@/components/trame/blocks/billing/billing-plan-change-dialog-two-pane.vue'
const props = {
title: "Change plan",
intro: "Prices are per editor and before tax. Viewers and commenters are always free.",
trigger: "Version history beyond one year is part of Team.",
plans: [
{
id: "solo",
name: "Solo",
summary: "For one designer working on their own files",
currency: "USD",
options: [
{
id: "solo-monthly",
cycle: "month",
price: 900
},
{
id: "solo-yearly",
cycle: "year",
price: 9000,
saving: "2 months free"
}
],
features: [
"Unlimited canvases",
"Export to PNG, SVG and PDF"
],
limits: [
{
label: "Editors",
value: "1"
},
{
label: "Storage",
value: "5 GB"
}
]
},
{
id: "pro",
name: "Pro",
summary: "For small teams sharing one library",
unit: "per editor",
currency: "USD",
options: [
{
id: "pro-monthly",
cycle: "month",
price: 1600
},
{
id: "pro-yearly",
cycle: "year",
price: 16000,
saving: "2 months free"
}
],
features: [
"Unlimited canvases",
"Export to PNG, SVG and PDF"
],
limits: [
{
label: "Editors",
value: "Up to 10"
},
{
label: "Storage",
value: "100 GB"
}
],
badge: "Recommended"
}
],
current: {
option: "pro-monthly",
seats: 4
},
quotes: {
"solo-monthly": {
dueToday: 0,
nextCharge: 900,
nextDate: "2026-11-18",
note: "No charge today: Solo starts at your next renewal."
},
"solo-yearly": {
dueToday: 6420,
nextCharge: 9000,
nextDate: "2027-11-18",
note: "Includes a $25.80 credit for the unused part of this month."
},
"pro-yearly": {
dueToday: 60560,
nextCharge: 64000,
nextDate: "2027-11-18",
note: "Includes a $34.40 credit for the unused part of this month."
},
"team-monthly": {
dueToday: 3040,
nextCharge: 11200,
nextDate: "2026-11-18",
note: "Prorated for the 19 days left in this cycle."
},
"team-yearly": {
dueToday: 108560,
nextCharge: 112000,
nextDate: "2027-11-18",
note: "Includes a $34.40 credit for the unused part of this month."
}
},
pay: "billing.changePlan",
cancel: {
label: "Cancel subscription",
action: "billing.cancel"
}
}
</script>
<template>
<BillingPlanChangeDialogTwoPane v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title | string | Wordsthe heading, e.g. "Change plan"; the interface’s words when absent |
| intro | string | Wordsa sentence or two under the heading |
| trigger | string | Wordswhy this opened, e.g. "Version history beyond 30 days is part of Team"; shown first when given |
| plans* | Plan[] | Datathe plans to choose from, 2 to 4, in the merchant’s order (cheapest first): each with one option per billing cycle, whose id is what the change posts |
| current* | Current | Datathe customer’s subscription now |
| quotes | Record<string, QuotesValue> | Datawhat each change costs, keyed by option id, as the host computed it: an option without one shows its price and "The exact amount is shown at confirmation" |
| pay | string | Actionchanges the plan: posts `{ plan }`, the chosen option’s id (e.g. "team-yearly"); without it, or when the page lacks it, the plans are shown read-only |
| cancel | Cancel | a quiet link to the host’s own cancellation, e.g. "Cancel subscription" |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Plan plans[] · 9 props
| Prop | Type | Description |
|---|---|---|
| id* | string | Datathe plan’s id |
| name* | string | Wordsthe plan’s name, e.g. "Pro" |
| summary | string | Wordsone line on who it is for, e.g. "For small teams shipping every week" |
| unit | string | Wordswhat one price counts beyond the cycle, e.g. "per seat"; absent: a flat price |
| currency | string | Designthe ISO 4217 code of its prices, e.g. "USD"; the app’s own when absent |
| options* | Option[] | its prices, one option per billing cycle (monthly, yearly) |
| features | string[] | Wordswhat the plan includes, in the merchant’s words; the same words across plans line up in a comparison |
| limits | Limit[] | the quotas the plan sets, by label; the same label across plans makes one comparison row |
| badge | string | Wordsthe merchant’s own mark for this plan, e.g. "Recommended"; never added by the block |
Option plans[].options[] · 4 props
| Prop | Type | Description |
|---|---|---|
| id* | string | Datathe option’s id, one per plan and cycle, e.g. "pro-yearly": what a plan change posts as `plan` |
| cycle* | 'month' | 'year' | the billing cycle this price is for: month or year |
| price* | number | Datathe price of one cycle in cents (of one unit, when the plan has a unit), as the merchant set it |
| saving | string | Wordsthe saving, only as the merchant states it, e.g. "2 months free" |
Limit plans[].limits[] · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhat the limit counts, e.g. "Storage" |
| value* | string | Wordsthe limit as the merchant writes it, e.g. "100 GB", "Unlimited" |
Current current · 2 props
| Prop | Type | Description |
|---|---|---|
| option* | string | Datathe id of the option the customer is on now (a plan and a cycle, e.g. "pro-monthly") |
| seats | number | how many seats the subscription counts; shown, not changed here |
Cancel cancel · 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 |
Options options · 1 props
| Prop | Type | Description |
|---|---|---|
| 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
- Subtle motion: one short reveal; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
checkout.pay,cancel - Reads
subscriptionfrom your app
A billing section, for settings, account, app 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 billing blocks
- Payout methods asset kit: Downloadable resources in a document shelf; the merchant’s own only.
- Payout methods cards: Definition cards for payment methods; the merchant’s own only.
- Payout methods results wall: Consented partner results as an editorial wall; the merchant’s own only.
- Plan addons list: a plan with options: active add-ons, those available, and the total of the next invoice.
- Stack: the whole subscription in one centred column: plan and usage, payment method, invoices.
- Summary aside: a long invoice history: the plan and next invoice stay in a sticky column beside it.