AI Agent Component Spec
AI Agent Component Spec
- Goal: Customize UI Kit appearance (colors, fonts, dark mode)
- Where:
App.css(global) — import in app entry viaimport "./App.css"; - Step 1: Import base stylesheet:
@import url("@cometchat/chat-uikit-react/css-variables.css"); - Step 2: Override variables on
.cometchat(global) or.cometchat-<component>(component-specific) - Step 3: For dark mode, override on
.cometchat-root[data-theme="dark"] .cometchator use@media (prefers-color-scheme: dark) - Key tokens:
--cometchat-primary-color,--cometchat-neutral-color-300,--cometchat-font-family,--cometchat-background-color-03 - Constraints: Global CSS only (no CSS Modules), no
!important, component-level overrides beat global - Full token list: Color Resources | GitHub source
Root Wrapper (.cometchat)
All selectors in this doc are scoped under .cometchat, which is the class the UI Kit renders on its root element. If you already wrap your chat UI in a container (commonly cometchat-root in examples), keep it — just make sure your overrides target .cometchat inside.
data-theme, put it on the wrapper you control and scope your dark theme overrides to .cometchat inside.
Theming Contract
Inputs- Base stylesheet import:
@import url("@cometchat/chat-uikit-react/css-variables.css"); - Global CSS variables on
.cometchat - Component-scoped variables on
.cometchat .cometchat-<component> - Optional element-level CSS overrides for specific selectors
- Optional theme mode selector:
.cometchat-root[data-theme="dark"] .cometchator@media (prefers-color-scheme: dark)
- Always scope overrides under
.cometchatto avoid leaking styles into the host app.
- Element-level CSS overrides (most specific)
- Component-scoped variables (
.cometchat .cometchat-conversations { --var }) - Global variables (
.cometchat { --var }) - Defaults from
css-variables.css(least specific)
- Primary tokens change outgoing bubbles, buttons, and active states.
- Background tokens change panels and surfaces.
- Text/icon tokens change highlight accents.
- Font tokens change typography across the UI.
Importing the Stylesheet
To enable theming, first, import the base stylesheet containing default styles and variables.- App.css
Global Theming with CSS Variables
Customize the entire chat UI by overriding CSS variables in your global stylesheet.Example: Changing Colors & Fonts
The following CSS variables customize colors, fonts, and other elements.
- App.css (Recommended)
- App.tsx (Runtime Only)
Top Tokens (Quick Mapping)
Use this table for fast, reliable overrides. For the complete list, see Color Resources.| Token | Common usage (varies by component) |
|---|---|
--cometchat-primary-color | Primary accent color (buttons, outgoing bubbles, active states) |
--cometchat-extended-primary-color-900 | Darker primary shade (outgoing bubble shade) |
--cometchat-extended-primary-color-500 | Mid primary shade (secondary accents/hover) |
--cometchat-neutral-color-300 | Neutral surface (incoming bubbles/panels) |
--cometchat-background-color-03 | Panel background surface |
--cometchat-text-color-highlight | Highlight text color |
--cometchat-icon-color-highlight | Highlight icon color |
--cometchat-message-seen-color | Seen/read indicator color |
--cometchat-font-family | Global font family |
--cometchat-radius-max | Maximum corner radius used across UI elements |
Component-Specific Theming
Want to apply different styles to specific components? Override CSS variables within the component’s class.
- App.css
Advanced Customization with CSS Overrides
For full control over component styling, use CSS overrides to target specific elements directly.- App.css
Dark & Light Theme Support
You can switch between light and dark modes.Example: Enabling Dark Mode

- App.tsx
data-theme, which you can use to switch palettes in your CSS.
Customizing Light & Dark Theme
Define different color schemes for light and dark modes.
- App.css
@media (prefers-color-scheme: dark) and keep the .cometchat scope.
Expected result: Light mode uses orange (#f76808) with peach backgrounds; dark mode uses the same orange accent but with dark brown backgrounds (#311502, #451d02) for proper contrast.
Examples
1) Brand color swap (global)
Where:App.css
2) Dark mode (app-controlled)
Where:App.css + set data-theme on the .cometchat wrapper
3) Conversations-only override
Where:App.css
4) Bubble styling (incoming/outgoing)
Where:App.css
Common Failure Modes
Troubleshooting: Theming Not Working
Troubleshooting: Theming 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 |
| Overrides not applying | Missing .cometchat scope in selector | Ensure your overrides are scoped under .cometchat |
| Selectors don’t match | Using CSS Modules (hashed class names) | Move rules to a global stylesheet, not *.module.css |
| Component-level override not working | Missing .cometchat parent in selector | Use .cometchat .cometchat-conversations not just .cometchat-conversations |
| Dark mode unchanged | data-theme missing or mismatch | Set data-theme="dark" on your wrapper (e.g., .cometchat-root) and target .cometchat-root[data-theme="dark"] .cometchat, or use @media (prefers-color-scheme: dark) |
| Font not changing | --cometchat-font-family set on wrong element | Set on .cometchat or via a ref to the .cometchat wrapper |
| 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 property you expect | Check the Color Resources table for what each token controls |
Helpful Resources
Enhance your design and development workflow with the following resources:UI Kit Source Code
Explore the complete list of color variables and hex values on GitHub.View on GitHub
Figma UI Kit
Access the Figma UI Kit for a fully integrated color palette and seamless customization.View on Figma
Next Steps
Color Resources
Full reference of all CSS variables and color tokens with light/dark mode values
Message Bubble Styling
Customize incoming and outgoing message bubble colors per message type
Components Overview
Browse all available UI Kit components and their customization options
Localization
Customize language strings and translations across the UI Kit