Styling the chat
How to make the chat look like your product: its colours, shape, type, motion and words, from a
brand colour in one line to a whole look of your own. The chat is the same everywhere -
<AgentChat> in React, <dd-agent-chat> on any page, a front end of your own on
@dudko.dev/agent-web-ui - and so is the way it is styled: theme tokens (--awr-* CSS custom
properties) first, then the scheme, a skin, motion, and the words.
- Where the tokens go
- Light, dark or the device’s
- The tokens
- Your brand, light and dark
- Type and size
- Skins: a look as a whole
- Motion
- Parts: classes, slots, components
- Words and language
- The pipeline editor
- Bringing your own stylesheet
Where the tokens go
Section titled “Where the tokens go”Load the stylesheet once (@dudko.dev/agent-web-react/styles.css - the React package’s copy of
@dudko.dev/agent-web-ui/styles.css; <dd-agent-chat> brings its own), then set tokens where the
chat can read them:
| The chat | Set the tokens on |
|---|---|
<AgentChat> (React) |
.awr-chat, or any ancestor of it; or style={{ '--awr-accent': '#0a7' }} |
<dd-agent-chat> (default: a shadow root) |
the element itself: dd-agent-chat { --awr-accent: #0a7 } - custom properties are inherited into the shadow root, nothing else of your page’s CSS is |
<dd-agent-chat light-dom> |
the chat’s root inside it: dd-agent-chat .awr-chat { --awr-accent: #0a7 } |
parts used outside <AgentChat> (<AgentComposer>, <FilesPanel>, the image viewer, …) |
an element with class awr-theme around them - it declares the same tokens |
a front end of your own on @dudko.dev/agent-web-ui |
its .awr-chat / .awr-theme element |
Load your CSS after the chat’s. The light defaults weigh nothing (:where(.awr-chat, .awr-theme)), but the dark ones and a skin’s weigh one attribute ([data-awr-theme='dark'],
:not([data-awr-theme='light']), [data-awr-skin='glass']): a rule of yours with one class
(.awr-chat { … }) ties with them and wins by coming later. Where you cannot order the sheets,
double the class (.awr-chat.awr-chat { … }) - never !important. On <dd-agent-chat> in its
shadow root there is no such question: a rule of your page on the element always beats the chat’s
own :host defaults.
Light, dark or the device’s
Section titled “Light, dark or the device’s”theme="auto" | "light" | "dark" (<AgentChat theme>, <dd-agent-chat theme>; the attribute
data-awr-theme on a root of your own). auto, the default, follows the device
(prefers-color-scheme). Each scheme has its own defaults for the colour tokens; a token you set
wins over both - see Your brand, light and dark for keeping a
colour per scheme.
The tokens
Section titled “The tokens”Colours (light / dark default):
| Token | Light | Dark | What it paints |
|---|---|---|---|
--awr-bg |
#ffffff |
#0f1115 |
The chat’s background |
--awr-fg |
#1a1a1a |
#e6e7ea |
Text |
--awr-muted |
#6b7280 |
#9aa1ab |
Secondary text: times, tokens, hints |
--awr-border |
#e5e7eb |
#262a33 |
Lines and edges |
--awr-subtle |
#f6f7f9 |
#171a21 |
Quiet surfaces: cards, the message box, code |
--awr-assistant-bg |
#f3f4f6 |
#1a1e27 |
The tint behind the agent’s answers |
--awr-accent |
#4f46e5 |
#6366f1 |
Buttons, links, the running step, and the person’s own messages |
--awr-accent-fg |
#ffffff |
#ffffff |
Text on --awr-accent (the person’s messages too) |
--awr-danger |
#dc2626 |
#f87171 |
Errors, Deny, the listening mic |
--awr-danger-fg |
#ffffff |
#1c0606 |
Text and icons on a solid --awr-danger |
--awr-warn |
#b45309 |
#fbbf24 |
Warnings, a limit reached |
--awr-ok |
#16a34a |
#4ade80 |
Done, allowed |
--awr-scrim |
rgb(15 17 21 / 0.32) |
rgb(0 0 0 / 0.5) |
The shade beside an open side panel on a narrow chat (transparent hides it; a tap still closes the panel) |
Shape, type and layout:
| Token | Default | |
|---|---|---|
--awr-radius |
12px |
Corners of the chat and its cards |
--awr-font |
the system’s UI font | The text |
--awr-mono |
the system’s monospace font | Code, paths, commands |
--awr-sidebar-width |
240px |
The saved chats panel |
--awr-files-width |
300px |
The files panel |
Motion has its own tokens (Motion), and so does the glass skin (Skins).
Keep text readable: --awr-fg over --awr-bg, --awr-subtle and --awr-assistant-bg, and
--awr-accent-fg over --awr-accent (the person’s own messages), at least 4.5:1 (WCAG AA).
There is no token for the focus ring: it is drawn in --awr-accent. The default look leaves
forced colours (Windows’ high contrast) to the browser - check a palette of yours there too. @dudko.dev/agent-web-ui exports
the maths it holds its own skins to (contrastRatio, worstCaseContrast) if you want to check
yours in a test.
Your brand, light and dark
Section titled “Your brand, light and dark”One colour, both schemes (after the chat’s sheet - see Where the tokens go):
.awr-chat { --awr-accent: #0a7f5a; }A palette per scheme. A plain .awr-chat { --awr-bg: … } set after the chat’s sheet wins over
BOTH schemes’ defaults, so give the dark values the same way the defaults do - by the device’s
scheme unless the chat is forced light, and when it is forced dark (these selectors weigh more
than the defaults’ anyway):
.awr-chat { --awr-bg: #fbfaf7; --awr-subtle: #f2efe8; --awr-assistant-bg: #f2efe8; --awr-border: #e3ddd0; --awr-accent: #0a7f5a; --awr-radius: 6px;}@media (prefers-color-scheme: dark) { .awr-chat:not([data-awr-theme='light']) { --awr-bg: #12140f; --awr-subtle: #1b1e17; --awr-assistant-bg: #1b1e17; --awr-border: #2b3025; --awr-accent: #3fcf9b; --awr-accent-fg: #06140e; }}.awr-chat[data-awr-theme='dark'] { /* the same dark values */}On <dd-agent-chat> in its shadow root, write the same rules for the element. Its scheme can come
from the theme attribute, data-awr-theme, or the theme PROPERTY - the last sets no
attribute but a custom state (:state(light) / :state(dark)), so name all three (custom states:
every current browser; an older one drops a rule that names them):
dd-agent-chat { --awr-bg: #fbfaf7; --awr-accent: #0a7f5a; /* … the light palette */ }@media (prefers-color-scheme: dark) { dd-agent-chat:not([theme='light'], [data-awr-theme='light'], :state(light)) { --awr-bg: #12140f; --awr-accent: #3fcf9b; /* … the dark palette */ }}dd-agent-chat:is([theme='dark'], [data-awr-theme='dark'], :state(dark)) { /* the same dark values */}With a skin (below) in play, scope your palette to the default look so the skin keeps its own:
.awr-chat:not([data-awr-skin]) { --awr-bg: … } (the default look carries no attribute), and its
dark variants the same way (.awr-chat:not([data-awr-skin]):not([data-awr-theme='light']) in the
media query, .awr-chat:not([data-awr-skin])[data-awr-theme='dark']).
Type and size
Section titled “Type and size”--awr-font and --awr-mono set the faces; load the font itself as you load any (for
<dd-agent-chat> in a shadow root, put the @font-face in the page’s stylesheet: an @font-face
inside a shadow root is not used by browsers). The chat is drawn at 14 px and most of its parts
are sized in pixels, so a larger font-size on it enlarges the text only, not the controls
around it; CSS zoom on its container scales everything - check the result in your browsers.
Its size is the container’s: <AgentChat> fills its parent (height: 100%); <dd-agent-chat> is
a block, 560 px tall until you size it (dd-agent-chat { height: 100%; }). Below narrowWidth
(the chat’s own width, not the window’s) the side panels slide over the transcript instead of
beside it.
Skins: a look as a whole
Section titled “Skins: a look as a whole”skin="default" | "glass" | "<your own>" (<AgentChat skin>, <dd-agent-chat skin>, the
attribute data-awr-skin), switched at run time without rebuilding anything.
glass: translucent surfaces that blur what is behind them, over a soft backdrop - set--awr-glass-backdropto your page’s picture, ortransparentto show the page. It stays readable (every text AA over every fill), opaque where the device asks for less transparency or more contrast. Tune it with the--awr-glass-*tokens.- your own: a block of token overrides (and, if you want, a few rules) under
[data-awr-skin='<name>'], light and dark. The ui package’s README, Skins, has the full example and the glass tokens.
Motion
Section titled “Motion”motion="auto" | "reduced" | "none". auto (the default) is soft and short - panels slide, menus
and cards ease in, disclosures unfold - and becomes a plain fade when the device asks for reduced
motion; reduced is that fade always; none turns it off. The tokens: --awr-motion-duration-fast
/ -base / -slow / -exit (150 / 220 / 320 / 160 ms; 0 turns motion off),
--awr-motion-ease-out / -ease-in-out / -ease-in, and how far things travel:
--awr-motion-rise (6px), --awr-motion-shift (16px), --awr-motion-sheet (100%),
--awr-motion-scale (0.97). docs/chat.md says what moves and how.
Parts: classes, slots, components
Section titled “Parts: classes, slots, components”The tokens are the surface meant for styling; reach for the parts when a token does not say it.
- Classes on the chat’s own boxes (React):
classNames={{ root, main, header, body, footer, sidebar, files, scrim }},className,style. - Your own content in it: React’s
slots={{ header, headerStart, headerEnd, beforeMessages, afterMessages, footerStart, sidebar }};<dd-agent-chat>’s namedslots (its README, Slots). What you put there keeps your page’s styles, in a shadow root too. - Whole parts of your own (React):
components={{ Composer, MessageList, HistoryList, FilesPanel, ApprovalPrompt, ElicitationPrompt, QuestionPrompt }}and the render props (renderMessage,renderToolCall,renderApproval,renderAttachment, …) - docs/chat.md. - The parts’ own selectors (
.awr-msg__bubble,.awr-composer2, …) reach the chat in React and in<dd-agent-chat light-dom>, not in its shadow root (on purpose: your page’s CSS cannot break it there). They are the stylesheet’s own names, more likely to change between versions than a token: prefer a token, and keep such rules few. - What it shows: the
show*props,composer={false},history,files.
Words and language
Section titled “Words and language”Every word is a label, translated into 33 languages (@dudko.dev/agent-web-ui/locales).
<dd-agent-chat lang="de"> picks a set; in React, load one with loadAgentLabels('de') and pass it
as labels (or to <AgentLabelsProvider>) - In your language.
labels overrides any word, with counted phrases as functions so plurals work:
<AgentChat labels={{ send: 'Ask', emptyState: 'What shall we build?' }} />The title, the message box’s placeholder and what shows before the first message are the first
words a person reads: title, placeholder, emptyState on <AgentChat>; chatTitle,
placeholder, emptyState (or the empty slot) on <dd-agent-chat>. docs/chat.md lists every label.
The pipeline editor
Section titled “The pipeline editor”PipelineEditor has a stylesheet of its own, pipeline.css, standing alone. It is a root of its
own, .awr-pipeline (not inside .awr-chat): set your palette on both
(.awr-chat, .awr-pipeline { … }, the dark variants likewise). It reads the same colour, shape and
type tokens (--awr-bg, --awr-fg, --awr-accent, --awr-radius, --awr-font, …) and a few of
its own: --awr-canvas-bg (the canvas), --awr-canvas-grid (the grid’s spacing, 20px - a size,
not a colour), --awr-inspector-width, --awr-focus (its focus ring) and --awr-ease (its
transitions). The same theme applies.
Bringing your own stylesheet
Section titled “Bringing your own stylesheet”Nothing obliges you to load the chat’s CSS: the components draw plain elements with awr- classes.
In React, leave styles.css out and style those classes; on <dd-agent-chat>,
defineAgentChat(tag, { styles: false }) leaves the styles to you (in a shadow root, adopt your
sheet into el.shadowRoot). It is a lot to redo - consent cards, menus, panels, the narrow layout,
motion - so start from the shipped sheet and change what you need.
In VS Code, the extension’s chat takes its colours from the editor’s theme (any light, dark or high-contrast one): pick a VS Code theme to change it.
Ask about the agents
What you write goes to the project's server and an AI model. Answers can be wrong.
Loading the chat…