---
title: "TransactionTable"
description: "The workhorse. Virtualized, sticky, priority-collapsing."
canonical: "https://lopifi.com/components/transaction-table"
---

# TransactionTable

> The workhorse. Virtualized, sticky, priority-collapsing.

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

---

- **Family:** Ledger & tables — 
- **Status:** Implemented
- **Spec:** https://lopifi.com/docs/catalog/ledger-tables

## Install

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

## Specification

> The workhorse. Every detail of it is a deliberate choice.

### Column priority
```
P1  date · description · amount        never dropped
P2  status · account
P3  category · merchant
P4  reference · memo · created-by · tags
```

### Four presentations
| Width | Presentation |
|---|---|
| ≥1280 | Full table, sticky header, sticky total footer |
| 1024–1280 | P4 dropped into a per-row expand |
| 768–1024 | **Sticky description (left) + sticky amount (right), metadata scrolls between** |
| <768 | `TransactionCard` list — a genuine re-rank |

Almost nobody builds the 768–1024 pattern, and it's what makes a wide table usable at laptop width. **The label and the number stay pinned while the metadata scrolls between them**, so the two things being compared are always on screen. Sticky cell backgrounds, `IntersectionObserver` edge fades, inner borders and unclipped focus rings are covered in [responsive](https://lopifi.com/md/docs/craft/responsive-and-input#table-collapse).

### Craft
- **Virtualized past 100 rows** (`@tanstack/react-virtual`), with correct `aria-rowcount` / `aria-rowindex` so a screen reader knows the real total.
- **Amounts right-aligned, `tnum`, paren column reserved, hugging the card inset.**
- **Row heights on the grid:** 32 / 40 / 48 by density.
- **Zebra striping: no.** `--border-subtle` row dividers instead. Striping doubles the background changes on a scrolling surface and fights hover and selection.
- **Selection is a checkbox column**, always visible on touch, hover-or-focus-revealed on desktop. `Shift`-click range select, `Cmd`-click toggle.
- **Sort is instant.** No FLIP, no stagger; it happens too often. Every column sorts on its
  value: amounts on minor units, status on workflow urgency instead of the alphabet, so one
  click puts the exceptions on top. Uncontrolled by default. Pass `sort` + `onSortChange` and
  the host owns it, which is the only correct setup once the rows are a page of a larger set.
- **Columns drag.** Widths are px, persisted per user under `columnStorageKey`, with
  `description` taking the slack. See [`ColumnHeader`](https://lopifi.com/md/docs/catalog/ledger-tables#172-columnheader).
- **Sticky header** gains its shadow only once content scrolls beneath (sentinel + `IntersectionObserver`).
- **Sticky total footer**: one row height plus a 1px top rule. It's the number people are looking for.
- **Pending rows** carry a 2px `--warning` left border and their pending status, at full opacity: a row dimmed to 0.6 drops its secondary text under AA (3.2:1). Confirmation removes the border.

### Keyboard
Full grid model: arrows move between cells, and the grid is **one** tab stop. Table in [accessibility](https://lopifi.com/md/docs/craft/accessibility#data-grid-keyboard-model).

### Motion
Tier 0 almost entirely. Row hover is `background-color` at 100ms, with no transform, shadow or lift. Insert and delete animate; sort, filter, and paginate do not.

## 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.
