Skip to main content

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 the theme prop to CometChatProvider:
This sets data-theme="dark" on the wrapper, which activates the dark theme CSS variables.

Switching Themes at Runtime

Use the useTheme 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
Import this file after the UI Kit styles:

Per-Theme Overrides

Target a specific theme with the data-theme selector:

Per-Component Overrides

Target a specific component by its BEM class name:
Or wrap the component in your own class:

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 pattern cometchat-{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:
2. Plain class selectors — target any component by its BEM class name:
3. Wrap in your own class — add a wrapper div with your own class and set tokens there:
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 custom data-theme value:
src/themes/brand.css
Then pass your theme name:
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