Data display

Dense ledger

<forma-dense-ledger>

Compact expert-work table with bounded overflow, stable relationships, and explicit text state.

Authoring tag
<forma-dense-ledger>
Category
Data display
Behavior owner
Application content
Canonical source
patterns/dense-ledger.html

Purpose

A dense ledger is a native table with tight cell padding, tabular numerals and ruled rows, meant for expert users who read many rows and compare values down columns. It keeps its table shape at every width: when the columns do not fit, the table scrolls inside an .forma-bounded-overflow region instead of recomposing into cards, so column relationships stay intact. Forma styles the table only; the rows, their order and the meaning of each state are application content.

Use when

  • Operators or analysts scan many rows and compare values vertically, such as ledgers, audit entries or reconciliation lists.
  • Row and column relationships must survive on narrow screens, and horizontal scrolling inside a labelled region is acceptable.
  • State is short text per row (Needs review, Ready, Unknown) rather than a color.

Avoid when

  • Casual users on phones need to act on individual records: use Data grid, which recomposes into labelled records.
  • The content is a few labelled facts about one object: use Key-value list.
  • Rows are work that needs a decision: use Work queue so the reason and action lead.
  • A small number of options is compared across attributes for a choice: use Comparison grid.

Behavior to know

  • Tabular, lining numerals (font-variant-numeric: tabular-nums) keep digits aligned down a column.
  • Every cell is start-aligned and top-aligned, so multi-line cells stay readable without extra alignment rules.
  • Cell padding is one custom property, --forma-ledger-cell-space, so density can tighten without forking CSS.
  • It has no responsive recomposition; the surrounding .forma-bounded-overflow region provides containment.

Basic example

The smallest correct markup: the canonical pattern from patterns/dense-ledger.html inside its public tag. Copy this first, then adapt labels, names and state.

Canonical

Minimal dense ledger

Rendered from the canonical pattern file.

Recent operational entries
ReferenceStatusOwnerAmount
INV-1042Needs reviewBilling$5,000
INV-1043ReadyBilling$2,750
HTML · Minimal dense ledger Raw HTML for HTML · Minimal dense ledger
<forma-dense-ledger class="forma-component-tag">
<div class="forma-bounded-overflow" role="region" aria-label="Operational ledger" tabindex="0">
  <table class="forma-dense-ledger">
    <caption>Recent operational entries</caption>
    <thead><tr><th scope="col">Reference</th><th scope="col">Status</th><th scope="col">Owner</th><th scope="col">Amount</th></tr></thead>
    <tbody><tr><th scope="row">INV-1042</th><td>Needs review</td><td>Billing</td><td>$5,000</td></tr><tr><th scope="row">INV-1043</th><td>Ready</td><td>Billing</td><td>$2,750</td></tr></tbody>
  </table>
</div>
</forma-dense-ledger>

Click or tap the code once to select all of it, then copy.

Examples

Scenario

Unknown and missing values

Reconciliation rows where some values are not yet known. Each gap is written as text (Unknown, Not recorded) instead of an empty cell or a dash, so an unknown amount is never read as zero.

Payment reconciliation, 29 September
ReferenceBank amountLedger amountStatus
PAY-88120$1,250.00$1,250.00Matched
PAY-88121$980.40$908.40Mismatch: review
PAY-88122Unknown$4,000.00Bank file pending
PAY-88123$75.00Not recordedMissing ledger entry
HTML · Unknown and missing values Raw HTML for HTML · Unknown and missing values
<forma-dense-ledger class="forma-component-tag">
  <div class="forma-bounded-overflow" role="region" aria-label="Payment reconciliation" tabindex="0">
    <table class="forma-dense-ledger">
      <caption>Payment reconciliation, 29 September</caption>
      <thead><tr><th scope="col">Reference</th><th scope="col">Bank amount</th><th scope="col">Ledger amount</th><th scope="col">Status</th></tr></thead>
      <tbody>
        <tr><th scope="row"><span class="forma-identifier">PAY-88120</span></th><td>$1,250.00</td><td>$1,250.00</td><td>Matched</td></tr>
        <tr><th scope="row"><span class="forma-identifier">PAY-88121</span></th><td>$980.40</td><td>$908.40</td><td>Mismatch: review</td></tr>
        <tr><th scope="row"><span class="forma-identifier">PAY-88122</span></th><td>Unknown</td><td>$4,000.00</td><td>Bank file pending</td></tr>
        <tr><th scope="row"><span class="forma-identifier">PAY-88123</span></th><td>$75.00</td><td>Not recorded</td><td>Missing ledger entry</td></tr>
      </tbody>
    </table>
  </div>
