Statement table
A ledger with a running balance, sections, subtotals and a total; signed amounts; CSV export.
import { StatementTable, buildStatement, statementToCsv } from "@forgeron/ui";| Date | Description | Reference | Amount | Balance |
|---|---|---|---|---|
| Opening balance | €500.00 | |||
| October | ||||
| 2026-10-03 | Invoice INV-0101 | INV-0101 | €2,400.00credit | €2,900.00 |
| 2026-10-14 | Payment received | PAY-77 | €1,500.00debit | €1,400.00 |
| Subtotal October | €900.00credit | €1,400.00 | ||
| November | ||||
| 2026-11-02 | Invoice INV-0108 | INV-0108 | €980.00credit | €2,380.00 |
| 2026-11-09 | Credit note | CN-0004 | €120.00debit | €2,260.00 |
| Subtotal November | €860.00credit | €2,260.00 | ||
| Closing balance | €1,760.00credit | €2,260.00 | ||
import { StatementTable, type StatementEntry } from "@forgeron/ui";
import { useState } from "react";
const entries: StatementEntry[] = [
{
id: "1",
date: "2026-10-03",
description: "Invoice INV-0101",
reference: "INV-0101",
amount: 240000,
group: "October",
},
{
id: "2",
date: "2026-10-14",
description: "Payment received",
reference: "PAY-77",
amount: -150000,
group: "October",
},
{
id: "3",
date: "2026-11-02",
description: "Invoice INV-0108",
reference: "INV-0108",
amount: 98000,
group: "November",
},
{
id: "4",
date: "2026-11-09",
description: "Credit note",
reference: "CN-0004",
amount: -12000,
group: "November",
},
];
export default function Default() {
const [last, setLast] = useState("");
return (
<div style={{ width: 760, maxWidth: "100%", display: "grid", gap: 8 }}>
<StatementTable
label="Customer account"
entries={entries}
currency="EUR"
locale="en"
opening={50000}
onExport={({ csv }) => setLast(`${csv.split("\r\n").length} lines ready to save`)}
/>
{last ? <p style={{ margin: 0, font: "12px var(--font-mono)" }}>{last}</p> : null}
</div>
);
}| Date | Description | Amount | Balance |
|---|---|---|---|
| Opening balance | €0.00 | ||
| 2026-11-02 | Train, Lyon to Paris | €89.00debit | -€89.00 |
| 2026-11-02 | Lunch with a client | €32.40debit | -€121.40 |
| 2026-11-05 | Cash advance returned | €50.00credit | -€71.40 |
| Net spent | €71.40debit | -€71.40 | |
import { StatementTable, type StatementEntry } from "@forgeron/ui";
const entries: StatementEntry[] = [
{ id: "1", date: "2026-11-02", description: "Train, Lyon to Paris", amount: -8900 },
{
id: "2",
date: "2026-11-02",
description: "Lunch with a client",
reference: "R-12",
amount: -3240,
},
{ id: "3", date: "2026-11-05", description: "Cash advance returned", amount: 5000 },
];
export default function Expenses() {
return (
<div style={{ width: 640, maxWidth: "100%" }}>
<StatementTable
entries={entries}
currency="EUR"
locale="en"
invert
sort="date"
showReference={false}
totalLabel="Net spent"
/>
</div>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
entries | StatementEntry[] | — | { id, date, description, reference?, amount (signed, minor units), group? }. Money in is positive. |
currency | string | — | An ISO 4217 code (`EUR`, `USD`, `JPY`): every amount is in its minor units. |
locale | string | — | A BCP 47 tag for the numbers and the symbol; the device's by default. |
opening | number | 0 | The balance before the first entry. |
grouped | boolean | — | Sections with a subtotal each. By default when an entry has a `group`. |
sort | "date" | "none" | "none" | Orders entries by date. |
showBalance / showReference | boolean | true | The columns. |
invert | boolean | false | Money out is normal (expenses): swaps the colours, the signs stay. |
onOpenEntry | (entry) => void | — | Rows become buttons. |
onExport | ({ rows, csv }) => void | — | Adds an Export button. Saving the file is yours. |
totalLabel / openingLabel / subtotalLabel | string | — | The words of the rows. |
className | string | — | Extra classes. |