Portable design system for AI-assisted UI work in this repository.
This document is the single source of truth for design rules and token intent. Theme values are defined in styles.css, including the fallback themes and active Zai Light / Zai Dark overrides; do not maintain a separate copy of their numeric color values in documentation.
This file is meant for coding agents. When generating or editing UI in this repo, follow this file before inventing new visual rules.
The dedicated text-ui-* scale is a mandatory repository-wide constraint for application interface typography:
text-ui-xl, text-ui-lg, text-ui-base, text-ui-caption, text-ui-sm, or text-ui-xs.text-base, text-sm, or text-xs for application UI.text-[13px] or inline font-size values.text-ui-*.text-mobile-input-safe compatibility token (16px). Do not use it as a general UI hierarchy token.html or document.documentElement.style.fontSize; update only --ui-font-size.Treat violations of this section as design-system defects, not stylistic preferences.
ZCode is a desktop-first and web-compatible AI workspace. The interface should feel calm, dense, and operational rather than decorative.
Design for:
Avoid:
Login, Coding Plan upgrade, and Rewards surfaces must keep minimize, maximize/restore,
and close-window controls reachable at the top right on Windows and Linux. Reuse
DesktopWindowControls and the existing platform CSS variants. Keep the controls
outside scrolling content and above page decoration, with a non-draggable hit area.
The embedded website's close-page action remains separate from close-window.
macOS keeps native traffic lights; ordinary Web and mobile Web hide desktop controls.
Verify all three surfaces in both themes, including narrow windows, maximize/restore,
minimize, and close-page versus close-window behavior.
User-facing theme choices are:
Default light and dark CSS variables still exist as fallback foundations, but new UI should be validated against Zai Light and Zai Dark as the active light/dark experiences.
--color-brand
Use for key emphasis, important links, active indicators, and brand-accented actions. Never use as a full-page background.--color-icon-blue
Use for browser-style links and blue icon emphasis that follows the Figma icon/blue role. Keep file-type icons on their own descriptor colors.--color-icon-purple
Use for Highspeed duration emphasis and other UI explicitly mapped to the Figma icon/purple role. Do not reuse idle-task or terminal colors directly.--color-highspeed-composer-border-idle with --color-highspeed-glow-*
Use only for an active Highspeed composer shell. Its stable surface and particle layer are defined by the dedicated Highspeed activation stylesheet and must not leak into ordinary inputs.--color-accent
Use for weak emphasis blocks, selected highlights, and low-intensity branded surfaces.--color-background
Default page and app workspace background.--color-background-alt
Alternate page region background when the layout needs a soft separation.--color-header, --color-panel, --color-sidebar
Structural layout surfaces only. Do not reuse as generic card colors.--color-surface
Low-elevation container surface.--color-surface-hover
Hover state for low-elevation surfaces.--color-card
Standard content card background.--color-card-selected
Selected or active card background.--color-popover
Dialog, popover, and floating panel background.--color-menu
Dropdown and menu surface.--color-menu-hover
Hover state for menu items.--color-input
Default editable field background.--color-input-focused
Focused editable field background.--color-foreground
Main reading text.--color-foreground-subtle
Metadata, descriptions, supporting labels.--color-foreground-subtlest
Placeholders, weak hints, disabled-adjacent copy.--color-foreground-inverse
Text on dark, branded, or state-colored fills.--color-border
Default border and separator.--color-border-hover
Hovered border state.--color-card-border--color-popover-border--color-input-border--color-input-border-hover--color-input-border-focused--color-success with --color-success-foreground--color-warning with --color-warning-foreground--color-destructive with --color-destructive-foreground--color-idle-task with --color-idle-task-surface
Use only for idle-time queue and paused tags so they remain visually distinct
from the green scheduled-task treatment.--color-diff-added with --color-diff-added-foreground--color-diff-removed with --color-diff-removed-foregroundUse semantic colors only for actual semantic states. Do not borrow success, warning, or destructive colors just to make a block feel louder.
--color-interaction-ask-surface, --color-interaction-ask-foreground, --color-interaction-ask-fill
Legacy compatibility surface/foreground tokens for AskUserQuestion; waiting badges no longer use a separate blue treatment. The ask fill is reserved for countdown progress.--color-interaction-confirmation-surface, --color-interaction-confirmation-foreground
Use for all waiting badges, including AskUserQuestion, permission, and ExitPlanMode.Waiting badges use one green confirmation treatment so identical waiting copy does not appear as different states. Do not substitute --color-success for a waiting confirmation.
The dynamic-workflow timeline (spec: docs/dynamic-workflow/presentation.md) draws with a
feature-scoped token family:
--color-workflow-rule
Sub-hairline for repeated furniture. Weaker than --color-border; do not use it as a
general separator.--color-workflow-trace, --color-workflow-trace-strong
Rail and arc stroke ramp: not yet taken vs control has passed. The marching segment
overlays --color-warning dashes; there is no third stroke colour.--color-workflow-trace (1px), and in
--color-warning (1.5px) only for the two seconds after the fill joins; never a tinted
surface (spec: docs/dynamic-workflow/presentation.md, "Holes on the timeline").--color-success,
--color-warning for running, --color-destructive); agent avatars use the fixed nine-color HEX palette defined in the workflow spec,
assigned by instance index (name hash fallback), and never encode status.--color-warning while it is the latest draft, --color-foreground-subtlest once a newer
draft exists. Never --color-destructive, which on this feature belongs to a run that errored
(spec: docs/dynamic-workflow/presentation.md, "Compiler feedback").--color-toast
The shared toast uses bg-toast/60 with background blur and a rounded-2xl shell.
Keep stack positioning in the shared toast component; do not add per-call offsets.--color-tooltip--color-tooltip-foreground--color-tooltip-tag--color-tooltip-tag-foreground--color-tag--color-find-highlight, --color-find-highlight-active
Use only for in-page/text search result highlights. The base token marks all matches; the active token marks the currently selected match.--color-hover--color-selected--color-primary--color-primary-foreground--color-secondary| Token | Purpose |
|---|---|
--color-markdown-inline-code |
Markdown 行内代码背景,沿用 tag / label 胶囊层级 |
--color-popover-header |
Popover header |
--color-tab |
Tab 默认背景 |
--color-tab-active |
当前激活 tab |
--color-tab-border |
Tab 分隔线 |
--color-feedback-privacy-hint |
反馈截图隐私提醒文字及叹号图标;独立一行,使用辅助说明字号 |
--color-git-none |
Git 无变更状态,沿用普通文件名颜色 |
--color-git-modified |
Git modified,表示已跟踪文件有未提交修改 |
--color-git-added |
Git added,表示新增文件已进入工作树 / 暂存区 |
--color-git-deleted |
Git deleted,表示已跟踪文件被删除 |
--color-git-renamed |
Git renamed,表示已跟踪文件移动或重命名 |
--color-git-untracked |
Git untracked,表示 Git 尚未跟踪的新文件 |
--color-git-ignored |
Git ignored,继承弱化文本层级 |
--color-git-descendant |
Git descendant,表示目录后代包含变更 |
--color-file-node |
文件 mention node 背景 |
--color-file-node-hover |
文件 mention node hover 背景 |
--color-file-node-foreground |
文件 mention node 文字 / 图标 |
--color-skill-node |
Skill mention node 背景 |
--color-skill-node-hover |
Skill mention node hover 背景 |
--color-skill-node-foreground |
Skill mention node 文字 / 图标 |
--color-command-node |
Command mention node 背景 |
--color-command-node-hover |
Command mention node hover 背景 |
--color-command-node-foreground |
Command mention node 文字 / 图标 |
Git file statuses must use text-git-* / bg-git-*, rather than borrowing diff or warning tokens.
Mention tokens belong to prompt-editor and UserPrompt mention nodes; their background, hover,
and foreground roles must stay together. Markdown inline code uses its own background token,
currently mapped to --color-tag.
bg-background + text-foreground for page roots.bg-card or bg-surface for normal content containers.bg-popover or bg-menu for overlays; pair with border-popover-border or border-border.bg-hover for generic hover and bg-selected for selection.bg-primary text-primary-foreground for the default primary button.bg-background, bg-card, and bg-surface without a clear layering reason.Never replace semantic tokens with ad hoc values like text-white/60, border-white/10, or arbitrary neutral alpha fills.
DesktopWindowFrame uses bg-background-alt on macOS desktop. Windows, Linux, and Web keep bg-background-win-alt; child surface colors remain independent.
Linux desktop uses a 16px outer window-shell radius around the 12px workspace panels and their 4px outer inset. Keep the shell radius and compositor clip path equal; maximized windows use 0px.
text-foreground-subtle / text-foreground-subtlest 调用;同时支持颜色类直接位于图标和从父元素继承。文字继续使用原有半透明颜色。opacity-* 继续独立叠加,opacity-0 仍隐藏图标。stroke="currentColor" 是适配入口。/50)以及 fill-current 的实心图标。不支持相对颜色语法的浏览器保留原始绘制方式。font-sans stack for almost all interface text.font-mono for paths, commands, code, identifiers, shortcuts, commit hashes, model IDs, and terminal-like data.Each text-ui-* utility maps to the corresponding --text-ui-* CSS token.
All interface typography must use the dedicated text-ui-* scale. The Appearance setting controls --ui-font-size, whose default is 14px:
| Token | Formula | Default |
|---|---|---|
text-ui-xl |
--ui-font-size + 4px |
18px |
text-ui-lg |
--ui-font-size + 2px |
16px |
text-ui-base |
--ui-font-size |
14px |
text-ui-caption |
--ui-font-size - 1px |
13px |
text-ui-sm |
--ui-font-size - 2px |
12px |
text-ui-xs |
--ui-font-size - 4px |
10px |
text-ui-2xs |
--ui-font-size - 5px |
9px |
text-ui-2xs is a restricted exception below the text-ui-xs floor: it is permitted
only for graph axis furniture — timebase tick labels, channel codes, and unit
suffixes in the workflow timeline — never for content, labels, or metadata.
Treat any other use as a design-system defect.
text-mobile-input-safe is a fixed 16px platform-compatibility token. It is
reserved for editable controls on mobile Web surfaces where iOS focus zoom must
be prevented, and therefore does not scale with --ui-font-size.
--ui-font-size; never mutate the root html font size.rem-based geometry must not scale with the interface font setting.text-ui-*.text-mobile-input-safe.The text-ui-* scale expresses stable semantic roles. Choose a token by content role rather than by isolated visual preference:
| Token | Primary roles |
|---|---|
text-ui-xl |
Markdown h1 and equivalent first-level reading headings |
text-ui-lg |
Markdown h2 and equivalent second-level reading headings |
text-ui-base |
Markdown h3-h6, body copy, common buttons, workspace and section titles, and other primary UI text |
text-ui-caption |
Compact supporting copy that must remain one step below body text, such as the New Task feature announcement |
text-ui-sm |
Secondary copy, supporting information, helper text, Tooltip copy, and Markdown inline code |
text-ui-xs |
Tooltip keyboard shortcuts, badges, compact labels, counters, and very weak metadata |
h3-h6 share text-ui-base; distinguish their hierarchy through weight: h3-h4 use font-semibold, h5 uses font-medium, and h6 uses font-normal.text-ui-base font-normal; titles and labels may strengthen weight without changing their semantic size role.text-foreground-subtle. Pair weak metadata with text-foreground-subtlest. Font size and color hierarchy are independent decisions.text-ui-sm; keyboard shortcut labels use text-ui-xs. Rich content such as Markdown release notes keeps its content typography hierarchy instead of flattening headings and links to the Tooltip copy size.font-mono, usually with text-ui-base; Markdown inline code uses text-ui-sm.13px UI size without a deliberate compact-caption role, use text-ui-base. Use text-ui-caption only where the product explicitly requires a stable one-step-below-body caption treatment. Do not collapse either into text-ui-xs; text-ui-xs is reserved for badge-scale and very weak metadata roles.Markdown rendered through the shared assistant response uses a reading-oriented hierarchy while the surrounding operational UI remains compact:
text-ui-basetext-ui-basetext-ui-basefont-mono text-ui-sm14px, configurable through code preview settingstext-ui-basetext-ui-basetext-ui-xltext-ui-lgtext-ui-basetext-ui-basetext-ui-basetext-ui-basefont-medium for headings and labels; avoid heavy weights unless there is a strong reason.text-ui-base as the default compact app text size. Keep text-ui-base for workspace titles and stronger title treatments.Base spacing unit is 4px.
Recommended rhythm:
4px: tight icon/text spacing8px: compact control padding and inline gaps12px: dense list items and menu rows16px: standard card and panel padding20px to 24px: larger sections or dialog interiorsSpacing rules:
min-w-0 where truncation or shrink is required.min-h-0 where scrolling must be allowed.w-full + max-w-* over hard-coded widths when possible.Radius follows the nesting of visible rounded containers, not component importance or layout depth. These rules are the target specification; existing component defaults may still need migration.
rounded-xl, whether inside or outside a layout region.rounded-lg → rounded-md → rounded-sm; rounded-sm is the minimum.rounded-2xl.The following explicit exceptions may retain rounded-2xl; do not extend them to other components based only on size or importance:
ChatPromptEditor input shell may use rounded-2xl. Its drag overlay matches the shell because it covers the same surface, rather than introducing a nested container.rounded-2xl across collapsed and expanded presentations.rounded-2xl.rounded-2xl as part of their icon shape. This is not a general exception for icon buttons or content cards.The main composer region, including its context-header layout wrapper, is layout and does not count as a radius level. Its existing decorative radius does not force the actual input shell down a level. This classification alone does not prescribe changing the layout wrapper's decorative radius.
These exceptions do not automatically grant 2xl to nested controls or content containers. Basic controls still use the table below. Dialog shells follow their separate rules.
Buttons, menu trigger buttons, ordinary Input, Textarea, and Select triggers default to rounded-lg. Adjust them according to the nearest rounded parent container:
| Nearest rounded parent | Control radius |
|---|---|
None, or rounded-xl and above |
rounded-lg |
rounded-lg |
rounded-md |
rounded-md / rounded-sm |
rounded-sm |
Control size and primary/secondary action emphasis do not independently change radius.
rounded-2xl.rounded-xl shells.rounded-xl, followed by rounded-lg → rounded-md → rounded-sm.rounded-lg shells. This includes the main input's @ / / suggestion panel; it does not inherit the main-input exception.rounded-md.rounded-sm.rounded-lg, and its options use rounded-md.rounded-xl.rounded-full is reserved exclusively for deliberate pill shapes or circles.rounded-full merely because of their component type.rounded utility.rounded-none or side-specific radius removal only where joined surfaces must form a continuous shape.size-3, size-3.5, size-4, size-5, size-6h-6, h-7, h-8, h-9size-6, size-7, size-8, size-9size-4 is the default UI icon baseline.w-[...] and h-[...] for ordinary business UI.size variants, including icon*, over separate width/height overrides. The current variants are default(h-7), xs(h-5), sm(h-6), and lg(h-8); generic control baselines do not replace those component contracts.h-9; compact filters and inline inputs may use h-7 or h-8.w-full, w-fit, max-w-full, and min-w-0 for content widths. Fixed overlays may use w-52, w-64, w-80, or max-w-sm/md/lg/xl when a stable width is required.h-full or min-h-screen. Nested scroll and preview containers need min-h-0 and min-w-0 as appropriate; overflow-auto alone does not establish a shrinkable flex region.max-h-* to a fixed height for scrollable content. Do not combine size-* with conflicting w-* / h-* unless a non-square shape is deliberate.Preferred button system matches packages/ui/src/components/ui/button.tsx.
bg-primary text-primary-foregroundbg-secondary text-foregroundPreferred sizes:
xs: very compact controlsdefault: most action buttonssm: compact buttons in dense listslg: higher-emphasis buttonsicon-*: icon-only actionsButton rules:
bg-input border-input-border text-foregroundborder-input-border-hoverborder-input-border-focused and bg-input-focusedrounded-lg, stepping down according to the nearest rounded parent in the Radius rules.rounded-xl; the main chat input shell is an approved rounded-2xl exception.Input rules:
bg-card border-card-border; radius follows the container hierarchy, starting at rounded-xl.bg-surfacebg-card-selected16px horizontal padding and compact textCard rules:
bg-menu, compact rows, rounded-lg, and shadow-mdborder border-popover-border and typically p-12px vertical gap (gap-0.5) at the shared option-stack layerbg-popover and border-popover-border. Ordinary standalone popovers start at rounded-xl; dialogs use rounded-2xl except the three preview exceptions in the Radius rules.bg-toast, compact padding, and stronger shadowOverlay rules:
bg-card / bg-surface for ordinary menu content.rounded-md, px-2, gap-2, and text-ui-base.bg-menu-hover; avoid strong fills or per-row borders for normal menu items.bg-selected for selected list rows or tabs when appropriaterounded-xl. Main chat input shells may retain rounded-2xl under the approved exception.ZCode should use restrained depth. Layer primarily through background contrast, borders, and radius before relying on heavy shadows.
Recommended elevation levels:
shadow-md for menus, popovers, dialogsshadow-lg only for toast, important floating cards, or rare emphasized panelsDepth rules:
Desktop and wide Web workspace content uses independent conversation, bottom terminal, and Side Pane frames. The conversation frame contains WorkspaceHeader and conversation; the optional terminal has its own frame below it, and Side Pane owns its tab bar. Frames use their own background and border, with 4px resizable gaps matching the macOS outer inset. Resize handles keep a transparent 4px hit area and show a 2px tertiary foreground (foreground-subtlest/50) line on hover, focus or drag. The indicator extends along the panel edge, inset by the panel radius at both ends, with rounded ends and no mask. Layout frames do not count toward content radius levels. Mobile remote control retains its single-column and drawer presentation. See workspace independent panels for platform chrome and persistence boundaries.
The product is desktop-first, but UI must remain functional on smaller screens.
Rules:
max-width, grid, flex, and visibility over changing component identity.| Breakpoint | Preferred use |
|---|---|
sm: |
Dialog width, button arrangement, small-screen layout corrections |
md: |
Grid columns and form layout expansion |
lg: |
Desktop toolbar visibility and secondary information density |
xl: |
Chat and complex content arrangements |
2xl: |
Wide-screen reading-width caps, not ordinary page behavior |
Start with the unprefixed layout, then add the fewest breakpoints needed. Prefer changing
layout, max-width, and visibility to repeatedly switching fixed dimensions or semantic
colors, borders, and radii. Keep essential actions available below desktop breakpoints.
Dialogs should reuse patterns such as sm:max-w-*; grids grow from one column rather
than starting desktop-wide and being repeatedly reduced. Fix unstable base layout before
adding breakpoint overrides.
packages/ui/src/components/ui/ before inventing one-off variants.