</forma-dense-ledger>

Click or tap the code once to select all of it, then copy.

Scenario

Wide audit ledger

Seven columns of audit entries. The table keeps its full width and the .forma-bounded-overflow region scrolls horizontally inside itself, so the page layout is not pushed wider. The region is focusable for keyboard scrolling.

Access audit entries
EntryTime (UTC)ActorActionResourceSource addressOutcome
AUD-50311m.okaforRole grantedbilling/approvers10.40.12.7Allowed
AUD-50312svc-exportBulk exportcustomers/eu-west10.40.3.19Denied by policy
AUD-50313j.lindqvistKey rotatedpayments/signing-key10.40.12.22Allowed
HTML · Wide audit ledger Raw HTML for HTML · Wide audit ledger
<forma-dense-ledger class="forma-component-tag">
  <div class="forma-bounded-overflow" role="region" aria-label="Access audit entries" tabindex="0">
    <table class="forma-dense-ledger">
      <caption>Access audit entries</caption>
      <thead>
        <tr><th scope="col">Entry</th><th scope="col">Time (UTC)</th><th scope="col">Actor</th><th scope="col">Action</th><th scope="col">Resource</th><th scope="col">Source address</th><th scope="col">Outcome</th></tr>
      </thead>
      <tbody>
        <tr><th scope="row">AUD-50311</th><td><time datetime="2026-09-29T08:14:02Z">08:14:02</time></td><td>m.okafor</td><td>Role granted</td><td>billing/approvers</td><td>10.40.12.7</td><td>Allowed</td></tr>
        <tr><th scope="row">AUD-50312</th><td><time datetime="2026-09-29T08:15:40Z">08:15:40</time></td><td>svc-export</td><td>Bulk export</td><td>customers/eu-west</td><td>10.40.3.19</td><td>Denied by policy</td></tr>
        <tr><th scope="row">AUD-50313</th><td><time datetime="2026-09-29T08:16:11Z">08:16:11</time></td><td>j.lindqvist</td><td>Key rotated</td><td>payments/signing-key</td><td>10.40.12.22</td><td>Allowed</td></tr>
      </tbody>
    </table>
  </div>
</forma-dense-ledger>

Click or tap the code once to select all of it, then copy.

Scenario

Tighter cells for a side panel

A ledger in a narrow side panel sets --forma-ledger-cell-space to a smaller spacing token on the table. Density changes only padding; text size and numerals are unchanged.

Recent adjustments
ReferenceAmountBy
ADJ-201−$120.00Billing
ADJ-202$45.50Support
ADJ-203$0.00Billing
HTML · Tighter cells for a side panel Raw HTML for HTML · Tighter cells for a side panel
<forma-dense-ledger class="forma-component-tag">
  <div class="forma-bounded-overflow" role="region" aria-label="Recent adjustments" tabindex="0">
    <table class="forma-dense-ledger" style="--forma-ledger-cell-space: var(--forma-primitive-spacing-1, 0.25rem)">
      <caption>Recent adjustments</caption>
      <thead><tr><th scope="col">Reference</th><th scope="col">Amount</th><th scope="col">By</th></tr></thead>
      <tbody>
        <tr><th scope="row">ADJ-201</th><td>−$120.00</td><td>Billing</td></tr>
        <tr><th scope="row">ADJ-202</th><td>$45.50</td><td>Support</td></tr>
        <tr><th scope="row">ADJ-203</th><td>$0.00</td><td>Billing</td></tr>
      </tbody>
    </table>
  </div>
</forma-dense-ledger>

Click or tap the code once to select all of it, then copy.

Mobile

Each mobile example renders in its own document inside a real narrow viewport, so Forma's media and container queries run exactly as they would on a phone. Choose a width to compare.

Mobile example

Mobile ledger with contained scroll

The same five-column ledger at phone width. Columns keep their order and alignment; the region scrolls sideways inside its own bounds.

Viewport width

Frames narrower than the selected width show the component at the width available.

What changes at narrow widths

  • The ledger never recomposes. Below its natural width the .forma-bounded-overflow region scrolls horizontally, so the page itself has no horizontal overflow at 320px.
  • overscroll-behavior: contain stops a sideways swipe inside the ledger from scrolling the page or triggering browser back gestures.
  • scrollbar-gutter: stable reserves the scrollbar space so content does not jump when the scrollbar appears.
  • The row header column (th scope="row") scrolls with the rest; keep the reference column first so each row stays identifiable when scrolling starts.
  • In landscape, more columns fit and the scroll distance shrinks; nothing else changes.
