---
title: "StatementTable"
description: "The shared shell: hierarchy, periods, rules."
canonical: "https://lopifi.com/components/statement-table"
---

# StatementTable

> The shared shell: hierarchy, periods, rules.

Source: https://lopifi.com/components/statement-table
Part of: Lopifi — Your VC tech stack partner (https://lopifi.com)

---

- **Family:** Statements — **The largest gap in the market.** Nothing else has these.
- **Status:** Implemented
- **Spec:** https://lopifi.com/docs/catalog/statements

## Install

```bash
npx shadcn@latest add @lopifi/theme
npx shadcn@latest add @lopifi/statement-table
```

## Specification

> 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](https://lopifi.com/md/docs/motion/catalog).
- **Expansion state is in the URL**, so a shared link opens to the same view.
- **Zero values render as `—`.** Null renders as `n/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".
- **`polarity` is required on the table, no default.** It's the root of inheritance: a line without its own `polarity` takes its nearest ancestor's, and a top-level line takes the table's. `ProfitAndLoss` and `CashFlowStatement` pass `standard` (expense sections mark themselves `inverted`); `BalanceSheet` passes `neutral`. (API change: lines with no polarity anywhere above them used to fall back to `standard`.)
- **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.scale` of `thousands` or `millions` puts "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 (`presentScaled` in `lib/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 in `roundingNote`. Materiality is still tested on the exact amounts.
- **A line can cite its note.** `note` (a number) on a `StatementLine` renders a `NoteRef` beside the label, linking to that note in `StatementNotes`; `noteTitle` completes its accessible name, and the table's `noteIdPrefix` matches 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](https://lopifi.com/md/docs/craft/responsive-and-input).

### 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](https://lopifi.com/md/docs/craft/accessibility#financial-statement-semantics).

### Print
Repeating headers, `break-inside: avoid` on rows, `break-before: avoid` on totals so a total never orphans from its rule.

## Rules this component obeys

Money is minor units, never floats. `null` is not `0` and neither is redacted. Negatives render in accounting parentheses with the parenthesis column reserved on both sides. Debit and credit are two columns. Per-currency decimal places. Polarity is explicit — up is not always good. Every figure states its period, entity, currency, basis and as-of.
