A simple Angular component for displaying action/system messages in a chat interface
The CometChatActionBubble component is a simple presentational Angular component that displays action/system messages in a chat interface. These are messages like “User joined the group”, “User left the group”, or “Group name changed to X”.
Unlike regular message bubbles that are aligned left (receiver) or right (sender), action bubbles are centered and have a subtle, pill-shaped appearance. The component is purely presentational and does NOT accept a CometChat message object - only a plain text string.Key features:
Simple Text Display: Accepts a single text input for the action message
Centered Layout: Pill-shaped container with subtle styling
Hidden Icon Element: Available for CSS customization if needed
Full Accessibility Support: ARIA role and labels for screen readers
CSS Variable-Based Theming: Easy customization via CSS variables
import { Component } from '@angular/core';import { CometChatActionBubbleComponent } from '@cometchat/chat-uikit-angular';@Component({ selector: 'app-action-messages', standalone: true, imports: [CometChatActionBubbleComponent], template: ` <!-- User joined --> <cometchat-action-bubble [messageText]="'John joined the group'" ></cometchat-action-bubble> <!-- User left --> <cometchat-action-bubble [messageText]="'Sarah left the group'" ></cometchat-action-bubble> <!-- Group name changed --> <cometchat-action-bubble [messageText]="'Group name changed to Team Chat'" ></cometchat-action-bubble> <!-- Admin changed --> <cometchat-action-bubble [messageText]="'Mike is now an admin'" ></cometchat-action-bubble> `})export class ActionMessagesComponent {}
Screen readers announce the action bubble as a status message with the provided text content. The role="status" attribute ensures that screen readers treat this as an informational message rather than interactive content.