Invoice + Credit Note

An invoice and its credit note as two sheets: pick what to credit and issue it.

PROGet Invoice + Credit Note and 168 other Pro components with pro lifetime — Get Pro

Category
Billing
Access
Pro
Source
1,231 lines · one file
States
7 drawn
Added
21 Oct 2026

The decision inside it

You cannot credit more than was paid

Each line is capped at what was paid for it, less earlier credits. Tax is recalculated on the credited amount rather than copied, and once issued the invoice reads "Partially credited · $144.00 of $576.00" with its original figures untouched.

When to use it

Use Invoice + Credit Note to show an invoice and issue a credit note against it: each line capped at what was paid, tax recalculated on the credit, and the invoice marked partly or fully credited. Amounts are integer cents. For a list of invoices use Invoice History.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Invoice + Credit Note for this.
Install it: npx shadcn@latest add @liro/invoice-credit
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/invoice-credit.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/invoice-view.tsx
import { InvoiceCredit, type CreditDraft } from "@/components/ui/invoice-credit";

export function InvoiceView({ issue }: { issue: (draft: CreditDraft) => Promise<void> }) {
  return (
    <InvoiceCredit
      number="INV-2027-0412"
      issuedOn="1 Apr 2027"
      dueOn="15 Apr 2027"
      seller={{ name: "Liro", address: ["1 Market St", "London"] }}
      billedTo={{ name: "Olivia Martinez", company: "Vertically" }}
      lines={[
        { id: "seats", label: "Team seats", quantity: 8, unitPrice: 4000, amount: 32000 },
        { id: "setup", label: "Onboarding", amount: 16000 },
      ]}
      taxRate={0.2}
      taxLabel="VAT"
      status="paid"
      onIssue={issue}
    />
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
numberstring Yes–
issuedOnstring YesDisplay strings.
dueOnstring No–
sellerInvoiceParty Yes–
billedToInvoiceParty Yes–
linesInvoiceLine[] Yes–
taxRatenumber NoAs a fraction: `0.2` for 20%. Default 0.
taxLabelstring NoDefault "Tax".
statusInvoiceStatus NoDefault `paid`.
currencystring No–
localestring No–
logoReact.ReactNode NoThe seller's mark, shown beside its name at the top of each sheet.
paymentMethodReact.ReactNode NoHow it was paid, under Terms: `<><CardMark /> Visa •••• 4242</>`.
viewInvoiceCreditView NoWhich sheet is in front.
defaultViewInvoiceCreditView No–
onViewChange(view: InvoiceCreditView) => void No–
creditNoteCreditNote | null NoThe issued note, controlled. `null` means none issued yet.
defaultCreditNoteCreditNote | null No–
onCreditNoteChange(note: CreditNote) => void No–
defaultDraft{ lines?: Record<string, Cents>; reason?: string } NoStart the draft with these amounts (cents, per line id) and this reason.
reasonsstring[] NoOne-click reasons.
onIssue( NoMay return a promise, and may resolve with the issued note (number, date).
draftCreditDraft, Yes–
onPrint() => void NoDefault `window.print()`.

Dependencies

npm packages

clsxframer-motionlucide-reacttailwind-merge

Liro foundations, installed alongside it

liro-themebuttoninputselectstatus-chip

States

All of them are drawn by the component. None is left for you to design.

  • Invoice
  • Crediting
  • Over the cap
  • Issuing
  • Issued
  • Credited in full
  • Issue failed

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances