Skip to main content
Theming controls the look and feel of the chat UI — colors, fonts, and other styles — through CSS variables.
Prerequisites:
  1. Import the base stylesheet: @import url("@cometchat/chat-uikit-react/css-variables.css"); in App.css
  2. Import the CSS file at the app entry: import "./App.css"; in App.tsx
  3. All selectors assume the UI Kit renders under a .cometchat root wrapper
  4. Use global CSS (not CSS Modules with hashed class names) — hashed selectors won’t match

Root Wrapper (.cometchat)

All selectors in this doc are scoped under .cometchat, the class the UI Kit renders on its root element.
For data-theme, place it on the wrapper and scope 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"] .cometchat or @media (prefers-color-scheme: dark)
Precedence
  1. Element-level CSS overrides (most specific)
  2. Component-scoped variables (.cometchat .cometchat-conversations { --var })
  3. Global variables (.cometchat { --var })
  4. Defaults from css-variables.css (least specific)
Outputs
  • 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

App.css

Global Theming with CSS Variables

Override CSS variables in the global stylesheet to customize the entire chat UI.
Use App.css for global overrides scoped under .cometchat. Use the runtime setProperty approach only for live theme changes without a reload.
All primary-colored elements (outgoing bubbles, buttons, active states, links) change to orange (#f76808). Background panels change to light peach (#feede1). Font changes to Times New Roman.

Top Tokens (Quick Mapping)

For the complete list, see Color Resources.

Component-Specific Theming

Override CSS variables within a component’s class to apply different styles to specific components.
App.css
Only the Conversations component changes — primary color becomes orange, highlight text becomes amber, avatars get 12px border radius. Other components remain unchanged.

Advanced Customization with CSS Overrides

Target specific elements directly for full control over component styling.
App.css
Avatar images in the Conversations list change from circular to rounded-square (12px radius).

Dark and Light Theme Support

Choose ONE dark mode strategy:
  1. App-controlled: set data-theme on the wrapper (e.g., .cometchat-root) and scope overrides like .cometchat-root[data-theme="dark"] .cometchat { ... }
  2. OS-controlled: use @media (prefers-color-scheme: dark) scoped to .cometchat

Enabling Dark Mode

App.tsx
The wrapper tracks the user’s OS preference and sets data-theme, which switches palettes in CSS.

Customizing Light and Dark Theme

App.css
For OS-controlled dark mode, wrap the dark overrides in @media (prefers-color-scheme: dark) and keep the .cometchat scope. 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

Brand color swap (global)

App.css
Primary accents, buttons, and active states switch to teal.

Dark mode (app-controlled)

App.css
Panels and surfaces darken while accents remain visible.

Conversations-only override

App.css
Only the Conversations component changes; other components stay default.

Bubble styling (incoming/outgoing)

App.css
Outgoing bubbles use orange; incoming bubbles use a light slate. For more variants, see Message Bubble Styling.

Resources

UI Kit Source Code

Complete list of color variables and hex values on GitHub.View on GitHub

Figma UI Kit

Figma UI Kit with fully integrated color palette.View on Figma