Overview
The CometChatMessageHeader component displays the header section of a chat conversation. It shows information about the user or group being chatted with, including real-time status updates, typing indicators, and provides action buttons for calls, search, and AI-powered conversation summary. The component follows a Hybrid Approach architecture where:- MessageHeaderService handles all SDK interactions, state management, and real-time updates using Angular Signals
- Component @Input properties allow developers to override service behavior for flexibility
- Both service methods and @Input properties are available, with @Input taking priority when provided
Key Features
- Real-time Updates: Automatic updates for user online/offline status and typing indicators
- Flexible Customization: Extensive template projection for all UI sections (header, leading, title, subtitle, trailing)
- Service-Based Architecture: Clean separation of concerns with Angular Signals for reactive state management
- Keyboard Navigation: Full keyboard accessibility with Tab, Enter, Space, and Escape key support (WCAG 2.1 Level AA compliant)
- Call Integration: Built-in voice and video call buttons with customizable visibility
- AI Smart Chat Features: Support for conversation summary generation with configurable message count
- Search Integration: Optional search functionality with event emission
- Error Handling: Comprehensive error handling with event propagation
Basic Usage
Simple Implementation with User
Simple Implementation with Group
With Call Buttons and Search
Live Preview — message header for a user conversation.
Open in Storybook ↗
Properties
Entity Configuration Properties
Display Control Properties
AI Configuration Properties
Date/Time Configuration Properties
Template Properties
Events
Usage Patterns
CometChatMessageHeader supports two usage patterns for receiving the active user or group context.- Using Service
- Using Props
When used alongside
cometchat-conversations, the message header automatically subscribes to ChatStateService. No explicit [user] or [group] input is needed — the component reacts to conversation selection changes.Advanced Usage
With AI Conversation Summary
Enable AI-powered conversation summary with custom message count:Auto-Generate Summary on Load
With Search and Summary (Overflow Menu)
When both search and summary options are enabled, they appear in an overflow menu:Custom Call Settings
Override the defaultCallSettingsBuilder used when calls are initiated from the message header:
Custom Last Active Date Format
Customization with Templates
Custom Subtitle View
Customize the status/typing indicator section:Custom Leading View with Badge
Custom Trailing View with Additional Actions
Custom Back Button
Live Preview — message header with a custom back button.
Open in Storybook ↗
Keyboard Accessibility
CometChatMessageHeader is fully keyboard accessible and meets WCAG 2.1 Level AA standards.Keyboard Shortcuts
Accessibility Features
ARIA Attributes:role="banner"on the header containerrole="button"on the clickable item sectionrole="status"on status indicators and typing indicatorsaria-labelwith user/group name and status informationaria-live="polite"for typing indicator announcements- Proper
tabindexmanagement for keyboard navigation
- Announces user/group name and status when focused
- Announces typing indicator changes
- Announces status changes (online/offline) via live region
- Semantic HTML structure with proper heading hierarchy
- Visible focus indicators (2px border) meeting WCAG contrast requirements
- Logical tab order through interactive elements
- Focus trap within overflow menu when open
- ✅ 2.1.1 Keyboard (Level A) - All functionality available via keyboard
- ✅ 2.1.2 No Keyboard Trap (Level A) - Users can navigate away using keyboard
- ✅ 2.4.3 Focus Order (Level A) - Logical focus order
- ✅ 2.4.7 Focus Visible (Level AA) - Visible focus indicators
- ✅ 4.1.2 Name, Role, Value (Level A) - Proper ARIA attributes
- ✅ 4.1.3 Status Messages (Level AA) - Screen reader announcements
Styling with CSS Variables
The CometChatMessageHeader component uses CSS variables for comprehensive theming:Dark Theme Example
Custom Brand Colors
Real-Time Features
Automatic Updates
The component automatically updates in real-time for:- User Status: Online/offline status changes are reflected immediately
- Typing Indicators: Shows when the user is typing (for 1-on-1 conversations)
- Group Typing: Shows who is typing in group conversations with support for multiple users
- Member Count: Updates when members join or leave a group
- Last Active: Updates the last active timestamp for offline users
Typing Indicator Display
For user conversations:- Shows “Typing…” when the user is typing
- Single user: “John is typing…”
- Two users: “John and Jane are typing…”
- Multiple users: “John and 2 others are typing…”
Error Handling
The component provides comprehensive error handling through theonError event:
For troubleshooting tips, see the Troubleshooting Guide.