Skip to content
Twentyfirst UIPro

Invoice Editor

Data · InvoiceEditor, InvoicePreview

View as Markdown

An outgoing invoice as a form beside the InvoicePreview it becomes: customer picker, line items with quantity, unit, unit price, VAT rate and discount, a discount on the whole invoice, the note and the totals per rate. The preview updates as you type. It sits beside the form from 1100px (stackBelow), under it below that, and on phones (below 640px) the form and the preview become tabs.

  • value / onChange (or defaultValue) hold the draft: customer, lines (id, description, quantity, price, vat, discount, unit), discount and note.
  • vatRates are data (default 19 %, 7 % and 0 %): pass your country's rates. units adds the unit column.
  • Sums come from invoiceTotals(lines, { discount }): each line rounded to cents, VAT once per rate on the rate's net. Run the same function on your server and the numbers match to the cent.
  • Numbers are typed in the provider's locale (1,5 in German) and money is formatted with Intl.
  • preview passes InvoicePreview's own props (number, from, dates, brand); preview={false} hides it. head adds fields at the top, actions the buttons under the totals.
Amount€960.00
Amount€585.00
Amount€222.00

The number is given when the invoice is issued.

Subtotal
€1,767.00
VAT 19% on €1,545.00
€293.55
VAT 7% on €222.00
€15.54
Total
€2,076.09
Halo
Halo Workspace GmbH · Example Street 1 · 20457 Hamburg
Invoice
#2097
Bill toNorthwind
IssuedApr 16, 2026
DueApr 30, 2026
Team plan · 40 seats · May 2026 × 40€960.00
Onboarding workshop (half day) · Discount 10%€585.00
Printed handbook × 12€222.00
Net€1,767.00
VAT 19%€293.55
VAT 7%€15.54
Total due€2,076.09
Thank you for your business. Please pay within 14 days.

Props

InvoiceEditor

PropTypeNotes
value?InvoiceDraft
defaultValue?InvoiceDraft
onChange?(value: InvoiceDraft) => void
customers?{ id: string; name: string; detail?: string }[]The customer picker's options.
customerAction?ReactNodeBeside the picker, e.g. a "New customer" button.
head?ReactNodeMore fields at the top: dates, payment terms, number.
vatRates?{ value: number; label?: string }[]The VAT rates to pick from, in percent (default 19, 7 and 0). Your country's rates are data.
units?string[]Units to pick per line (hours, days, pieces …); omitted: no unit column.
currency?stringCurrency for amounts (default the provider's, euros).
lineDiscounts?booleanDiscount per line (default true).
invoiceDiscount?booleanDiscount on the whole invoice (default true).
notes?booleanThe note field (default true).
newLine?() => InvoiceDraftLineA new line (e.g. with your id); default an empty line with the first VAT rate.
preview?Partial<Omit<InvoicePreviewProps, "lines">> | falseThe live InvoicePreview beside the form (its number, from, dates …); `false` hides it. `to` defaults to the picked customer, the lines and the note come from the editor.
stackBelow?numberBelow this width (default 1100px) the preview moves under the form; below 640px they become tabs.
actions?ReactNodeUnder the totals: save, issue.
footnote?ReactNodeSmall print beside the totals ("The number is given when the invoice is issued").
readOnly?boolean
className?stringExtra class on the root element.
style?CSSPropertiesInline style on the root element.

InvoicePreview

PropTypeNotes
numberstring | numberRequired
from?string
tostringRequired
issuedstringRequired
duestringRequired
lines{ d: string; q: number; u: number; v: number; discount?: number }[]Lines: description, quantity, unit price, VAT rate in percent, optional discount in percent.
discount?numberDiscount on the whole invoice in percent (shown as subtotal, discount, net).
note?string
kind?string
brand?string
format?(n: number) => string
className?stringExtra class on the root element.
style?CSSPropertiesInline style on the root element.