---
title: "PeriodGrid"
description: "The ruled grid. Frozen panes, hidden columns, hover change, ⌘C."
canonical: "https://lopifi.com/components/period-grid"
---

# PeriodGrid

> The ruled grid. Frozen panes, hidden columns, hover change, ⌘C.

Source: https://lopifi.com/components/period-grid
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/period-grid
```

## Specification

The ruled grid: rows down, periods across, and the six spreadsheet behaviors an accountant
uses within a minute of opening a workbook. Every period-by-period surface in the system
(`ForecastTable`, `BudgetVsActual`, `RevenueTracker`, `ExpenseTracker`, `DriverModel`,
`ScenarioCompare`, `PlByDimension`) is a configuration of this grid, not another table written
from scratch.

### Ruled cells, and why the statements are not
A statement is read across one row at a time, and its horizontal rules carry meaning: single
above a subtotal, double under a total. A period grid is read *down* a column as often as
across, and the eye loses a column with no left edge as soon as two neighboring figures are the
same width. So the grid boxes every cell, and the statements keep their accounting rules with a
vertical seam between period columns.

`border-collapse: separate` is required. In a collapsed table a sticky cell loses its borders
when it detaches, because the border belongs to the table and the cell scrolls away from it.

### Freeze panes
Top row and left column, the two everyone freezes. The freeze shadow appears only once
something is hidden behind it. A permanent shadow on a grid that fits its container hints at a
scroll that can't happen.

### Hidden columns
Nobody reviews fourteen months at once. Hiding isn't deleting: rows index into the full column
list, so a hidden column never renumbers the data, and a declared comparison (`column.compare`)
still measures against its base while the base is off screen. The hidden-column count is always
shown with a one-click way back, because a reader who hid six columns last quarter needs to know
the grid isn't the whole story.

### The change, printed under the figure
The figure answers "how much"; the next question is always "versus what". That answer is printed
under every figure at once, small, toned and right-aligned, instead of revealed cell by cell on
hover. People open this grid to compare, and a comparison you can make only one cell at a time
isn't one. The pointer and the keyboard cursor still fill the formula bar under the grid with
the full sentence, including the amount and the column it's measured against.

The sub-line is a percentage, not an amount. The amounts are already on screen above and to the
left; the percentage is what the eye can't work out while scanning seven columns. On a
percentage row it shows points instead. Calling a move from 51.8% to 53.0% "+2.3%" is the most
common way a deck misleads by accident.

**No invented percentages.** No ratio against a zero base or a negative base, and a missing
figure stays missing. The sub-line says which case it was instead of printing a number that
reads backwards, and the first column on screen shows an en dash, not a zero.

### Annotations, not views
Two independent toggles, % change and % of a named base row, each add a line under the figures
without replacing them. A segmented Value / Δ / Δ% switch makes the reader hold one number in
their head while looking at the other, and a grid that swaps its numbers for percentages on a
tab press has to be re-read every time it's touched.

### Typing
Off by default. A grid over posted figures is a report, and if a report accepts typing,
someone will believe they changed it. Where a caller marks cells editable (a driver model's
projected inputs, never its actuals or computed rows), a cell opens on double-click or `Enter`
and accepts what a spreadsheet accepts, including `1.2k`, `(1,240)` and `=1200+340`. A value it
can't parse commits nothing, not zero.

### Keyboard and clipboard
One tab stop, then arrow keys, `PageUp`/`PageDown`, `Home`/`End`, shift to extend a range and
⌘C to copy it. The clipboard carries `data-raw` values, so the paste sums in the spreadsheet.

**API change:** `PeriodRow.polarity` is now required, no default (rows without one previously fell back to `standard`). Polarity describes the figure as stored: a cost stored negative is `standard`, a cost stored positive is `inverted`, a headcount is `neutral`.

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