Skip to main content

Overview

The MessageBubble styling API allows developers to customize the appearance of incoming and outgoing message bubbles globally or at the component level. This includes various message types such as text, image, video, audio, file, and document bubbles. There are two primary classes for styling message bubbles:
  • CometChat Incoming Message Bubble Style
  • CometChat Outgoing Message Bubble Style
Both classes provide properties for customizing background color, border, corner radius, and specific styles for individual message types.

Properties

Global Styling (Static Variables)

Specific Message Type Styles


Customization Examples

Customizing Incoming Message Bubble

The following code snippet shows how to customize the incoming message bubble style:

Customizing Outgoing Message Bubble

The following code snippet shows how to customize the outgoing message bubble style:

Text Bubble

Text bubbles display plain text messages, which are the most common message type. The following code snippet shows how to customize the text message bubble:
Default
Customization

Image Bubble

Image bubbles display messages with images. The following code snippet shows how to customize the image message bubble:
Default
Customization

Video Bubble

Video bubbles display messages with video clips. The following code snippet shows how to customize the video message bubble:
Default
Customization

Audio Bubble

Audio bubbles display audio messages. The following code snippet shows how to customize the audio message bubble:
Default
Customization

Media Grid Bubble

Media grid bubbles render messages that carry multiple image or video attachments as a count-based grid (1, 2, 3, 4, or 5+ tiles). When there are more items than visible tiles, the last tile shows a “+N” overflow badge; video tiles carry a play badge and duration pill. Tapping any tile opens the fullscreen media viewer with swipe navigation, pinch-to-zoom, inline video playback, per-photo download, and share.
Media grid bubbles rendering multiple image attachments as a 2x2 grid with a +4 overflow badge on the last tile, shown for both incoming and outgoing messages
Media grid bubbles rendering multiple video attachments with play badges on each tile and a +3 overflow badge on the last tile, shown for both incoming and outgoing messages
Grid layout and colors come from GalleryBubbleStyle:
Key GalleryBubbleStyle properties for the grid:

Audio Files Bubble

Audio files bubbles render messages carrying audio file attachments — one playback row per file, with a play/pause button, a seekable progress slider, the duration, the file name, and a download control. Only one row plays at a time.
Audio files bubble stacking multiple audio playback rows, each with a play button, seekable progress slider, duration and file name, plus a Show 2 more toggle, shown for both incoming and outgoing messages
This bubble is distinct from the Audio Bubble above, which renders voice notes recorded with the composer’s microphone. Voice notes keep their waveform look and are never grouped with other attachments.
Audio rows share the caption and section styling of GalleryBubbleStyle (sectionSpacing, captionFont, captionColor), and flip their colors automatically on outgoing bubbles.

Files Bubble

Files bubbles render messages carrying document attachments as a connected stack of file cards — each with a file-type icon (PDF, Word, Excel, PowerPoint, ZIP, …), the file name, and its metadata. Four or more files collapse behind a “+N more” toggle. Tapping a card opens the file: a downloaded copy previews in-app, otherwise the file is offered through the share sheet.
Files bubble showing a connected stack of document cards, each with a file-type icon, name, size and download control, plus a Show 2 more toggle, shown for both incoming and outgoing messages
File card styling comes from GalleryBubbleStyle:
Key GalleryBubbleStyle properties for file cards and the shared caption row:
Captions containing rich text (code blocks, quote blocks, inline code) render through the same pipeline as Text Bubbles, so their formatting looks identical across message types.

Poll Bubble

Poll bubbles display messages with polling options. The following code snippet shows how to customize the poll message bubble:
Default
Customization

The Link Preview Bubble displays a preview of links shared in messages. It enriches the messaging experience by showing details such as the page title, description, and an image from the linked content, making links more engaging and informative. The following code snippet shows how to customize the link preview message bubble:
Default
Customization

Action Bubble

Action bubbles provide a customizable interface for displaying a variety of actions, such as group actions, within a chat. The following code snippet shows how to customize the action message bubble:
Default
Customization

Delete Bubble

Delete bubbles display messages that have been deleted by the sender. These indicate the message removal within the chat interface. The following code snippet shows how to customize the delete message bubble:
Default
Customization

AI Assistant Bubble

The AI Assistant Bubble displays responses or messages sent by the AI assistant within the chat interface. These bubbles are designed to visually distinguish AI-generated messages from user messages, maintaining a clear and intuitive conversation flow. You can customize the appearance of the AI Assistant message bubble to match your app’s theme — including background color, text color, font, and border styling. The following code snippet shows how to customize the AI Assistant message bubble:

Next Steps

Message List

Display and customize the message list component

Message Composer

Customize the message input component

Component Styling

Learn about global styling options