ADR-0024: A Studio component takes an icon it can draw, not only a font class it can name
- Status: Accepted
- Date: 2026-08-19
- Deciders: Renaissance workstream 002, phase 02 (
DropdownMenu/Popover, the fifth conversion); follows ADR-0019, ADR-0020, ADR-0021, ADR-0022 and ADR-0023
Context
Studio names its icons the way a stylesheet has to: a class on an <i>.
<DropdownMenu items={[{ id: 'edit', label: 'Edit', icon: 'ph ph-pencil' }]} />
For the vanilla layer that is the only thing available — a stylesheet cannot
hand a consumer an SVG — and for the preview page it looks right, because
preview/studio-design.html loads Phosphor from a CDN. Studio ships no icon
font, and Cardsite loads none. Every one of those glyphs is a blank space in
the product.
This is not a new finding. It has now been paid for three times:
Paginationconverted withph ph-caret-left/ph ph-caret-righton its two controls, which were blank squares until the adversarial pass drew them as inline SVG (ADR-0022).DataTableconverted with threeph-arrow*sort glyphs — the worst of the set, because sort direction is carried in that icon and nowhere else on screen, so every list header said only that a column could be sorted.DropdownMenuarrived withph-bold ph-checkon the checked row, where the glyph is again the only thing that says the item is on:aria-checkedcarries it to a screen reader and nothing carried it to anyone else.
Six React modules still emit ph-* classes. Fixing each as its component
converts is already the rule; what was missing is a rule for the half the
component does not own.
Because there are two halves, and only one of them had an answer:
- Icons the component draws itself — a close button, a caret, a check.
These belong to the component, and the answer is settled: draw them inline,
as
resource.jsxandconfirm.jsxdo. - Icons the consumer supplies —
items[].iconon a menu, and the same prop onMenuItem,Choiceand everything else that takes one. Here the type wasstring, and a class name is the only thing a host could pass. A host with no icon font had no way to put an icon on a menu row at all.
The app has icons — lucide-react, on every screen. It had no way to
give one to a Studio component. So the story that renders the converted
DropdownMenu had a choice between three lucide elements it could not pass and
three Phosphor class names that would render as three blank spaces.
Decision
A Studio component's icon prop accepts an element as well as a class name.
/** Trailing glyph. An icon-font class name — 'ph ph-pencil' — or an
* element, for a host that loads no icon font. */
icon?: string | ReactNode;
A string is rendered as <i className={icon} aria-hidden>, unchanged, so the
vanilla layer and every existing call site keep working. Anything else is
rendered as given. The component's CSS styles both — .lk-menu__item > i and
.lk-menu__item > svg carry the same size and colour — so a host's own icon
set lands in the right place at the right weight without the host knowing
Studio's internals.
And an icon a component draws for itself is drawn, never named. If the glyph carries meaning that nothing else on screen carries — a sort direction, a checked state, a close affordance — it is inline SVG. An icon-font class leaves that meaning to a font the consumer may not have.
Consequences
- The remaining six modules on the Phosphor list (
chrome,controls,feedback,overlays,shell,surfaces) each get both halves as they convert: their own glyphs drawn, their consumer-facing icon props widened. preview/studio-design.htmlkeeps class names in its cards, because that page documents the vanilla markup and does load the font. Its note now says so, and says which glyphs are drawn instead — otherwise the page is once again the reason a defect is invisible.- The type widens rather than changes:
icon?: stringwas never wrong for the vanilla layer, it was incomplete for a React host. No call site migrates. - This does not make Studio ship an icon font, and does not make Cardsite load one. That remains the open question underneath all three findings; this decision makes it stop being a blocker while it is open.
Verification
apps/web/src/components/DropdownMenu.test.tsx asserts that a menu with a
checked row contains svg.lk-menu__check and that nothing in the open menu
carries a ph- class at all, and that an element passed as icon renders while
a string still produces <i class="ph …">. Both were watched failing against a
component reverted to the icon-font class and to string-only icons.
Source: docs/decisions/0024-a-studio-component-takes-an-icon-it-can-draw-not-only-a-class-it-can-name.md