Loading component…
Loading component…
An invoice and its credit note stacked like paper – switch between them, pick lines to credit, adjust amounts and issue.
To reuse this local React demo, copy all files from the Code tab into the same folder, then import Invoice&CreditNote from ./invoice-credit.
import { InvoiceCredit } from "@/components/ui/invoice-credit";
export function Billing() {
return (
<InvoiceCredit
invoiceNo="INV-2041"
creditNo="CN-0117"
lines={[
{ id: "plan", name: "Growth plan", qty: 1, rate: 1250, tax: 0.2 },
{ id: "api", name: "API calls (per 1k)", qty: 18420, rate: 0.42, tax: 0.2, group: "Metered usage" },
]}
onIssue={(credits, total) => api.issueCreditNote(credits, total)}
/>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| seller / buyer | { name, lines: string[] } | From and To blocks on the invoice | |
| invoiceNo / creditNo | string | Document numbers shown under Terms | |
| invoiceDate / dueDate / period | string | Dates shown on both documents; an empty one leaves its line out | |
| lines | InvoiceLine[] | Each { id, name, qty, rate, tax, group? } – lines with a group are listed under a heading. A negative rate is a discount; a rate that is not a number shows — and counts as 0 | |
| currency | string | "$" | A symbol shown in front of amounts ("$", "£"), or an ISO code ("EUR", "JPY") formatted with Intl – the code is also shown after the applied total |
| onIssue | (credits, total) => void | Called when the credit note is issued, with the credited amount per line and the total incl. tax | |
| className | string | Extra class on the root |
Follows its own width: below 560px the parties stack, the rate and tax columns hide and the credit tray drops the total column
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"