Invoices and support
TotalsList
Document totals with the amounts aligned under each other: 2 decimals, the Riyal sign, a minus for a discount. The total row is bold with a line above, a hint adds a small line under a label, and accounting puts a negative amount in brackets. It computes nothing: give it the amounts from your backend. It works in a server component.
import { TotalsList } from "@percentsa/ui";Examples
- Subtotal
- 21,190.00
- DiscountSpring offer, 5%
- -1,190.00
- VAT15%
- 3,000.00
- Total
- 23,000.00
- Paid
- 25,000.00
- Balance
- (2,000.00)
Code
export function TotalsListExample() {
const t = useT();
return (
<TotalsList
className="w-full max-w-sm"
items={[
{ label: t("Subtotal", "المجموع"), amount: 21_190 },
{ label: t("Discount", "الخصم"), amount: -1_190, hint: t("Spring offer, 5%", "عرض الربيع، 5%") },
{ label: t("VAT", "الضريبة"), amount: 3_000, hint: "15%" },
{ label: t("Total", "الإجمالي"), amount: 23_000, total: true },
{ label: t("Paid", "المدفوع"), amount: 25_000 },
{ label: t("Balance", "الرصيد"), amount: -2_000, accounting: true },
]}
/>
);
}