The plan with dialogs to change or cancel it, usage that warns near its limits, the card on file and invoices.
When to use
- The plan with dialogs to change or cancel it, usage near its limits, the card on file and invoices.
- The billing page of any subscription product.
When not to use
- One-time purchases without a subscription: an order history fits better.
- Picking a plan for the first time: Pricing tiers.
Usage
Billing settings with your own data: every prop has the sample as its default, so pass only what you have.
import { BillingSettings } from "@/components/dashral/blocks/billing-settings"
<BillingSettings
plans={plans}
plan={subscription.plan}
billing={subscription.interval}
used={usage}
card={paymentMethod}
invoices={invoices}
onChangePlan={(plan, billing) => api.billing.changePlan(plan, billing)}
onCancel={(reason) => api.billing.cancel(reason)}
onUpdatePayment={() => openPortal()}
/>API reference
BillingSettings
A billing page: the plan with its renewal, a dialog to change it (monthly or yearly, with the saving) and one to cancel it (with a reason, and a way back); usage against the plan's limits, warning near the top; the card on file; and past invoices to download. Every part comes from props, and every action calls your handler first: one that throws changes nothing and says why at the top.
| Prop | Type | Default |
|---|---|---|
plans | BillingPlan[] | sample |
plan | stringThe plan you're on, by id, and how it's billed. | "growth" |
billing | Billing | "monthly" |
canceled | booleanWhether it's set to cancel at the renewal. | false |
renews | stringWhen it renews (or ends, once canceled). | "Nov 1, 2026" |
used | { seats: number; events: number; storage: number }What's used of the plan's limits. | sample |
usageNote | string | sample |
card | { brand: string; last4: string; expires: string } | nullThe card on file; null shows none. | sample |
billingEmail | string | "finance@acme.com" |
taxId | string | "ID 01.234.567.8-901" |
invoices | BillingInvoice[] | sample |
currency | string | "USD" |
locale | string | "en-US" |
onChangePlan | (plan: string, billing: Billing) => Promise<void> | void | — |
onCancel | (reason: string) => Promise<void> | voidCancels at the renewal, with the reason given (if any). | — |
onResume | () => Promise<void> | void"Keep my plan" after canceling. | — |
onUpdatePayment | () => void | — |
onDownload | (invoice: BillingInvoice) => voidAn invoice without an href: download it yourself. | — |
type Billing
= "monthly" | "yearly"type BillingPlan
A plan: its price a month (a year is ten months), its limits and its icon.
| Prop | Type | Default |
|---|---|---|
id | string | — |
name | string | — |
monthly | number | — |
seats | number | — |
events | number | — |
storage | number | — |
icon | React.ReactNode | — |
type BillingInvoice
| Prop | Type | Default |
|---|---|---|
id | string | — |
date | string | — |
amount | number | — |
status | "paid" | "refunded" | "open" | — |
href | string | — |