REFERENCE
SDK Demos
How to use @asgard-js/core and @asgard-js/react, with demos you can try on the page.
Theme
Customize the chatbot appearance through the theme prop. Every color,
spacing, and radius value in the default theme can be overridden.
Try the Crazy preset to see every theming slot in action at once.
Code Example
import { Chatbot } from "@asgard-js/react";
import type { AsgardThemeContextValue } from "@asgard-js/react";
const myTheme: Partial<AsgardThemeContextValue> = {
chatbot: {
backgroundColor: "#3c1d3b",
borderColor: "#92ff8c",
primaryComponent: {
mainColor: "#ff0000",
secondaryColor: "#aba400",
},
},
botMessage: {
color: "#00f0ff",
backgroundColor: "#ff7a00",
},
userMessage: {
color: "#522801",
backgroundColor: "#060081",
},
};
<Chatbot theme={myTheme} {...rest} />;Theme Structure
Level Fields Description chatbotbackgroundColor,borderColor,borderRadiusOuter frame styles chatbotcontentMaxWidth,width,heightSize controls chatbotmainColor,secondaryColor,inactiveColorGlobal colors chatbot.primaryComponentmainColor,secondaryColor,onMainColorPrimary interactive element colors chatbot.headerstyle,title.style,actionButton.styleHeader styles chatbot.bodystyleMessage area styles chatbot.footerstyle,textArea.style,submitButton.style,speechInputButton.styleInput area styles botMessagecolor,backgroundColor,linkColor,quickReplyBackgroundColorBot message bubble userMessagecolor,backgroundColorUser message bubble templatequickReplies.style,references.style,time.styleTemplate element styles Colors propagate across the whole chat surfaceThese
chatbotcolors are wired to the SDK's--asg-color-*design tokens, so setting them recolors the newer surfaces too (the running indicator, composer input, channel-title bar, tool-call groups, thinking block, and Task / Subagent panels):Theme field Token chatbot.primaryComponent.mainColor--asg-color-primary(+ a derived darker hover)chatbot.backgroundColor--asg-color-bg/--asg-color-surface(surface one step lighter)chatbot.borderColor--asg-color-border/--asg-color-dividerchatbot.inactiveColor--asg-color-text-secondary/--asg-color-action-inactive(the muted text and icon tier: timestamps, placeholder, header icons)chatbot.primaryComponent.secondaryColor--asg-color-text-primary(the primary text tier)A token is injected whenever the value is a non-empty string; leave it out to keep the built-in default.
Wire It to Your Own Design Tokens
Theme fields are not limited to hex.
var(),oklch(),rgb()andcolor-mix()pass through as-is, so the chat can be wired straight into your existing design system:const myTheme = {
chatbot: {
backgroundColor: "var(--my-surface)",
borderColor: "var(--my-border)",
primaryComponent: {
mainColor: "var(--my-brand)",
},
},
};The only difference is how derived shades are computed: a 6-digit hex (
#rrggbb) is darkened/lightened arithmetically, anything else derives its shades via CSScolor-mix(). Existing hex usage is unaffected.onMainColor: Foreground on the AccentprimaryComponent.onMainColoris the color for content sitting on top ofmainColor— card and carousel button labels, the attachment icon glyph, and the composer's submit icon.It defaults to
secondaryColor, which is also the primary text tier (header title, input text). Those two only agree whilemainColoris dark: if your brand accent is light (a gold, say), the accent needs dark text on it while everything else needs light text — and one field cannot be both.Set
onMainColorwhenmainColoris light.const goldTheme = {
chatbot: {
primaryComponent: {
mainColor: "#e8c547", // light accent
secondaryColor: "#f5f5f5", // regular text: light
onMainColor: "#1a1a1a", // text on the gold: dark
},
},
};The JSON and Error-detail CSS Variables
Two places are code coloring and deliberately do not follow the brand color, so they get their own override points: the JSON inside an expanded tool call, and the error bubble's details region. The defaults are a familiar dark-theme syntax palette; override them on any ancestor:
.my-chatbot-wrapper {
--asgard-json-token-key: #7dd3fc;
--asgard-json-token-string: #fca5a5;
--asgard-error-details-bg: rgba(0, 0, 0, 0.4);
}CSS variable Purpose Default --asgard-json-token-keyJSON keys #9cdcfe--asgard-json-token-stringString values #ce9178--asgard-json-token-numberNumbers #b5cea8--asgard-json-token-booleantrue/false/null#569cd6--asgard-json-token-punctuationBraces, commas, colons #d4d4d4--asgard-error-toggle"Show more" toggle text rgb(200, 200, 200)--asgard-error-toggle-hoverToggle text on hover white--asgard-error-details-bgExpanded region background rgba(0, 0, 0, 0.25)--asgard-error-details-labelThe "Details" label rgb(150, 150, 150)--asgard-error-details-textThe JSON text rgb(220, 220, 220)Theming Outside the Chatbot
Consumer-placed panels (
<TaskList>,<FileExplorerPanel>and friends) are not inside<Chatbot>'s DOM subtree and miss all of the tokens above. UseAsgardThemeScopeto re-establish the same theme there.