Plan change dialog two pane — Billing block

Pro

billing-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-pane

Usage

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.

PropTypeDescription
titlestringWordsthe heading, e.g. "Change plan"; the interface’s words when absent
introstringWordsa sentence or two under the heading
triggerstringWordswhy 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*CurrentDatathe customer’s subscription now
quotesRecord<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"
paystringActionchanges 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
cancelCancela quiet link to the host’s own cancellation, e.g. "Cancel subscription"
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Plan plans[] · 9 props
PropTypeDescription
id*stringDatathe plan’s id
name*stringWordsthe plan’s name, e.g. "Pro"
summarystringWordsone line on who it is for, e.g. "For small teams shipping every week"
unitstringWordswhat one price counts beyond the cycle, e.g. "per seat"; absent: a flat price
currencystringDesignthe 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)
featuresstring[]Wordswhat the plan includes, in the merchant’s words; the same words across plans line up in a comparison
limitsLimit[]the quotas the plan sets, by label; the same label across plans makes one comparison row
badgestringWordsthe merchant’s own mark for this plan, e.g. "Recommended"; never added by the block
Option plans[].options[] · 4 props
PropTypeDescription
id*stringDatathe 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*numberDatathe price of one cycle in cents (of one unit, when the plan has a unit), as the merchant set it
savingstringWordsthe saving, only as the merchant states it, e.g. "2 months free"
Limit plans[].limits[] · 2 props
PropTypeDescription
label*stringWordswhat the limit counts, e.g. "Storage"
value*stringWordsthe limit as the merchant writes it, e.g. "100 GB", "Unlimited"
Current current · 2 props
PropTypeDescription
option*stringDatathe id of the option the customer is on now (a plan and a cycle, e.g. "pro-monthly")
seatsnumberhow many seats the subscription counts; shown, not changed here
Cancel cancel · 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
Options options · 1 props
PropTypeDescription
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
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: checkout.pay, cancel
  • Reads subscription from 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.

All 9 billing blocks