AI Integration Quick Reference
AI Integration Quick Reference
Overview
The v7 UI Kit uses CSS custom properties (design tokens) for all visual styling. Every color, font, spacing value, and border radius is defined as a--cometchat-* variable. Components reference these tokens — never hardcoded values.
Theming works through the data-theme attribute on the .cometchat wrapper div. The built-in light.css and dark.css files define token values for each theme. You can override any token to create custom themes.
Setting the Theme
Pass thetheme prop to CometChatProvider:
data-theme="dark" on the wrapper, which activates the dark theme CSS variables.
Switching Themes at Runtime
Use theuseTheme hook inside any component within the provider:
Customizing Tokens
Override CSS variables to change the look of all components at once:src/cometchat-overrides.css
Per-Theme Overrides
Target a specific theme with thedata-theme selector:
Per-Component Overrides
Target a specific component by its BEM class name:Design Token Categories
Colors
Semantic Colors
Typography
Spacing & Layout
Buttons
Component CSS Classes
The UI Kit uses plain, unhashed BEM class names in the DOM. All component class names follow the patterncometchat-{component} with BEM modifiers (e.g., cometchat-message-bubble__content--outgoing). You can target them directly with standard class selectors.
What Works
1. The.cometchat wrapper class — the root div. Override tokens here to affect all components:
CSS variable overrides work at any level of the tree. Set them on
.cometchat (the root wrapper) to affect all components, or use class selectors / wrapper classes to scope the change. Variables cascade down — a value set on a parent will be inherited by all CometChat components within it.Creating a Custom Theme
Define a complete set of tokens under a customdata-theme value:
src/themes/brand.css
When creating a custom theme, start from the light or dark theme file and override only what you need. Unset tokens will fall back to the
:root defaults (light theme).Next Steps
Color Resources
Full color token reference with swatches
Message Bubble Styling
Customize bubble appearance, alignment, and spacing