Overview
The CometChatGroupMembers component displays a real-time, scrollable list of members belonging to a specific CometChat group. It provides built-in search functionality, allowing you to locate any specific member swiftly. For each member listed, the component displays the member’s name and avatar, along with their scope (owner, admin, moderator, or participant) and online/offline status. The component follows a Service-based Architecture where:- GroupMembersService handles SDK request building, pagination, and state management
- Component manages UI rendering, real-time listeners, and keyboard navigation
- Templates allow extensive customization of all UI sections
Key Features
- Real-time Updates: Automatic updates for group member events (join, leave, kick, ban, scope change)
- Flexible Customization: Extensive template projection for all UI sections
- Selection Modes: Support for single and multiple member selection
- Scope Management: Built-in scope change dialog for owners and admins
- Member Actions: Context menu with kick, ban, and scope change options based on permissions
- Search Functionality: Built-in search with 300ms debouncing
- Keyboard Navigation: Full keyboard accessibility with arrow keys and shortcuts (WCAG 2.1 Level AA compliant)
- Error Handling: Comprehensive error handling with custom error views
Live Preview — default group members list preview.
Open in Storybook ↗
Keyboard Accessibility
CometChatGroupMembers is fully keyboard accessible and meets WCAG 2.1 Level AA standards. All functionality can be accessed using only the keyboard.Keyboard Shortcuts
Accessibility Features
ARIA Attributes:role="list"on members containerrole="listitem"on each member itemaria-labelwith member name, scope, and statusaria-selectedindicates selected members- Proper
tabindexmanagement (roving tabindex pattern)
- Announces member details when focused
- Announces selection state changes
- Announces member scope (owner/admin/moderator/participant)
- Semantic HTML structure
- Visible focus indicators (2px border) meeting WCAG contrast requirements
- Focus restoration after interactions
- Roving tabindex for efficient keyboard navigation
- ✅ 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
Basic Usage
Simple Implementation
With Search and Status Indicators
Usage Patterns
CometChatGroupMembers supports two usage patterns. The default service-based approach usesChatStateService to automatically wire the group context. Alternatively, you can
pass data explicitly via @Input() bindings.
- Using Service
- Using Props
When a group is selected via See the ChatStateService API reference for the full list of signals, observables, and setter methods.
ChatStateService, cometchat-group-members automatically subscribes to ChatStateService.activeGroup — no explicit [group] binding required. This is ideal when your app already uses ChatStateService to manage the active conversation.Properties
Display Control Properties
Data Configuration Properties
Template Properties
Events
Advanced Usage
Filtering Members with GroupMembersRequestBuilder
Use thegroupMemberRequestBuilder to filter members by various criteria:
GroupMembersRequestBuilder Methods
Selection Modes
Enable single or multiple member selection:Custom Context Menu Options
Provide custom actions for each member:Scope Change
The component includes built-in scope change functionality. When a group owner or admin clicks the scope indicator on a member, a scope change dialog appears allowing them to change the member’s role. This behavior is controlled by thehideScopeChangeOption input:
Customization with Templates
Custom Subtitle View
Customize the subtitle section to show the member’s join date:Custom Empty and Error States
Provide custom views for empty and error states:Styling with CSS Variables
The CometChatGroupMembers component uses CSS variables for comprehensive theming:Dark Theme Example
Customizing Scope Tags with CSS
Real-Time Features
Automatic Updates
The component automatically updates in real-time for:- Member Events: Join, leave, kick, ban events are reflected immediately
- Scope Changes: Member scope updates appear in real-time
- Connection Recovery: Automatically refreshes the list when connection is re-established
Event Subscriptions
The component subscribes to the following events:Error Handling
Built-in Error Handling
The component includes comprehensive error handling:For troubleshooting tips, see the Troubleshooting Guide.
Best Practices
The component uses a service-based architecture with
GroupMembersService for state management. If you’re using custom templates with external state, ensure proper change detection triggering.