Skip to content
Toolkit

ADR-0022: A Studio component that draws its own edges pads its own edges, rather than asking the call site to know

  • Status: Accepted
  • Date: 2026-08-19
  • Deciders: Renaissance workstream 002, phase 02 (Pagination, the third conversion); follows ADR-0019, ADR-0020 and ADR-0021

Context

Pagination looked like the cheapest conversion in the queue, and on the evidence available before the work started it was: the two PaginationProps interfaces are character-identical — page, total, perPage, onPageChange, perPageOptions, onPerPageChange, itemLabel, className — and the arithmetic, the null-render condition and the ARIA match line for line. ADR-0019 had nothing to say: there was no contract to raise and no call site to edit. Twelve renders, one alias, a swap of the import.

What the prop comparison could not see is that the app's component named two classes, not one:

<nav className="table-foot pagination" aria-label="Pagination">

.pagination was the component's own rule — a flex row and a gap, and the sole thing the conversion was expected to delete. .table-foot is a shared class that fourteen other pages hand-roll a footer with, so it stays — and it was quietly supplying something the component depended on:

.table-foot { padding: var(--space-3) var(--space-5); border-top: …; }

That --space-5 is the same gutter .data-table's th and td use. Studio's .lk-pagination drew its own hairline and its own padding-top and had no horizontal padding at all, so on every call site the range readout and the caret buttons would have moved 20px left of the content above them — past tsc, the linter, the parity gate and every existing test, because none of them can see a padding.

The wrong answer, and how it was caught

The first attempt at this ADR made the gutter an opt-in modifier, inset, reasoning that it was needed only where the footer sits inside a container with no padding of its own — <Card padding="none">, which four of the twelve call sites use. That predicate is wrong, and an adversarial review of the change found it before it shipped.

The four in-card sites are not a distinct case. VcardsPage and NotificationHandlersPage have the identical visual shape — a <Card padding="none"> wrapping a .data-table, footer directly beneath — except the footer is the card's next sibling rather than its child. Those two would have been left misaligned by a containment test while wanting exactly the alignment it was written to protect. The remaining five sit under stacks of default <Card>, whose padding="md" is also var(--space-5), so their content starts at the same 20px too.

So the count is not four-of-twelve. Eleven of the eleven product call sites had the gutter before, and all eleven want it after; the twelfth is a Storybook story. A modifier that every real consumer must remember to pass is not an API, it is a trap with documentation — and the test suite written alongside it asserted the modifier's mechanism thoroughly while asserting that any call site actually passed it not at all. Deleting inset from a page would have left all twenty-four tests, tsc, the linter and the parity gate green.

Decision

A Studio component that draws its own edges — its own border, its own vertical rhythm — pads its own edges too. It does not ask the call site to know what its container is doing.

For Pagination that means the gutter moves into the base rule and the inset prop is deleted:

.lk-pagination {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-top: 0.5px solid var(--border);
  …
}

Three things follow from stating it this way.

The default is the common case. No call site passes anything; all eleven get the alignment they had before the conversion. The failure mode the previous draft had — a screen silently misaligned because someone forgot a boolean — does not exist, rather than being tested for.

The gutter is a Studio value, not an app value. --space-5 is the token .lk-table's cells already use, so the alignment is not a coincidence a future padding change would break — both sides move together. The alternative a call site could reach for, className="px-5" from the app, would put a Studio geometry decision in apps/web, which is what AGENTS.md §2 forbids and what this workstream exists to undo.

A component that pads itself is the right shape here specifically because it already draws itself. .lk-pagination is not a bare row that a container arranges; it is a self-contained footer with a hairline above it and a rhythm of its own. Padding is part of that unit. This is not a general licence for every Studio component to pad itself — a component that is only content should still let its container place it.

Consequences

  • Conversions must read what the app component's shared classes were doing, not only the one class the conversion is deleting. ADR-0021 said to grep the class name rather than the component; this extends it — a class you are keeping can still be load-bearing for the component you are moving, and the props tell you nothing about it. The check is: for every class the old component named, what would be missing if it stopped naming it?
  • A rule derived from four examples is a guess. The containment predicate fit every site that had been looked at closely and broke on the two that had been classified from a glance. Where a conversion invents a rule, the rule must be checked against every call site, not the ones that motivated it — and the cheapest way to find out is to ask someone to attack it.
  • Prefer removing a failure mode to testing for it. Where a conversion can choose between an opt-in that must be remembered and a default that cannot be forgotten, take the default. The test that would have caught the inset bug is one nobody thought to write, because it asserts call sites rather than behaviour.
  • If a Pagination ever needs to sit inside a container that already pads it, the answer is className taking the inline padding back off — not a new boolean. No such consumer exists today.
  • Not decided here: whether the app's .table-foot should itself become a Studio pattern. Fourteen pages hand-roll a footer with it and never touched the component, and four of those hand-roll a paginator with no controls at all. That is list-page consistency work of its own, recorded on the session file rather than absorbed into this conversion.

Source: docs/decisions/0022-a-studio-component-carries-the-gutter-its-container-cannot-give.md

Library