documentation: Knowledge note for the UI kit (src/platform/ui)
Back to our planType
documentation
Summary
Write the short note on the shared UI kit: not its props (the generated reference has those), but the behavior the components carry, such as how links and buttons choose what to render, how charts pick a drawing library, which sizes are shared with the CSS, and what shows only to staff.
Problem
Every page uses the kit, and its components hold behavior a props table doesn't show: shared CSS variables, the chart adapter order, polling for a new version, staff-only bars. A change in one of them reaches every page.
What the generated reference already shows, so the note doesn't repeat it: The shared components reference, opens in a new tab lists all 70 components with props, variants and where each is used, and docs/ui/component-set.md holds the rules and decided choices. The note links both and adds only behavior.
Proposed fix
Write src/platform/ui/README.md from the template. Owner's direction for every note (2026-11-06, Claude session, recorded on #712 and #719): a note explains the behavior and logic of its content types and code (what shows, where, when, who publishes or changes it, and the special rules), never a list of fields; and every link between fields is stated near the top, so no agent has to work it out from the code.
Links between fields the note states up front (each one checked in the code first):
layoutSizes.tsandscrollMargin.tsread CSS variables fromsrc/app/(frontend)/globals.css, so the header's height and the reading width are defined once (#616); the tests check the names.ButtonandLinkrender throughAppLink:next/linkfor routes, a plain anchor for in-page#links so focus moves (AppLink.tsx);CMSLinkturns a resolved CMS link into aButtonin the editor's look (CMSLink.tsx).- Images:
getMediaUrlkeeps upload paths relative so Next optimizes them as local images, and the image'supdatedAtis its cache key (ImageMedia.client.tsx,src/platform/lib/getMediaUrl.ts). - A chart's colors follow its parts' order (
chart-1tochart-6, a seventh part is an error) (chart/chartPalette.ts,src/platform/lib/chart/spec.ts). - A
Fieldhands its one control its id, description and invalid state through one context, so no control repeats the wiring (fieldContext.ts,Field.client.tsx).
Behaviors and rules the note must cover (each with the file or test named):
- Charts: the first adapter in
chart/chartRegistry.tsthat supports a kind draws it, the text adapter last as the fallback; every adapter passeschart/chartAdapter.contract.tsx; the data table and zoom dialog (chart/ChartDataTable.tsx,chart/ChartZoom.client.tsx). VersionCheckpolls for a new build outside development and shows a toast that reloads the page; a dismissed build isn't offered again (VersionCheck.client.tsx).AdminBarshows only to admins and editors (AdminBar.client.tsx, #203);LivePreviewListenerrefreshes the page in Live Preview.LoadMoreloads a few pages on scroll, then asks for a click so the footer stays reachable (LoadMore.client.tsx).- The "On this page" menu needs a minimum number of sections (
onThisPage.ts). MapEmbeddraws a live map only for a Google embed address (MapEmbed.client.tsx).- Fixed texts for a form's network failures (
formMessages.ts, #204). - Native elements the kit wraps so pages never use them raw (guard rail 2), and the lint that bans raw tags outside the kit.
Tests to name under "Rules and the tests that protect them": the component tests (*.test.tsx), layoutSizes.test.ts, scrollMargin.test.ts, chart/chartRegistry.test.ts, chart/chartAdapter.contract.test.tsx, chart/chartLibraries.lint.test.ts, chart/chartPalette.test.ts.
Map entry: { "note": "src/platform/ui/README.md", "paths": ["src/platform/ui/**"] }
Acceptance criteria
- Not done:
src/platform/ui/README.mdfollowsdocs/knowledge/note-template.mdand is at most 80 lines. - Not done: It explains behavior and logic, not fields: no field lists, props tables or route lists. It links the generated pages named above for those.
- Not done: Right after its opening sentences, a short list states every link between fields named above (relationships, values copied or derived, mapper inputs and the props they become, hooks that copy a value), each with its file.
- Not done: Every behavior listed above is covered or, if the code turns out different, the note says what the code does and this issue gets a comment saying what changed.
- Not done: Every statement names the file or test it comes from, checked against the code at the branch's base.
- Not done:
docs/knowledge/index.mdgets one short line for the note (a few words after the link). It stays within the budget check. - Not done:
docs/knowledge/map.jsongets the entry above. - Not done:
npm run agent-context -- --writehas been run and its generated rule committed, andnpm run agent-contextpasses. If the budget check fails, this issue is not done; trimming other always-loaded files is not part of this issue. - Not done: Known contradictions: #279 applies: the feedback-message snippet in
docs/guidelines/components-and-content.mduses a rawdivwhereAlertexists. Replace it withAlertusage (a fact fix in a policy file: the PR says so), regenerate its copy withnpm run agent-context -- --write, and comment on #279 which item this closes. #769 (tone names across Alert, Badge and Card) is separate: name it under Known gaps. #158, #366 and #531 don't apply here. - Not done: No code changes. A bug or gap found in the code goes under the note's "Known gaps" and is filed as its own issue (labeled
scope-creep, linked here). - Not done:
Prettier,Knowledge sync,PR PolicyandAgent contextpass.
Files likely touched
src/platform/ui/README.mddocs/knowledge/index.md(one line)docs/knowledge/map.json(one entry).claude/rules/generated/src--platform--ui--README.mddocs/guidelines/components-and-content.md(the #279 snippet).claude/rules/generated/docs--guidelines--components-and-content.md(regenerated)docs/roles/frontend-eng.md(only if a fact is wrong, for #158)
Must not touch
- Code under
src/(the note itself excepted): this issue documents behavior and changes none. - Other notes, their generated rules, and the files the other note issues under #712 list.
docs/knowledge/note-template.mdand the session-start set (CLAUDE.md,AGENTS.md,docs/guidelines/guard-rails.md).docs/architecture/data-model.md,docs/ui/data-types.md,docs/ui/component-set-modules.md: read them and fold this area's facts into the note (decision 0019, section 7); report any drift in them in a comment on #712 instead of editing them, since every note issue reads them.src/modules/README.md,src/platform/README.md,docs/project.md(#725 owns them).
Open questions
- Session-start room. The index line needs room at session start, which #799 makes. This issue is blocked by #799 and is not Ready until it lands; the line then stays within the budget check.
- Dead code first. #728 (the audit, waiting for the owner's keep-or-drop marks) removes unused or unwanted code before a note describes it. This issue is marked blocked by #728; it can start once #728 has settled this area, even if other areas are still open there.
- Size: not set; a cloud session can't read the board. Suggested: M.
Area
tooling, frontend
Priority
medium
Generated by Claude Code, opens in a new tab