Theming
Set colors, radius, font and color scheme for the surface, and use the theme set in the console.
You can theme the surface in three places, from least to most specific: the theme your agent's owner publishes in the console, the theme prop on BaseeraProvider, and the theme prop on BaseeraSurface.
Light, dark or system
<BaseeraProvider publishableKey={key} baseUrl={url} theme="system">
<BaseeraSurface />
</BaseeraProvider>| Value | Result |
|---|---|
"light" | The light palette. This is the default. |
"dark" | The dark palette. |
"system" | Follows the visitor's prefers-color-scheme. |
"light" does not undo a .dark class that your own page sets. The surface pins its palette to its own theme through data-baseera-scheme, so a host's .dark class on the page does not repaint it.
Colors, radius and font
Pass an object instead of a string. Every field is optional.
<BaseeraSurface
theme={{
mode: "system",
accent: "#3a86a4",
primary: "#bf3b18",
primaryFg: "#ffffff",
radius: "12px",
font: "Tajawal, system-ui, sans-serif",
}}
/>Prop
Type
You can also pass any --baseera-* variable by name as a key, for example "--baseera-shadow": "none".
State colors
The six state colors take one plain color each: hex, rgb(), hsl() or oklch(). Anything else is ignored. From that one color the SDK derives the soft background, the pill and the text on them, so they stay readable at a 4.5 to 1 contrast ratio in light and dark. A raw variable such as --baseera-crit-bg still overrides a derived tone.
What is refused
Values go into CSS variables as plain text. A value over 200 characters, or one that contains ;, braces, angle brackets, url( or @import, is dropped, so a theme cannot inject CSS rules.
Logo
<BaseeraSurface logo="/brand/assistant.png" />logo replaces the assistant's bubble. It accepts a blob: or data: PNG or WebP, or a path on your own origin. Anything else is ignored. It wins over the logo uploaded in the console.
The theme from the console
Your agent's owner can publish a theme and a logo on the console's Theme page. BaseeraProvider fetches them with the publishable key, and BaseeraSurface applies them under your own theme: what you set wins, field by field. A host that sets only accent still gets the owner's other colors. The console theme has light and dark colors, a radius from 0 to 32 pixels, and a font chosen from system, serif, rounded and mono (all with Arabic coverage).
The uploaded logo is shown from a blob: URL. If your site sets a Content Security Policy, allow img-src blob: for it.
To read the published theme in your own components:
import { useBaseeraAgentTheme } from "@baseera/react";
const { theme, logoUrl } = useBaseeraAgentTheme();Both are null until loaded, and when the agent has no published theme.
Override with CSS
Every color is a CSS variable, so you can also theme with a stylesheet. See Styling for the full list.
:root {
--baseera-primary: #0b5fff;
--baseera-radius: 10px;
}