ADR 0011 — Chat surface: shadcn/ui on Tailwind v4, kebab-case feature layout ​
- Status: accepted (2026-09-29). Amended (2026-10-01): the agent and release pickers are no longer native selects. The owner asked for agent selection "a little more like the new ChatGPT", so the agent is picked from a Radix dropdown menu in the top bar (
agent-menu.tsx: radio items, the chosen agent's releases as a second group of the same menu), which works from a phone and from the keyboard like any menu. The<optgroup>of the revisions is a labelled group of the menu. Also amended (2026-10-01): a thread has a right-hand panel, a new feature foldersrc/features/panel/(the Activity and Sources tabs; docked beside the chat on a wide window, a sheet on a narrower one, as the thread list is on a phone), built on theTabsprimitive insrc/components/ui; the Sources tab reads the links in the agents' words withmdast-util-from-markdown,mdast-util-gfmandmicromark-extension-gfm, the parserremark-gfmalready uses for the chat, pinned as direct dependencies. Also amended (2026-11-14): the theme is the person's to choose (System, the default and still what the app did before, Light or Dark), which reverses the rejection below of "a.darkclass with a toggle" ("a setting nobody asked for"): the owner asked for it (ADR 0067, slice 5). It is a display preference of this device and of this client, kept inlocalStorageand in no API route or field, so a second client of the same API keeps its own and nothing indocs/api/changes. The mechanism is notnext-themesand not a class: one attribute,<html data-theme="light|dark">, always the resolved theme, set before the first paint by an inline head script that the page's content security policy allows by its hash (the same mechanism as the sidebar's and the panel's head scripts; the policy is two halves that a browser enforces together,lib/csp.ts: the static server's header still lists'unsafe-inline'in itsscript-src, and the<meta>the build writes into each page names'self'and the hashes of that page's inline scripts, which voids the header's'unsafe-inline'; no directive of either half got looser) and kept bylib/theme.ts; the tokens, thedark:variant, the highlighter and the diagrams read the attribute and nothing asksprefers-color-schemebut that module (web/README.md"Theme",web/DESIGN.md"Theme"). The accessibility suite now also forces each theme on a device of the other scheme. The rest of this decision stands.
Context ​
ADR 0006 fixed the runtime (Next.js and assistant-ui's external store) but not how the UI is built. The first version was hand-written CSS with BEM class names, PascalCase component files and a flat src/{api,chat,components} layout. The owner asked for shadcn/ui, kebab-case file names and a cleaner structure.
Constraints that carry over: the design stays calm (flat surfaces, one accent, no gradients or decorative effects), light and dark follow the system setting, and the accessibility bars stay: axe reports no serious or critical issue and Lighthouse accessibility is at least 95, both in light and dark, on every change.
Decision ​
shadcn/ui on Tailwind CSS v4. The components are generated into
src/components/ui(radix base,radix-vegastyle, neutral base colour, CSS variables) and owned by this repo. The CLI is pinned (shadcn@4.21.0) andcomponents.jsonis committed. Generated files are formatted by Biome and may be edited; an edit is a deliberate local change, not a rule exception.Design tokens are the palette the app already shipped with, mapped onto shadcn's token names in
src/app/globals.css(plus--successand--warning). Dark mode is@media (prefers-color-scheme: dark), with thedark:variant redefined to the same media query: no toggle, nonext-themes, no.darkclass. The system font stack stays, so nothing is downloaded at build or run time.Native selects for the agent and release pickers (
NativeSelect, not RadixSelect): the best control on a phone, and<optgroup>groups the revisions. (Superseded 2026-10-01, see the status line: a dropdown menu in the top bar.)assistant-ui registry components as the starting point, then pruned.
thread,thread-listandmarkdown-textcome from the@assistant-uishadcn registry (components.json→registries). What the event log has no handlers for is removed: voice, attachments, suggestions, feedback, reload, copy, edit, branches, archive, delete, rename and search. Status lines, artifacts and errors aredata-*parts rendered bymakeAssistantDataUIrenderers (features/chat/components/data-uis.tsx) throughpart.dataRendererUI.Phones get a sheet, not a disclosure. Below 768px a "Threads" button opens the thread list in a left
Sheet(titled, focus returns to the button, closes when a thread is picked). Above it the list is a fixed column. Only one "Threads" navigation is in the accessibility tree at a time.Layout: feature-oriented, kebab-case everywhere.
src/app/ routes only (thin pages) src/components/ui/ shadcn primitives (generated) src/components/assistant-ui/ registry items, pruned (thread.aui, thread-list.aui, markdown-text) src/features/{chat,threads,agents}/{components,hooks,lib} src/lib/ api client, generated types (gitignored), cn()Tests are colocated with the code (
*.test.ts,*.dom.test.tsx); end-to-end tests stay ine2e/ande2e-system/and reach the DOM only through the locators ine2e/helpers.ts(roles and accessible names first).Biome enforces the file names (
style/useFilenamingConvention, kebab-case): a PascalCase file failspnpm checkand therefore CI.
Alternatives rejected ​
- Radix
Selectfor the pickers. Worse on phones, no<optgroup>, and everyselectOptiontest would need a rewrite. - A
.darkclass with a toggle (next-themes). A setting nobody asked for, and the accessibility suite emulates the system colour scheme. - Keeping the hand-written CSS. BEM rules cannot share the component library the OpenUI work builds on.
- Installing the registry
threadunpruned. It ships controls that would do nothing here.
Consequences ​
- New UI is composed from
src/components/uiprimitives and the tokens, never from new global CSS. - A change to a registry-derived file is a change to our copy; upstream updates are merged by hand, so the diff is small on purpose.
- Colour is never the only carrier of state: every badge and status has a text label.
Verified ​
- Verified 2026-09-29 against the
shadcn@4.21.0CLI (init -b radix -p vega,add), Tailwind 4.3.3 and thehttps://r.assistant-ui.com/styles/{style}/{name}.jsonregistry: the flow works as described. Notes:initrequires Tailwind and PostCSS to be installed first, and the CLI writesfrom "cn"imports (thecnpackage is a transitive dependency ofshadcn); they are rewritten to@/lib/utils. - Verified 2026-09-29: Biome 2.5.14 accepts
css.parser.tailwindDirectivesanduseFilenamingConventionwithfilenameCases: ["kebab-case"]; Next's[id]segment andthread.aui.tsxstyle names pass.