Overview
The CometChatGroupMemberItem component renders a single group member entry within a member list. It displays the member’s avatar, name, online/offline status indicator, and a role badge (owner, admin, moderator). The component supports custom templates for all visual sections, integrates a context menu for member-specific actions (kick, ban, change scope), and provides full keyboard accessibility with ARIA support.Key Features
- State Management: Active, selected, and focused states with distinct visual styling
- Member Avatar: Displays the member’s avatar image with an online/offline status indicator
- Role Badge: Shows the member’s scope/role (owner, admin, moderator) as a visual badge
- Custom Templates: Template projection for leading, title, subtitle, and trailing sections
- Context Menu: Configurable context menu options for member management (kick, ban, change scope)
- Keyboard Accessibility: Full keyboard support with Enter, Space, and Shift+F10 shortcuts
- Global Config Priority: Supports a three-tier priority system (Input > GlobalConfig > Default)
Live Preview — default group member item preview.
Open in Storybook ↗
Basic Usage
Properties
| Property | Type | Default | Description |
|---|---|---|---|
member | CometChat.GroupMember | required | The group member object to render. Primary data source for the component. |
isActive | boolean | false | Whether this member item is currently active/selected for viewing. Applies active styling. |
isSelected | boolean | false | Whether this member item is selected in selection mode. Shows selection indicator. |
isFocused | boolean | false | Whether this member item currently has keyboard focus. Applies focus styling. |
tabIndex | number | -1 | The tabindex for roving tabindex pattern. Only the focused item should have 0. |
hideUserStatus | boolean | false | Whether to hide the member online/offline status indicator. Supports global config override. |
disableDefaultContextMenu | boolean | true | Whether to disable the browser’s default context menu on right-click/long-press. |
contextMenuOptions | CometChatOption[] | undefined | Options for the context menu (kick, ban, change scope). |
leadingView | TemplateRef<{ $implicit: CometChat.GroupMember }> | undefined | Custom template for the leading section (avatar area). |
titleView | TemplateRef<{ $implicit: CometChat.GroupMember }> | undefined | Custom template for the title section. |
subtitleView | TemplateRef<{ $implicit: CometChat.GroupMember }> | undefined | Custom template for the subtitle section. |
trailingView | TemplateRef<{ $implicit: CometChat.GroupMember }> | undefined | Custom template for the trailing section. |
Events
| Event | Payload Type | Description |
|---|---|---|
itemClick | CometChat.GroupMember | Emitted when the member item is clicked or activated via keyboard. |
itemFocus | void | Emitted when the item’s inner container receives native focus. Used by the parent list for roving tabindex management. |
contextMenuOptionClick | { option: CometChatOption; member: CometChat.GroupMember } | Emitted when a context menu option is clicked. |
Customization
CSS Variable Overrides
The component uses CometChat CSS variables for theming. Override them on the host element or a parent wrapper:Custom Templates
Provide custom templates via inputs to override any visual section:Context Menu for Member Management
Provide context menu options for common member management actions:Accessibility
Keyboard Navigation
| Key | Action |
|---|---|
Enter | Activate the member item (emits itemClick) |
Space | Activate the member item (emits itemClick) |
Shift + F10 | Open the context menu |
ContextMenu | Open the context menu |
ARIA Attributes
role="option"on the item containeraria-selectedreflects the current selection statearia-labelcombines the member name, scope/role, and online/offline status for screen readersaria-hidden="true"on the scope badge (decorative; scope is included in the accessible label)- Proper
tabindexmanagement via roving tabindex pattern
Focus Management
- Visible focus indicator with minimum 3:1 contrast ratio
- Mouse clicks prevent focus outline (focus ring only appears for keyboard navigation)
- Roving tabindex pattern for efficient list navigation
itemFocusoutput enables parent list to track focus position- Scope change control is focusable via Tab
Related Components
- CometChatGroupMembers — Parent list component that renders multiple group member items
- CometChatAvatar — Used internally for the member avatar
- CometChatContextMenu — Used internally for the context menu
- CometChatUserItem — Similar component for rendering user items
- CometChatGroupItem — Similar component for rendering group items