Skip to content
Toolkit

ADR-0028: An empty state inside a frame does not draw one — the contract a component has with its container

Context

The last three conversions each found the ledger row wrong in a new direction. ADR-0026: the same name can be two different elements. ADR-0027: the same name can be two different kinds of control, and the real counterpart may be exported under another name. Textarea then widened that again — the same kind of control, and still not one-to-one, because the app exported a field where Studio exports a control plus a wrapper.

EmptyState passes all three of those checks. Run ADR-0027's question first: is Studio's same-named export the same kind of thing? Yes — both are a centred column of icon, headline, sentence and one action, for a list with nothing in it. Run ADR-0026's: diff the elements. They are near-identical. Run Textarea's: is the app's export doing more than one job Studio has split? No — one export each. Then diff the props, which is where every previous check ends:

app components/ui/EmptyState.tsxStudio EmptyState (feedback.jsx)
Iconicon?: ReactNode in an .icon-tile.is-lgicon — an icon-font class in .lk-empty__tile
Headlinetitle: string → <h3 class="empty-state-title">title → <h3 class="t-title-sm">, plus accent
Sentencedescription?: stringchildren
Actionaction?: ReactNodeactions?: ReactNode
Paddingcompact?: boolean — --space-5 vs --space-8 --space-5—
Announcedrole="status"nothing

Three of those are ordinary migration work, one is ADR-0024 again, and none of them is the finding. The finding is a row that is not in the table at all, because it is not a property of the component:

.lk-empty { border: 1px dashed var(--border-strong); background: var(--surface); }

DESIGN.md specifies that frame, and it is right. It is right for an empty state that is the page's content — the thing you see when a collection is empty and the collection is the screen. It is wrong for an empty state that is the body of something that already drew edges. Of the 21 places Cardsite renders one:

  • 14 are the empty prop of a DataTable, landing in td.lk-table__empty inside the table's own border;
  • 2 are the body of a Card;
  • 5 are free-standing in the page — CataloguePage's no-results state and the four AI pages' History sections, each sitting directly under a section heading with nothing else around it.

So the import swap the ledger row implies ships a dashed box inside a border on 16 screens out of 21. Nothing in the props says so, nothing in the component can see it, and — the part that makes this worth an ADR rather than a commit message — every check the previous six ADRs added comes back clean. ADR-0022 is the nearest miss: it is about the space a component needs from its container, and made a Studio component pad its own edges rather than ask the call site what its container was doing. This is the mirror image. It is about the material a component draws that its container has already drawn, and the answer cannot be "always" or "never".

The app component had it right by accident on 16 of those and wrong on 5: it drew no edges at all, so it could not double up, and it could not stand alone either — which is why all five free-standing empty states in the product are bare columns floating in the page.

And the count above is itself the ADR's cautionary tale. The first draft of this document said 20 of 21, because the survey it was written from described the four AI sites as "not wrapped in a Card" and that phrase was read as a container rather than as its absence. An adversarial recount — one that named the immediate rendering container of each site rather than summarising them — moved four sites from one column to the other and changed which variant they ship. That is the same failure ADR-0022 records, at the same step, one conversion later, which is why the check below is stated as a procedure and not as a caution.

Decision

A Studio component that draws its own frame takes a variant that does not, and the variant is named for the container, not for the size.

Concretely, for EmptyState:

  1. .lk-empty keeps the frame DESIGN.md specifies. It is the default because a component's default should be the standalone case — an empty state that draws nothing is invisible when nothing else is on the screen, and that failure is silent, where a double border is at least visible.
  2. compact drops the frame and tightens the padding. Its meaning is "my container already draws edges", not "smaller". The prop name survives from the app component, where 19 of 21 sites already passed it; its definition does not, and neither does which sites get it: of those 19, four are free-standing and now render framed.
  3. The frame is neutralised with border-color: transparent, not border: 0. The border stays in the box model, so a framed and a compact empty state of the same content are the same height and a call site can switch between them without relayout.
  4. DESIGN.md gains the variant. A rule the stylesheet has and the specification does not is how the two drift.

This keeps an opt-in that ADR-0022 removed, and the difference is the minority. ADR-0022's rule is prefer removing a failure mode to testing for it: it deleted Pagination's inset prop because 11 of 11 call sites wanted the gutter, so the prop was "a trap with documentation" — a modifier every real consumer had to remember. compact is the same shape at 16 of 21, and it survives for the one reason inset could not: the minority here is real and permanent. Five empty states genuinely stand alone in the page, and an empty state that draws nothing when nothing else is on screen is the silent failure inset never had a counterpart for. There is no default that serves both, and the component cannot see its own container.