HTML · Mobile ledger with contained scroll Raw HTML for HTML · Mobile ledger with contained scroll
<forma-dense-ledger class="forma-component-tag">
  <div class="forma-bounded-overflow" role="region" aria-label="Inventory movements" tabindex="0">
    <table class="forma-dense-ledger">
      <caption>Inventory movements</caption>
      <thead><tr><th scope="col">Movement</th><th scope="col">SKU</th><th scope="col">Quantity</th><th scope="col">Location</th><th scope="col">Status</th></tr></thead>
      <tbody>
        <tr><th scope="row">MV-7001</th><td>BRK-2210</td><td>240</td><td>Aisle 14, bay C</td><td>Received</td></tr>
        <tr><th scope="row">MV-7002</th><td>BRK-2214</td><td>−18</td><td>Returns cage</td><td>Needs count</td></tr>
      </tbody>
    </table>
  </div>
</forma-dense-ledger>

Click or tap the code once to select all of it, then copy.

Baseline

Mobile · 320px

The canonical pattern in a true 320px viewport, the minimum width every Forma component must support without page-level horizontal scrolling.

Viewport width

Frames narrower than the selected width show the component at the width available.

API and configuration

Forma components have no JavaScript API. Their public contract is the markup: native elements and attributes you write, and the CSS hooks below. The CSS hook table is generated from the built stylesheet, so it always matches the shipped implementation.

Native and ARIA attributes
AttributeOnValuesDefaultDescription
role.forma-bounded-overflowregion—Names the scroll container as a landmark so it can be found and scrolled.
aria-label.forma-bounded-overflowstring—Accessible name of the scroll region; usually the table's caption.
tabindex.forma-bounded-overflow0—Makes the region keyboard-focusable so overflowing columns can be scrolled with arrow keys.
scopethcol | row—col on header cells, row on the reference cell that identifies each row.
datetimetimeISO date-time—Machine-readable timestamp for time columns.
styletable.forma-dense-ledger--forma-ledger-cell-space—Optional inline override of cell padding, or set the property from application CSS.
CSS hooks (derived from dist/all.css)
HookKindValues or defaultDescription
.forma-dense-ledgerBlock class—The native table. Full width, collapsed borders, tabular numerals and ruled rows.
--forma-ledger-cell-spaceCustom property—Padding of every th and td. Default var(--forma-primitive-spacing-2) (0.5rem).
Keyboard interaction
KeysResult
TabFocuses the scroll region (and any links or buttons inside cells).
Arrow keysScroll the focused region natively. There is no cell-by-cell navigation.

Form behavior

Not a form control.

States

Dense ledger states
StateHow it is expressedPresentation
Fitstable width ≤ region widthNo scrollbar; the table fills the container.
Overflowingtable wider than .forma-bounded-overflowThe region scrolls horizontally inside itself; the page does not widen.
Unknown or missing valueapplication text in the cellWritten as words such as Unknown or Not recorded; Forma adds no styling that could be mistaken for a value.

Accessibility

Forma provides

  • Keeps a native table, so headers, row headers and cell relationships are exposed by the platform at every width.
  • Never hides or reorders columns at narrow widths, so the reading order is the same on every device.
  • Uses start-aligned, tabular numerals so values can be compared without relying on color.

Your application supplies

  • Wrap the table in .forma-bounded-overflow with role="region", aria-label and tabindex="0" whenever it can overflow.
  • Provide a caption and mark the identifying column with th scope="row".
  • Write state as explicit text; distinguish unknown, missing, zero and not applicable.
  • Keep units in the header or the value, not only in color or position.

Responsive behavior

  • No breakpoints: the table keeps its structure at every width.
  • Containment comes from .forma-bounded-overflow: overflow: auto, overscroll-behavior: contain and a stable scrollbar gutter.
  • Cells wrap long words (overflow-wrap: anywhere on td and th) before forcing extra width.
  • On phones, prefer fewer columns chosen by the application over many narrow ones.

Motion

  • No animation: the ledger has no transitions. Scrolling is native and follows the user's scroll settings.

Usage guidance

Do

  • Put the identifying reference in the first column as a row header.
  • Keep units and signs in the value text (−$120.00, 12,480 kg).
  • Use Identifier & critical value for long codes that users must copy or verify.

Avoid

  • Right-aligning some columns with ad hoc CSS; Forma's contract is start-aligned tabular numerals.
  • Leaving cells blank when a value is unknown.
  • Using a dense ledger as the primary phone experience for non-expert users.

Verification specimens

Generated fault-injection specimens expose content, spacing, color-cue, and reduced-effective-contrast risks. They screen presentation robustness as engineering screens without claiming human-subject validation.