Billing Pre Payment Balance
A prepaid balance card for consumption-based products, like API, AI, or messaging services, where usage is deducted from a running balance instead of billed after the fact. It shows the current balance, a row of quick top-up amounts, and an optional link out to usage history. Built for account settings and billing dashboards where someone needs to check their balance and add funds without leaving the page.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/billing-pre-payment-balance.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing97.tsx instead.
Usage
The file also exports billing97Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Billing97, billing97Demo } from "@/components/blocks/billing/billing97"; export default function Page() { return <Billing97 {...billing97Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | "Account balance" | Heading shown above the balance. |
| description | string | none | Optional one-line note under the heading. |
| balanceLabel | string | "Current balance" | Small label above the balance figure. |
| balance | string | none | The balance amount, already formatted as a string (for example "$18.42"). |
| topUpOptions | TopUpOption[] | none | Quick top-up amounts rendered as a grid of links. |
| usageHistoryHref | string | none | When set, shows a "View usage history" link at the bottom. |
| className | string | none | Extra classes for the outer container. |
Types
interface TopUpOption { id: string; amount: string; href: string; }
Behavior notes
- The component is purely presentational. It doesn't fetch or poll a live balance, or track which top-up amount was clicked, so wire your own state and API calls around it.
- Top-up options render as next/link elements pointing at whatever href you give each one, not buttons with an onClick, matching how the invoice download link works elsewhere in this category.
- The balance figure is a plain formatted string, not a number, so currency symbol and decimal formatting are entirely up to the caller.
- The top-up grid is 3 columns on small screens and 4 columns from the sm breakpoint up, so it stays readable with anywhere from two to eight preset amounts.
Frequently asked questions
More Billing Blocks
View all →Billing Invoice List
Invoice history table with status badges, formatted amounts, and a per-row download link, built with shadcn/ui and Tailwind CSS.
Billing Failed Payment Alert
High-contrast failed-payment alert with a message, a retry button, and an optional update-payment-method button, built with shadcn/ui and Tailwind CSS.
Billing Credit Balance
Compact credit balance card with a large total, an optional purchased-versus-promotional breakdown, a low-balance notice, and a top-up button.
Billing Payment Methods
A saved payment method list for React and Next.js with brand icons, a default badge, near-expiry warnings, and remove/set-default actions per row.
Billing Add Card
A card entry form for React and Next.js with auto-formatted fields, internal brand detection, and per-field validation feedback built with shadcn/ui and Tailwind CSS.
Billing Coupon Code
An inline promo code input for React and Next.js with a simulated loading state, an applied summary showing the discount amount, and an invalid-code message.