CometChatCollaborativeDocumentBubble component renders collaborative document messages within chat. It displays a banner image, title, subtitle, and an action button that opens the document in a new fullscreen window.
Overview
The Collaborative Document Bubble component processesCometChat.CustomMessage objects of type extension_document to display collaborative document content:
- Message Object Processing: Extracts document URL from message metadata
- Theme-aware Banner Images: Automatically selects light/dark banner images based on current theme
- Localized Text: Displays title, subtitle, and button text using localization keys
- Sender/Receiver Styling: Supports outgoing (right-aligned) and incoming (left-aligned) visual variants
- Action Button: Opens the document URL in a new fullscreen window
- Accessibility: Full keyboard navigation and screen reader support
Live Preview — Default collaborative document bubble preview.
Open in Storybook ↗
Basic Usage
Simple Document Message
Incoming vs Outgoing Messages
With Event Handler
Properties
Events
Message Metadata Structure
The component extracts the document URL from the following metadata path:Advanced Usage
Complete Chat Message Component
Message List with Document Bubbles
Customization
Styling with CSS Variables
The Collaborative Document Bubble component uses CSS variables exclusively for easy customization:Available CSS Variables
Custom Color Schemes
Custom Button Styling
Accessibility
The Collaborative Document Bubble component is fully accessible and follows WCAG 2.1 Level AA guidelines.WCAG 2.1 Compliance
- ✅ 1.1.1 Non-text Content (Level A): Banner image has empty alt attribute (decorative)
- ✅ 1.3.1 Info and Relationships (Level A): Proper semantic structure with button element
- ✅ 2.1.1 Keyboard (Level A): All functionality available via keyboard
- ✅ 2.4.7 Focus Visible (Level AA): Clear focus indicators on action button
- ✅ 4.1.2 Name, Role, Value (Level A): Action button has accessible name via aria-label
Keyboard Support
ARIA Attributes
Screen Reader Behavior
Screen readers announce the component with:- Banner image: Skipped (decorative)
- Title: “Collaborative Document” (or localized equivalent)
- Subtitle: “Open document to edit content together” (or localized equivalent)
- Button: “Open Document, button” (or localized equivalent)
Best Practices
Use the
alignment property to distinguish between incoming and outgoing messages for proper visual styling.The component automatically selects the appropriate banner image based on the current theme (light/dark).
For troubleshooting tips, see the Troubleshooting Guide.
Related Components
- CometChatCollaborativeWhiteboardBubble: Displays collaborative whiteboard messages
- CometChatFileBubble: Displays file attachment messages
- CometChatMessageBubble: Parent component for message bubbles
- CometChatMessageList: Displays lists of messages
Technical Details
- Standalone Component: Can be imported and used independently
- Change Detection: Uses OnPush change detection strategy for optimal performance
- Dependencies:
- Angular CommonModule
- CometChat SDK for message types
- TranslatePipe for localization
- BEM CSS: Follows Block Element Modifier naming convention
- Accessibility: WCAG 2.1 Level AA compliant