StatementTable
The shared shell: hierarchy, periods, rules.
npx shadcn add @lopifi/statement-tableExamples
The same component, case by case. Each stage is the shipped code with the props it shows; switch to Code for the usage.
Figures not available
A figure the books do not hold renders n/a, and so does every total it feeds — never zero.
Hide periods, freeze the header
The reader puts period columns away, and a capped height keeps the column headers in view.
In thousands
Each figure is rounded once to thousands from exact cents, so a total can differ by one.
How it behaves
What it renders, what it refuses to render, and why. The same paragraphs as the family spec, so the two can’t disagree.
The shared shell. The P&L, balance sheet and cash flow statement are all configurations of it.
Structure#
┌─ Toolbar: basis · period · comparison · currency · consolidation ─┐
├───────────────────────────────────────────────────────────────────┤
│ Account Sep 2026 Aug 2026 Change % │ ← sticky header
├───────────────────────────────────────────────────────────────────┤
│ Revenue │ section
│ Product revenue 482,100 441,200 +40,900 +9.3% │ L2
│ Subscriptions 390,400 360,100 +30,300 +8.4% │ L3
│ One-time 91,700 81,100 +10,600 +13.1% │ L3
│ Services 118,400 102,800 +15,600 +15.2% │ L2
│ ───────── ───────── ───────── │ ← single rule
│ Total revenue 600,500 544,000 +56,500 +10.4% │ subtotal
│ │
│ … │
│ ═════════ ═════════ ═════════ │ ← double rule
│ Net income 142,880 118,400 +24,480 +20.7% │ total
└───────────────────────────────────────────────────────────────────┘
The craft#
- Indentation: 24px per level (16px on phone). Levels 1–5. Anything deeper is a chart-of-accounts problem, not a UI one.
- Rule lines span the numeric columns only, each period column independently, gutters unruled. This is what makes it read as an accounting statement instead of a styled table.
- Sticky account column (left) and sticky header (top). Both, always. A P&L that loses its account names when you scroll sideways is unreadable.
- Sticky total row at the bottom for the grand total.
- Expand/collapse is instant, because it happens hundreds of times per close. The chevron rotates over 140ms; the rows don't slide, grow or stagger. This is the Tier 0 concession.
- Expansion state is in the URL, so a shared link opens to the same view.
- Zero values render as
—. Null renders asn/a. They are different facts. - Right-aligned,
tnum,case, paren column reserved. Negatives always in parentheses. - Every column header states its period explicitly. "Sep 2026", never "Current".
polarityis required on the table, no default. It's the root of inheritance: a line without its ownpolaritytakes its nearest ancestor's, and a top-level line takes the table's.ProfitAndLossandCashFlowStatementpassstandard(expense sections mark themselvesinverted);BalanceSheetpassesneutral. (API change: lines with no polarity anywhere above them used to fall back tostandard.)- The statement header carries the full context: entity, statement type, resolved period, basis (cash/accrual), presentation currency, scale, and generation timestamp. Print needs it, and the number means nothing without it.
- Scale is applied, not just labeled.
header.scaleofthousandsormillionsputs "in thousands" in the header and the caption and presents every figure, variance and hover change at that scale: divided from the exact minor units and rounded once, half away from zero, at display (presentScaledinlib/format-money). Per-currency decimals hold, so USD and JPY both scale to whole thousands of major units. The label and the figures read the same field, so they can't disagree. Rounded lines don't foot by construction; say so inroundingNote. Materiality is still tested on the exact amounts. - A line can cite its note.
note(a number) on aStatementLinerenders aNoteRefbeside the label, linking to that note inStatementNotes;noteTitlecompletes its accessible name, and the table'snoteIdPrefixmatches the notes'idPrefix.
Responsive#
One period column at a time on phone, with a swipeable period selector and a fixed account column. Values crossfade at 140ms with no translation, which would imply the labels moved too. Full spec in responsive.
Accessibility#
Real table semantics, <th scope="row"> on account names, <caption> with the resolved period, data-level for hierarchy (not aria-level, which is invalid outside a treegrid), aria-expanded/aria-controls on toggles, and subtotal/total status in the row header text, since a screen reader can't see the rule line. Full spec in accessibility.
Print#
Repeating headers, break-inside: avoid on rows, break-before: avoid on totals so a total never orphans from its rule.
The accounting it encodes
The concepts this component renders, each defined once in the lexicon.
More in Statements
See also
Where this component is specified, defined and running.
Elsewhere in the system
The live section StatementTable renders in, the calculators behind its figures, and the ledger payloads that feed it.
- StatementTable, runningThe statements showcase — live, with theme, density, grayscale and reduced-motion switches.
- Number cleanerTurn pasted amounts in any format into clean signed values, one per line.
- StatementsNo component library ships a <BalanceSheet />. That's the biggest gap in the market, and the reason Lopifi exists. Specs for 16 React components: StatementTable, StatementRow, ProfitAndLoss, BalanceSheet and 12 more.
Components are copied into your repository and meant to be edited. Rounding policy, fiscal calendar and compliance copy differ per company.
Release notes
Get an email when Statements changes
Your copy doesn’t update itself when we fix something here.
- One email when a Statements component needs a migration
- Nothing when nothing changes
Or install it now