CometChatMessageBubble component is a versatile container component that renders chat messages with configurable view slots. It serves as the primary wrapper for displaying messages in the CometChat Angular UIKit, handling message alignment, options menus, status indicators, and content rendering based on message type.
Overview
The Message Bubble component provides a flexible architecture for rendering different message types while maintaining consistent styling and behavior:- Message Type Routing: Automatically renders appropriate bubble component based on message type (text, image, video, audio, file)
- Configurable View Slots: Override any section (leading, header, content, footer, etc.) with custom templates
- Message Options Menu: Context menu with hover/click behavior for message actions
- Group vs 1-on-1 Handling: Automatically shows/hides avatar and sender name based on conversation type
- Alignment Variants: Supports incoming (left), outgoing (right), and action (center) alignments
- Status Indicators: Displays timestamps, read receipts, and edited labels
- Reply Preview: Shows quoted message preview for replies
- Accessibility: Full keyboard navigation and screen reader support
Live Preview — Default message bubble preview.
Open in Storybook ↗
Message Bubble Structure
The Message Bubble is composed of several configurable view slots that can be customized independently:View Slot Descriptions
Basic Usage
Simple Message Bubble
Incoming vs Outgoing Messages
With Message Options
API Reference
Properties
View Override Properties
Display Control Properties
Events
Media Message Rendering
Media messages always render with the multi-attachment bubbles. There is no flag to switch this off — a message can arrive carrying several attachments no matter how your own composer is configured, so the renderer always handles that case.CometChatMessageBubble routes by message type:
Most of these delegate the media rendering to their single-attachment counterpart — Images to
CometChatImageBubble, Videos to CometChatVideoBubble, Files to CometChatFileBubble, and Voice Note to CometChatAudioBubble. Audios is the exception: it draws its own player rows rather than delegating. All of them add the batch-aware shared width and the isFirstInBatch / isLastInBatch grouping that makes a batch read as one visual block. The legacy bubbles stay exported for direct use; the message bubble no longer routes to them.
CometChatMessageComposer has an enableMultipleAttachments input, but it governs only the send side — whether picking files stages them in a tray for one batched send. It has no effect on rendering.Bubble Parts Customization
Each bubble part can be customized independently using AngularTemplateRef. The customization follows a priority system:
- Input template ref (passed directly to component) - Highest priority
- Service configured view (via
MessageBubbleConfigService) - Medium priority - Default rendering - Lowest priority
bubbleView
ThebubbleView provides complete control over the entire message bubble. When set, it replaces all other views (header, content, footer, etc.).
Use Case: When you need a completely custom message layout that doesn’t follow the standard structure.
leadingView
TheleadingView customizes the avatar section that appears on the left side of incoming messages in group conversations.
Use Case: Custom avatar styling, adding status badges, or showing additional user information.
headerView
TheheaderView customizes the sender name section that appears above the message content in group conversations.
Use Case: Adding user roles, custom badges, or additional sender information.
replyView
ThereplyView customizes the quoted message preview that appears when a message is a reply to another message.
Use Case: Custom reply preview styling, showing additional context, or different preview formats.
contentView
ThecontentView customizes the main message content area. This is where the actual message (text, image, video, etc.) is displayed.
Use Case: Custom message rendering, adding interactive elements, or completely different content layouts.
statusInfoView
ThestatusInfoView customizes the timestamp and delivery status section that appears inside the message bubble.
Use Case: Custom timestamp formats, additional status indicators, or different receipt icons.
bottomView
ThebottomView customizes the section below the main content, typically used for link previews, warnings, or additional information.
Use Case: Link previews, content warnings, or expandable content sections.
footerView
ThefooterView customizes the reactions section that appears below the message content.
Use Case: Custom reaction display, adding additional footer actions, or different reaction layouts.
threadView
ThethreadView customizes the thread reply indicator that appears when a message has replies.
Use Case: Custom thread indicators, showing reply previews, or different thread navigation styles.
Service-Based Customization
For global customization across all message bubbles, use theMessageBubbleConfigService. This allows you to set custom views that apply to all instances without passing templates to each component.
Using MessageBubbleConfigService
MessageBubbleConfigService API
Scoping for Multiple Instances
By default,MessageBubbleConfigService is a root-level singleton — all message bubbles share the same configuration. If you need different bubble customizations for different message lists (e.g., a main chat vs. a thread panel), create a wrapper component that provides its own instance:
BubblePart Type
CSS Customization
Styling with CSS Variables
The Message Bubble component uses CSS variables for consistent theming. Override these variables to customize the appearance:Component-Specific CSS Variables
In addition to the global theme tokens above, the Message Bubble component exposes its own overridable CSS custom properties, prefixed with--cometchat-message-bubble-. Override these to customize appearance for this component specifically, independently of the global theme tokens.
The component exposes
--cometchat-message-bubble- prefixed CSS custom properties that can be overridden. Inspect the rendered .cometchat-message-bubble element in your browser’s developer tools to discover the exact variable names exposed by your installed version of the UI Kit.Dark Theme
Component-Specific Styling
Target specific bubble elements using BEM class names:Advanced Usage
Group Conversation with Avatar and Sender Name
With Text Formatters
With Message Translation
Accessibility
The Message Bubble component is fully accessible and follows WCAG 2.1 Level AA guidelines:Keyboard Support
ARIA Attributes
Screen Reader Announcements
The component provides meaningful announcements for:- Message sender and type
- Message status (sent, delivered, read)
- Edited messages
- Reactions and their counts
- Thread reply counts
Best Practices
The component automatically determines the appropriate bubble component based on message type. Use
contentView only when you need custom rendering.Use CSS variables for styling to ensure your customizations work correctly with both light and dark themes.
Related Components
- CometChatMessageList - Parent component that renders message bubbles
- CometChatTextBubble - Text message content component
- CometChatMessagePreview - Reply preview component
- CometChatThreadHeader - Thread header component
- CometChatImagesBubble - Renders
imagemessages - CometChatVideosBubble - Renders
videomessages - CometChatAudiosBubble - Renders
audiomessages that are attached files - CometChatFilesBubble - Renders
filemessages - CometChatVoiceNoteBubble - Renders
audiomessages tagged as voice notes
CometChatAudiosBubble delegate to a single-attachment counterpart. The message bubble no longer routes to these directly, but they remain available for standalone use:
- CometChatImageBubble - Image message content component
- CometChatVideoBubble - Video message content component
- CometChatAudioBubble - Audio message content component
- CometChatFileBubble - File message content component