Design tokens
A component names a tier and never writes a value. Tiers live in apps/web/app/styles/design/; npm run check fails on anything written by hand. A value that fits no tier is a design change: add the tier or the table row first.
Files
| File | Holds |
|---|---|
globals.css | Entry: tailwindcss, then design, themes, styles |
design/layout.css | Rail widths, chat column, drag surface |
design/controls.css | Control height tiers, list row, button corner |
design/composer.css | The input box's own geometry |
design/type.css | Type tiers, font stacks |
design/shape.css | Spacing unit, radius tiers |
design/color.css | Accent family, the four text inks, fixed interface colours |
design/icons.css | Icon size tiers |
design/motion.css | Durations, the easing |
design/layers.css | Stacking layers (z-index) |
design/shadcn.css | shadcn's colour names to the app's roles |
design/tailwind.css | Tailwind's scan paths, variants, utility names |
themes/ | Colour values, one file per theme and a fallback |
base/ | Document, focus, list row, shell layout, scrollbar, sidebar, desktop chrome, motion |
chat/, right-dock/, dag/ | Global styles of those areas |
Paths under apps/web/app/styles/ except globals.css. Component styles sit beside their component in *.module.css, read tokens and add no values.
Control heights
| Tier | Height | Token | Button size | Font |
|---|---|---|---|---|
| inline | 20px | --ui-control-inline | None | None |
| row | 24px | --ui-button-h-xs | xs, icon-xs | 12px |
| menu | 28px | --ui-button-h-sm | sm, icon-sm | 13px |
| standard | 30px | --ui-button-h | default, icon | 14px |
| composer | 32px | --ui-button-h-lg | lg, icon-lg | 14px |
| choice | 26px | --ui-choice-h | An option inside a 32px choice groove | 13px |
--ui-button-h is --ui-list-h: an ordinary button is as tall as a sidebar chat row.
- A Button picks its tier through
size, never a height class. A control from class strings takesh-(--ui-button-h…)orsize-(--ui-button-h…); the Nova test scans every.tsand.tsxfile. - A hand-written stylesheet button sets
height, andwidthwhen square, to a tier token; the test scans every stylesheet.
Which component sits in which tier
| tier | components |
|---|---|
| inline 20 | controls drawn inside another control: the center tab's ×, the image annotator's colour swatches, the remove badge on a Launchpad tile, a new-tab shortcut tile and an image chip, the tool switch on a function card, the secret-reveal toggle in a user bubble |
| row 24, chat | actions that sit on a row, card or message: the sidebar chat row's ⋯, message hover actions (copy, retry …), queued-message actions, attachment remove and preview close, the composer popover's close, the fast toggle in the effort pill, the Mermaid source toggle, the annotate button on an image tile |
| row 24, browser and files | the find bar's arrows, the address bar's star, the diff hunk and line-comment buttons, session-resource row actions, branch row actions, bookmark actions, the split picker's close, the DAG zoom readout, the file search's match-mode segment |
| row 24, catalogs and settings | the project editor's remove, the Agent catalog's required toggle, settings and avatar colour swatches, the sidebar's project actions (pin, new chat, options) and refresh, the recents filter, the Agents view menu, the skill catalog's install button, ManageIconButton row actions and RailAction, provider account and model rows, an application row's ⋯, an Agent card's menu |
| menu 28, chat and tabs | rows in a menu or popover (itemCls), and compact controls in toolbars and chip rows: the composer's environment chips (Local, channel, folder) and corner menu buttons, the mic and send buttons, top-bar chips and menu triggers, center tabs and the tab strip's + / overview / menu buttons, the transcript's view controls, function-card "Use", function-form chips |
| menu 28, tool surfaces | the built-in browser toolbar, download and find pills, terminal actions, the PiP title bar buttons, Review's menu and pagination, the DAG tool rail, Programs' view switch, Memory's view switch, file-panel and settings icon buttons |
| menu 28, inputs | inputs that sit in a menu or toolbar: the command palette's search, the git menu's input, a bookmark's title, Launchpad's search, the file search options, the DAG selection actions |
| standard 30 | every other Button, input, select, toggle group and search field — page headers, cards, dialogs (the confirm dialog's Cancel / confirm), settings rows, Agents, Applications, Projects, the folder picker; sidebar rows and sidebar icon buttons (ui-list-item); the PDF toolbar; the message editor's buttons |
| composer 32 | the composer's corner buttons (--composer-button-size), the effort pill, the function form's inputs, and the canvas control tiles |
Not tiered (listed as exemptions in apps/web/tests/ui/ui-kit-is-nova.test.mjs): the account footer row (64px), Agents settings width handle (20 x 44px), center tab's active state (28px and its 6px foot), the tab strip drawing in the effects preview, the browser action cue, label tags, the Switch (Nova's 32 x 18.4px track), switch knobs, icon glyph sizes.
Type
| Tier | Size | Line | Token | Tailwind |
|---|---|---|---|---|
| 2xs | 11px | 16px | --fs-2xs | text-fs-2xs |
| xs | 12px | 16px | --fs-xs | text-fs-xs |
| sm | 13px | 18px | --fs-sm | text-fs-sm |
| base | 14px | 20px | --fs-base | text-fs-base |
| chat | 15px | 24px | --fs-chat | text-fs-chat |
| md | 16px | 24px | --fs-md | text-fs-md |
| title | 18px | 28px | --fs-title | text-fs-title |
| lg | 20px | 28px | --fs-lg | text-fs-lg |
| display | 30px | 36px | --fs-display | text-fs-display |
- CSS writes
font-size: var(--fs-*), class stringstext-fs-*, inline stylesfontSize: "var(--fs-*)". Never a px or rem literal, an arbitrarytext-[…], or stocktext-xstotext-2xl.@themestill maps stock names to the shadcn docs' meaning so pasted registry code renders right. - Weights: 400 body, 500 labels, controls and row titles, 600 titles and emphasis, 700 transcript headings only.
Which text sits on which tier
| tier | text |
|---|---|
| 2xs 11 | counters and dots in a badge, tab counts, kbd hints in the PiP, uppercase group labels on detail pages, DAG node and panel meta, context-commit timeline meta, folder sizes, the attachment strip's size line, the composer chips' small hints, model-list tags |
| xs 12 | secondary meta beside or under a row: timestamps, paths, counts, the account footer's subtitle; menu section labels, menu notes and key hints (GROUP_LABEL, MENU_NOTE, SHORTCUT); field descriptions; xs (24px) Buttons |
| sm 13 | descriptions and helper text, center tabs, page tab pills (manage-page tabs, project tabs), Agent card text and pills, sm (28px) Buttons and toggles, settings labels in dialogs |
| base 14 | body text; sidebar and list rows; menu and Select rows (itemCls); default (30px) and lg (32px) Buttons, inputs, textareas, selects, toggles; dialog descriptions; card titles in grids |
| chat 15 | transcript copy, the composer's input, embedded conversation cards, the running panel title, the Markdown file preview |
| md 16 | section headings inside a page (Settings card titles, "All chats"), dialog titles, Markdown h3/h4 |
| title 18 | the page title in the header (manage-page), the title of a detail pane: Settings detail, Programs entry, Agent editor, Project, Memory editor; Markdown h2 |
| lg 20 | the sidebar wordmark, big figures (usage totals), glyph tiles (project icons), the effects preview, Markdown h1 |
| display 30 | the Launchpad folder title |
Spacing and radius
Tailwind's spacing unit is 4px on every surface (p-2 = 8px), because the default 0.25rem lands on half pixels on the 14px root. Hand-written CSS uses whole px multiples where it can.
| Tier | Size | Used by |
|---|---|---|
| 2xs | 2px | Hairline bars, progress tracks, carets, a tip's arrow |
| xs | 4px | Tags, kbd, checkboxes, inline code, badges |
| sm | 6px | Chips and small controls inside a row |
| md | 8px | Every Button size, inputs, selects, hand-written buttons |
| lg | 10px | List rows, menus, popovers, Select popups, cards |
| xl | 12px | The centre card, split panes, page panels, dialogs |
| 2xl | 16px | User bubbles, large floating surfaces |
| groove | 11px | A choice groove: md plus the 3px around its face |
| full | 9999px | Pills, avatars, dots |
Same names in CSS (var(--radius-lg)) and Tailwind (rounded-lg). --ui-button-radius is md, --ui-list-radius lg. A share of the box (50%, a squircle's 26%) and a concentric calc() over a tier are allowed. A radius from a surface with no tier says so with a shape: comment.
Text inks
| ink | text |
|---|---|
--text-bright | titles, the hovered or selected row, values |
--text-primary | body text, list rows, controls |
--text-secondary | descriptions, helper text, inactive tabs, counts |
--text-muted | meta (timestamps, paths, placeholders), disabled text |
Tailwind: text-text-bright, -primary, -secondary, -muted. Parts in components/ui keep text-foreground and text-muted-foreground, which resolve to the same inks; other code does not use those. Accents (--accent-*, --theme-accent) mark state, never hierarchy.
Interface colours
Theme colours live in themes/. A colour the same in every theme is a named token in color.css on :root; components name the token. light-dark(a, b) follows the using element's color-scheme.
Token groups
| group | tokens | used by |
|---|---|---|
| session status | --status-working --status-needs-input --status-failed --status-unread --status-refresh-done | the sidebar's session markers, the refresh flash |
| permission tiers | --permission-deny --permission-ask --permission-allow | the project permissions dots |
| error text | --error-form --error-message-edit --error-document | plugin dialogs, the message editor, the document window |
| catalog pills | --pill-warn --pill-danger | the skills catalog's hover tints |
| commit timeline | --commit-state-* (-bg and ink per state), --commit-error, --commit-anchor, --commit-refresh-done | the context commit timeline |
| ANSI | --ansi-red --ansi-green --ansi-yellow --ansi-blue --ansi-magenta --ansi-cyan | a program's progress log |
| ink on fill | --ink-on-fill, --avatar-fallback-bg | text on a coloured fill (snap label, Save, count badge, active colour well, letter avatar) |
| agent cursor | --agent-cursor-keyline --agent-cursor-shadow --agent-light-pulse | the agent cursor and the controlled-app lights |
| browser | --browser-control-surface --browser-control-ink, --browser-pane-active --browser-pane-yielding, --browser-glyph-* | the browser-control chip, the browser tab's pane outlines and home glyph |
| canvas controls | --pane-light-<em>, --pane-divider-</em> | a pane's window lights and the split divider |
| scrim | --scrim-attachment-preview | an enlarged message attachment |
| PDF preview | --pdf-viewport-bg --pdf-thumb-shadow --pdf-thumb-current | the PDF page well and thumbnails |
| GUI tool | --gui-tool-rule | the hairlines of a GUI tool's activity card |
| sidebar | --nav-toggle-press --nav-item-press --new-chat-chip --new-chat-chip-hover --wordmark-from --wordmark-to | pressed nav rows, the New chat chip, the wordmark |
| provider card | --provider-card-highlight | a provider's model card |
| theme scenes | --theme-scene-rain-<em> --theme-scene-gradient-</em> | the Code rain and Gradient previews in Settings, the Gradient scene and its glass chrome behind Launchpad |
| Launchpad | --launchpad-* | the shadows under app icons and an open folder, the edit-mode remove badge, the label shadow on the Gradient scene |
| running glow | --running-glow-blue --running-glow-violet --running-glow-green | the flowing glow on a running conversation's sidebar row |
| branch lanes | --lane-0 … --lane-17 | the conversation graph's lines, nodes and tags, the Activity panel's branch rows, the browser's new-tab tile initials (lib/format-utils/lane-colors.ts hands out var(--lane-N)) |
| code highlighting | --hl-keyword --hl-string --hl-number --hl-comment --hl-title --hl-type --hl-attr | highlight.js tokens in a message's code block |
Step tones in styles/tool-tones.css (--tool-tone-*, --timeline-*) are the same kind of token.
- Every shadcn role is a full colour: read
var(--ring). Wrapping inhsl()resolves invalid. Translucent:color-mix(in srgb, var(--muted) 34%, transparent). var(--role, literal)names an always-defined role (theme roles,--accent,--destructive,--muted-foreground) with no dead literal. A role no theme defines (--danger,--warning,--success,--red,--orange,--status-error,--border-color) is replaced by the token holding its literal.
Icons
| size | where |
|---|---|
| 12 | inside xs (24px) controls, beside 11–12px text |
| 14 | inside sm (28px) controls, menu rows, chips |
| 16 | default controls, toolbars, page buttons |
| 20 | sidebar navigation, empty states, tiles, page-header glyphs |
| 24 | hero glyphs on empty pages |
A size of 28 and up is an illustration (avatar, logo).
Motion
| tier | value | where |
|---|---|---|
--motion-fast | 120ms | hover, press, colour and border changes |
--motion-medium | 160ms | reveals, fades, small movements |
--motion-slow | 240ms | panels, drawers, larger movements |
transition: opacity var(--motion-medium) var(--ease-standard). --ease-standard is the one easing. The face in a choice groove has its own slide (see Surface system). Looping animations and spring curves keep their timing. A script waiting on a transition times out no sooner than its tier.
Shadows
| Token | For |
|---|---|
--shadow-sm | Cards, small raised parts |
--shadow | Raised panels |
--shadow-popover | Menus, floating bars, drag previews |
--shadow-dialog | Dialogs, full-window overlays |
--shadow-raised, --shadow-raised-hover | The input box, elevated buttons. The hover shadow is three layers: a faint even ambient that shows the top edge, a tight contact shadow and a soft drop. Dark themes add a 6% white highlight inside the top edge. No outline. |
--shadow-groove | A faint inset shadow on --groove (bg-groove): the groove of a choice control, a step below the surface in light themes and the deep page in dark ones |
Never an rgba in a component. Inset lines and focus rings are borders, not elevation.
Layers
| layer | value | what |
|---|---|---|
--z-sticky | 20 | sticky headers inside a pane |
--z-floating | 50 | panels floating inside a pane |
--z-drawer | 100 | sidebars laid over the content at narrow widths |
--z-overlay | 110 | the dim layer behind a dialog |
--z-dialog | 120 | Dialog, AlertDialog |
--z-popover | 130 | Popover, DropdownMenu, ContextMenu, Select, above dialogs |
--z-tooltip | 140 | Tooltip |
--z-toast | 300 | toasts |
--z-fullscreen | 10000 | full-window editors and lightboxes |
--z-drag | 100000 | drag previews and the drag surface |
Values 1 to 12 inside one component stay local. Tailwind: z-(--z-popover). CSS: z-index: var(--z-popover), or calc(var(--z-drag) + 1) for a part just above its layer.
Which layer writes what
| Layer | Writes | Never |
|---|---|---|
shadcn parts in components/ui | every control: button, input, select, menu, dialog, switch, checkbox | — |
| Tailwind classes in the JSX | layout and spacing (flex, grid, gap, padding, size), simple states | complex selectors |
*.module.css next to the component | what Tailwind cannot say: pseudo-elements (the project guide line), data-* and parent selectors, keyframes, layered cascades | a hand-made control, a literal value |
Layout rules still in modules
About 280 one-class, layout-only rules remain. A Tailwind utility sits in @layer utilities and a module rule is unlayered, so a moved rule loses to every unlayered rule on the element.
A rule stays when its class appears earlier in the stylesheet, the element merges its own classes (a DialogContent keeps sm:max-w-*), another module class sets one of the same properties, or the styles object is re-exported or passed whole. They move when their component is edited; the guard makes sure the number only goes down.
The guard
apps/web/scripts/ui/check-design-tokens.mjs, run by npm run check, scans every stylesheet and .ts or .tsx file. apps/web/tests/ui/ui-kit-is-nova.test.mjs refuses a literal control height.
| Kind | Refused |
|---|---|
| Font | Size off the --fs-* tiers, arbitrary text-[…], stock text-xs to text-2xl, a font named by hand, the font shorthand, forced tabular-nums (Settings owns typeface and digits) |
| Weight | Anything but 400, 500, 600, 700 |
| Radius | px, arbitrary rounded-[…], bare rounded, rounded-3xl and up, --radius, a --radius-* that is not a tier |
| Ink | --text-tertiary, --text-dim, text-[var(--text-*)], shadcn ink names outside components/ui |
| Icon | A size below 28 that is not a tier |
| Colour | #hex, rgb(), hsl() outside app/styles/themes/, app/styles/design/ and custom-property lines in app/styles/ |
| Module layout | More layout-only rules than apps/web/scripts/ui/module-layout-baseline.json allows; a new module may have none. node apps/web/scripts/ui/check-design-tokens.mjs --write-layout-baseline lowers the numbers |
Named exceptions
- APIs that take pixels: xterm, Mermaid, canvas, Electron views.
- Framer Motion's numeric radius on the Agent cards.
- The input box: its radii, weights and icons stay as drawn.
- A line that says
glyph:,shape:ormask:. COLOUR_DATA: user-picked palettes and chart series, artwork (Launchpad and memory icons, code rain, search-provider glyphs), APIs taking a colour string (canvas, WebGL, xterm, Mermaid, pdf.js, the web manifest), the effort heat scale computed ashsl().