AI Agent Component Spec
AI Agent Component Spec
| Field | Value |
|---|---|
| Goal | Override UI Kit color tokens to match a brand |
| Where | App.css (global) — import in app entry via import "./App.css"; |
| Scope | Override variables on .cometchat (global) or .cometchat-<component> (component-specific) |
| Key tokens | --cometchat-primary-color (brand/accent), --cometchat-neutral-color-300 (incoming bubbles, default #E8E8E8), --cometchat-background-color-01 (main background) |
| Dark mode | Source uses [data-theme="dark"] on :root. App-controlled: .cometchat-root[data-theme="dark"] .cometchat |
| Source file | css-variables.css on GitHub |
| Constraints | Global CSS only (no CSS Modules), no !important, component-level overrides take precedence over global |
Agent Guardrails
- Use the snippets exactly as shown; only change token values.
- Keep
.cometchatand.cometchat-conversationsintact — these are the tested selectors. - Keep overrides in global CSS (
App.css), not CSS Modules. - Dark mode examples assume
data-themeis set on the wrapper element. Ifdata-themeis set elsewhere, update the selector to match.
Selector Contract
Canonical selector patterns for overriding colors. Global override[data-theme="dark"] at the :root level. When controlling dark mode from the app, place data-theme on the wrapper and scope overrides accordingly.
CSS Variable Reference
This table maps every commonly used token to what it visually controls.| Variable | What It Controls | Default (Light) | Used By |
|---|---|---|---|
--cometchat-primary-color | Brand accent, outgoing bubble bg, active states, links, buttons | #6852D6 | Outgoing bubbles, send button, active tabs, links |
--cometchat-neutral-color-300 | Incoming bubble background, borders | #E8E8E8 | Incoming message bubbles, border-color-default |
--cometchat-neutral-color-400 | Secondary backgrounds, dividers | #DCDCDC | Borders, secondary panels |
--cometchat-neutral-color-500 | Muted text, placeholders | #A1A1A1 | Placeholder text, disabled states |
--cometchat-neutral-color-600 | Secondary text | #727272 | Timestamps, subtitles |
--cometchat-neutral-color-700 | Primary text | #5B5B5B | Main body text |
--cometchat-neutral-color-800 | Headings, strong text | #434343 | Component titles, names |
--cometchat-neutral-color-900 | Strongest text | #141414 | Text color primary |
--cometchat-neutral-color-50 | White surface | #FFFFFF | Background color 01, text-color-white |
--cometchat-background-color-01 | Main app background | var(--cometchat-neutral-color-50) | Root container background |
--cometchat-background-color-02 | Secondary/panel background | var(--cometchat-neutral-color-100) | Sidebars, panels |
--cometchat-background-color-03 | Tertiary background | var(--cometchat-neutral-color-200) | Nested panels, cards |
--cometchat-background-color-04 | Quaternary background | var(--cometchat-neutral-color-300) | Additional surface layer |
--cometchat-extended-primary-color-50 through 900 | Primary color scale (lightest to darkest) | See palette below | Hover states, gradients, shades |
--cometchat-font-family | All text in UI Kit | 'Roboto', 'Inter' | Global typography |
--cometchat-text-color-highlight | Highlighted/linked text | var(--cometchat-primary-color) | Links, mentions, highlights |
--cometchat-icon-color-highlight | Highlighted icon color | var(--cometchat-primary-color) | Active icons, selected states |
--cometchat-text-color-secondary | Secondary/caption text | var(--cometchat-neutral-color-600) | Timestamps, subtitles, captions |
--cometchat-icon-color-secondary | Secondary icon color | var(--cometchat-neutral-color-500) | Inactive icons |
--cometchat-border-color-default | Default border color | var(--cometchat-neutral-color-300) | Dividers, input borders |
--cometchat-info-color | Informational states | #0B7BEA | Info callouts |
--cometchat-warning-color | Warning states | #FFAB00 | Warning callouts |
--cometchat-success-color | Success states | #09C26F | Online indicators, success messages |
--cometchat-error-color | Error states | #F44649 | Error messages, validation |
--cometchat-message-seen-color | Seen/read indicator color | (dark mode only: #56E8A7) | Read receipts |
--cometchat-primary-button-background | Primary button fill | var(--cometchat-primary-color) | Send button, action buttons |
--cometchat-primary-button-text | Primary button text | #FFFFFF (static white) | Button labels |
--cometchat-primary-button-icon | Primary button icon | #FFFFFF (static white) | Button icons |
--cometchat-secondary-button-background | Secondary button fill | var(--cometchat-neutral-color-900) | Secondary action buttons |
--cometchat-secondary-button-text | Secondary button text | var(--cometchat-neutral-color-900) | Secondary button labels |
--cometchat-secondary-button-icon | Secondary button icon | var(--cometchat-neutral-color-900) | Secondary button icons |
--cometchat-link-button | Link button color | var(--cometchat-info-color) | Inline link buttons |
--cometchat-fab-button-background | FAB button fill | var(--cometchat-primary-color) | Floating action button |
--cometchat-fab-button-icon | FAB button icon | #FFFFFF (static white) | FAB icon |
--cometchat-white-hover | Hover state on white surfaces | var(--cometchat-neutral-color-100) | List item hover |
--cometchat-white-pressed | Pressed state on white surfaces | var(--cometchat-neutral-color-300) | List item press |
CSS Specificity & Precedence Rules:
- Component-level overrides (
.cometchat .cometchat-conversations { --var: val }) take precedence over global overrides (.cometchat { --var: val }) - Dark mode overrides (
[data-theme="dark"]) take precedence over light mode defaults - CSS variable overrides only affect properties the UI Kit theme binds to that variable — they do NOT change layout or spacing
- Always keep the
.cometchatprefix to avoid leaking styles into the host app !importantshould never be needed — if it is, the selector specificity is wrong
Color Palette
The primary color defines key actions, branding, and UI elements, while the extended primary palette provides variations for supporting components.Primary Color
Light Mode

Dark Mode

Extended Primary Colors
Light Mode

Dark Mode

Complete End-to-End Example: Custom Brand Colors
Step 1: Add toApp.css:
App.tsx imports the CSS:
Common Failure Modes
Troubleshooting: Color Overrides Not Working
Troubleshooting: Color Overrides Not Working
| Symptom | Cause | Fix |
|---|---|---|
| CSS has no effect | CSS file not imported in app entry | Add import "./App.css"; in App.tsx |
| CSS has no effect | Base stylesheet not imported | Add @import url("@cometchat/chat-uikit-react/css-variables.css"); at top of App.css |
| Selectors don’t match | Using CSS Modules (hashed class names) | Move rules to a global stylesheet, not *.module.css |
| Only some elements changed color | Only overrode --cometchat-primary-color but not extended palette | Override the extended-primary-color scale too for full consistency |
| Dark mode unchanged | Only overrode light mode tokens | Add overrides in .cometchat-root[data-theme="dark"] .cometchat selector too |
| Component-level override not working | Selector specificity too low | Use .cometchat .cometchat-<component> for higher specificity |
| Styles leak into host app | Missing .cometchat scope prefix | Always scope overrides under .cometchat |
| Token change has no visible effect | Token doesn’t control the expected property | Check the CSS Variable Reference table above |