What ADR-0022 is owed instead is the artefact it says nobody writes — it records that inset's suite "asserted the modifier's mechanism thoroughly while asserting that any call site actually passed it not at all". So keeping the opt-in is conditional on the call-site check: EmptyState.test.tsx reads every page, works out what actually contains each empty state, and fails if the variant disagrees in either direction. A trap with documentation is a trap; a trap with a gate is a prop.

And the general check this adds, before any conversion: for every component that draws a frame, a background, a shadow or a rule, ask what is already drawing that where this lands — and answer it by listing the immediate rendering container of every call site, not by classifying them from the component's own file. ADR-0022's first draft failed exactly this way: it keyed a gutter on "inside a flush card", which fit the four call sites read closely and broke on the two classified from a glance.

Two corollaries that fall out of the same reasoning:

  • The count is the argument. "Most call sites want X" is not a call-site-by-call-site override; it is a variant. 16 of 21 is a variant. It is also why the variant is not the default: the other five are real.
  • A call site that changes variant is a rendering change, and it is recorded. Five did here, in both directions. LinksPage was the app's non-compact default inside a <Card> and now passes compact, because the alternative was a dashed box inside a card border. The four AI History sections passed compact and no longer do, because they stand alone and the app had never had a frame to give them. Both belong in the commit and in the archive register, not in a reviewer's memory.

Consequences

  • EmptyState gains compact, and .lk-empty--compact joins the component layer. apps/web passes it at 16 of 21 sites, and a test asserts that.
  • Every one of the 21 changes appearance, and that is stated rather than implied by "one call site changed on purpose". Adopting Studio's material is the point of the conversion (ADR-0019), but the deltas are the visible facts of the commit: the headline goes 14px/600 in --on-surface to 22px --font-display/500 in --text; the sentence 13px/--on-surface-3 at 340px measure to 15px/--text-2 at 420px; the icon tile 48px on --surface-2 in --on-surface-2 ink to 52px on --accent-soft in --accent-line — a grey tile turning lime on 19 screens; and the column gap 8px to 16px. A 22px display headline inside a 20px-padded table cell on 14 screens is the largest of these and is deliberate.
  • The headline must declare its own ink, which the first draft of this change forgot. .t-title-sm declares no color because the full bundle has an ambient --text; the standalone layer has no ambient anything, and td.lk-table__empty sets color: var(--text-3) for its own bare placeholder. So on the 14 table sites the headline inherited a step fainter than .lk-empty__desc's declared --text-2 directly beneath it. This is ADR-0023's "two components that render against each other agree on the values that align them" at a property that ADR did not reach — it moved padding off that cell and left color on it. .lk-empty__title now states --text. The --text-3 still belongs on .lk-table__empty-text rather than on the cell; that is DataTable's rule to move, recorded rather than reached for here.
  • DESIGN.md's empty-state paragraph gains a sentence for the variant.
  • Two defects found on the way, both live for Studio consumers before this app imported anything, and both recorded here because they are instances of rules that already exist rather than new ones:
    • The markup named t-title-sm and t-body. Those classes are generated into studio.type.css, which is in the full bundle and in no standalone layer — so every consumer importing @studio/core/css/components alone got the frame, the tile and the actions, and a headline in whatever the host's default happened to be. This is ADR-0023 rule (a) precisely: a .t- selector cannot join the .lk- layer without escaping the namespace the build checks, so the markup stops naming it and .lk-empty__title / .lk-empty__desc carry the material at the type scale's own values. preview/studio-design.html hid it for the same reason it hides missing icon fonts — it links the full studio.css.
    • icon rendered <i className={icon}>. Passing the lucide element every icon-bearing call site in this app holds would have produced class="[object Object]" and a blank 52px tile. ADR-0024; the fix is the string | ReactNode contract MenuAction.icon already carries.
  • role="status" moves from the app component into Studio, and the claim is bounded: it marks the region, and whether a screen reader announces it is a separate question. All 21 sites mount the region and its content in one commit, and a live region inserted together with its text is not reliably announced — inherited from the component this replaces, not introduced, and not fixed by this change. Ten sites also put a <Button> inside the live region, which is a documented smell and is likewise inherited. An empty state is usually the only thing on screen and usually replaces a list that was there a moment ago; nothing announced that to a screen reader on any Studio consumer.
  • What this does not decide. Whether the other framed components — Card, Banner, .lk-panel — have the same defect where they nest. They probably do somewhere; finding out is a survey, not this conversion. Nor does it reach Swift: StudioEmptyState draws its dashed border unconditionally and has no variant, so React and CSS now express something Swift cannot. The parity gate matches names and will not see it — phase 04's problem, recorded here so it is not discovered there.

Source: docs/decisions/0028-an-empty-state-inside-a-frame-does-not-draw-one.md

Library