AI Integration Quick Reference
AI Integration Quick Reference
Selector Pattern
Use this table to construct the correct CSS selector for any message bubble target. AI agents should use this pattern to generalize — do not guess selectors.<TYPE><TYPE> is one of text, image, video, audio, fileLink Preview BubblesIt reuse the
text-message type selector since link previews are rendered inside text messages.CSS Variable Reference
These are the CSS variables (tokens) used across message bubble styling. This table tells you exactly what each token controls — do not assume a token affects something not listed here.CSS Specificity & Precedence Rules:
- Message-type selectors (e.g.,
__text-message) override “All Message Bubbles” selectors - Always keep the
.cometchatprefix to avoid leaking styles into the host app - Component-level variable overrides (
.cometchat-message-list { --var: val }) override global overrides (.cometchat { --var: val }) - CSS variable overrides only affect properties the UI Kit theme binds to that variable — they do NOT change layout or spacing
!importantshould never be needed — if it is, your selector specificity is wrong
Bubble Structure
Each message bubble has this DOM structure:Incoming & Outgoing Messages
Incoming and outgoing messages have different styling by default, allowing users to visually separate their own messages from others’. Here, we show both the default view and examples of customizations for these message bubbles. Shown below is the default chat interface.
Styling
Outgoing Message Bubbles
Selectors:
The customized chat interface is displayed below.

App.css
Incoming Message Bubbles
Selectors:
The customized chat interface is displayed below.

App.css
All Message Bubbles
Selectors:
The customized chat interface is displayed below.

App.css
Complete End-to-End Example
To apply custom bubble colors in your app: Step 1: Add toApp.css:
App.tsx imports the CSS:
Message Types
CometChat UI Kit includes classes for various message types. Below are examples of default & customised views for each message type, along with the relevant CSS code snippets so that you can quickly get up to speed with CSS customization.Text Message Bubble
Selectors:- Outgoing
- Incoming
Shown below is the default chat interface.


- App.css
Image Message Bubble
Image messages render with the Image Bubble (.cometchat-images-bubble, with --incoming / --outgoing / --single modifiers) — the batch-aware component that lays out one or more images in a grid. The bubble background (visible behind the grid, in the gaps and the “+N” overflow tile) is set through the __image-message body selector below; target .cometchat-images-bubble for the media content itself.
Selectors:
- Outgoing
- Incoming
Shown below is the default chat interface.


- App.css
Video Message Bubble
Video messages render with the Video Bubble (.cometchat-videos-bubble, with --incoming / --outgoing / --single modifiers) — the batch-aware component that lays out one or more video thumbnails in a grid. The bubble background is set through the __video-message body selector below; target .cometchat-videos-bubble for the media content itself.
Selectors:
- Outgoing
- Incoming
Shown below is the default chat interface.


- App.css
Audio Message Bubble
Attached audio files render with the Audio Bubble (.cometchat-audios-bubble) — stacked playback cards. A single audio card is transparent and shows the bubble background; when a message carries multiple audio files, each card gets its own background. The bubble background is set through the __audio-message body selector below.
Attached audio and voice notes share the same
__audio-message body type class, so an __audio-message selector styles both. To target only attached audio, use .cometchat-audios-bubble; to target only voice notes, use .cometchat-audio-bubble (see Voice Note Message Bubble).- Outgoing
- Incoming
Shown below is the default chat interface.


- App.css
File Message Bubble
File attachments render with the File Bubble (.cometchat-files-bubble) — stacked file cards with type icons. A single file card is transparent and shows the bubble background; when a message carries multiple files, each card gets its own background. The bubble background is set through the __file-message body selector below; target .cometchat-files-bubble for the card content.
Selectors:
- Outgoing
- Incoming
Shown below is the default chat interface.


- App.css
Voice Note Message Bubble
Voice notes — audio messages recorded in the composer (taggedaudioType: "voice_note") — render with the Voice Note Bubble (.cometchat-audio-bubble), a standalone waveform player. Its direction modifiers are --sender (outgoing) and --receiver (incoming).
Voice notes share the
__audio-message body type class with attached audio, so an __audio-message selector styles both. To target only voice notes, use .cometchat-audio-bubble; for only attached audio files, use .cometchat-audios-bubble.- Outgoing (sender)
- Incoming (receiver)
Complete CSS:
- App.css
Action Message Bubble
Action messages (e.g., “User joined the group”) use a different selector pattern — they are not directional (no incoming/outgoing). Selector:.cometchat .cometchat-message-bubble__body .cometchat-action-bubble
Shown below is the default chat interface.


- App.css
Extensions
Collaborative Whiteboard Bubble
Selectors:- Outgoing
- Incoming
Collaborative whiteboard messages use the
text-message type class internally.
Shown below is the default chat interface.


- App.css
Collaborative Document Bubble
Selectors:- Outgoing
- Incoming
Collaborative document messages use the
text-message type class internally.
Shown below is the default chat interface.


- App.css
Polls Bubble
Selectors:- Outgoing
- Incoming
Poll messages use the
text-message type class internally.
Shown below is the default chat interface.


- App.css
Stickers Bubble
Selectors:- Outgoing
- Incoming
Sticker messages use the
image-message type class internally.
Shown below is the default chat interface.


- App.css
Link Preview Bubble
Link previews render inside text message bubbles, so they use thetext-message type selector.
Selectors:
- Outgoing
- Incoming
Styling link preview bubbles also affects regular text message bubbles since they share the same
__text-message selector. This is by design — link previews are a sub-feature of text messages.

- App.css
CSS Selectors Reference
Class names are plain, stable BEM names that you can target directly:All class names follow BEM conventions and are stable across builds. You can target them with standard
.class-name selectors in your CSS.