Billing Upcoming Invoice Preview
A forward-looking invoice preview card that shows exactly what a customer will be charged on their next renewal: itemized line items (base plan, usage overage, seat add-ons, prorations), a subtotal, estimated tax, and a final total, next to the due date. Built for the billing or subscription tab of an account settings screen, so the question "what's my next charge" has an answer before the charge happens.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its card, badge dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/billing-upcoming-invoice-preview.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing12.tsx instead.
Usage
The file also exports billing12Demo, 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 { Billing12, billing12Demo } from "@/components/blocks/billing/billing12"; export default function Page() { return <Billing12 {...billing12Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | "Upcoming invoice" | Heading shown at the top of the card. |
| planName | string | none | Optional plan and billing-cycle line shown under the title. |
| dueDate | string | none | Formatted due date, shown in the badge and repeated in the total row. |
| lineItems | InvoiceLineItem[] | none | Itemized charges rendered in the order given; negative amounts (credits, prorations) are just formatted strings like "-$8.20". |
| subtotal | string | none | Formatted subtotal, shown as a plain string so currency formatting stays up to the caller. |
| tax | string | none | Formatted estimated tax; the tax row is omitted entirely if not set. |
| total | string | none | Formatted final total, shown bold in the last row. |
| className | string | none | Extra classes for the outer card. |
Types
interface InvoiceLineItem { description: string; quantity?: number; amount: string; }
Behavior notes
- All money values (amount, subtotal, tax, total) are plain formatted strings, not numbers, so currency symbol, locale formatting, and negative-value display are entirely up to the caller.
- Credits and prorations are just line items with a string amount that starts with a minus sign, for example "-$8.20"; there's no separate credit prop or styling branch for them.
- The tax row only renders when the tax prop is set, so the card also works for regions or plans where tax isn't estimated up front.
- The line item list uses aria-label="Invoice line items" on the ul so screen readers announce it as a distinct group before reading each row's description and amount.
- The due date string is rendered twice, once in the header badge and once in the total row label, so it stays visible even if someone scrolls past the header on a long line-item list.
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.