CometChatReactionList component displays all users who have reacted to a message. It groups reactions by emoji type and allows filtering by specific emoji, providing a comprehensive view of message reactions with pagination support.
Overview
The Reaction List component provides a detailed view of message reactions:- Emoji Tabs: Filter reactions by specific emoji or view all reactions
- User Display: Shows avatar, name, and reaction emoji for each user
- Current User Highlighting: Highlights the logged-in user’s reactions with removal hint
- Pagination: Automatically loads more reactions when scrolling
- Keyboard Navigation: Full keyboard accessibility for tabs and items
- Click Handling: Emits events when reaction items are clicked (useful for removing own reactions)
- Loading & Error States: Displays appropriate states during data fetching
Live Preview — default reaction list preview.
Open in Storybook ↗
Reaction List Structure
The Reaction List component has a tabbed interface with a scrollable list:Basic Usage
Simple Reaction List
With Custom Reactions Request Builder
API Reference
Properties
| Property | Type | Default | Description |
|---|---|---|---|
message | CometChat.BaseMessage | required | The message to show reactions for |
reactionsRequestBuilder | CometChat.ReactionsRequestBuilder | undefined | Custom reactions request builder for fetching reactions |
Events
| Event | Payload Type | Description |
|---|---|---|
itemClick | { reaction: CometChat.Reaction; message: CometChat.BaseMessage } | Emitted when a reaction item (user) is clicked. Use this to handle reaction removal for the current user. |
empty | void | Emitted when the reaction list becomes empty (all reactions removed) |
Customization
CSS Variables
The Reaction List component uses CSS variables for styling. You can customize its appearance by overriding these variables:Theming
The component automatically adapts to light and dark themes through CSS variables:Custom Reaction List Container
If you need complete control over the reaction list presentation, you can wrap it in a custom container:Accessibility
The Reaction List component is built with accessibility in mind:Keyboard Navigation
| Key | Action |
|---|---|
Tab | Move focus between tabs and reaction items |
ArrowLeft | Move to previous tab |
ArrowRight | Move to next tab |
Home | Move to first tab |
End | Move to last tab |
Enter / Space | Select tab or activate reaction item |
ARIA Attributes
| Element | Attribute | Value | Description |
|---|---|---|---|
| Container | role | "dialog" | Indicates the component is a dialog |
| Container | aria-label | Localized “Reactions” | Describes the dialog purpose |
| Tab list | role | "tablist" | Indicates a tab navigation |
| Tab | role | "tab" | Indicates a tab button |
| Tab | aria-selected | "true" / "false" | Indicates selection state |
| Tab | tabindex | "0" / "-1" | Controls focus order |
| Item list | role | "list" | Indicates a list of items |
| Item | role | "listitem" | Indicates a list item |
| Item | aria-label | Dynamic | Describes user and reaction |
Screen Reader Support
The component provides descriptive labels for screen readers:- Tab labels include emoji and count (e.g., ”👍 3 reactions”)
- Reaction items announce user name and emoji
- Current user items include removal hint
- Loading and error states are announced via
aria-live
Best Practices
Performance Considerations
- Pagination: The component automatically paginates reactions. The default limit is 10 reactions per page.
- Lazy Loading: Reactions are loaded on scroll, reducing initial load time.
- Change Detection: Uses
OnPushchange detection strategy for optimal performance.
UX Recommendations
- Clear Removal Action: When displaying the current user’s reactions, clearly indicate they can click to remove.
- Loading Feedback: Show loading indicators when fetching reactions.
- Error Handling: Provide retry functionality when errors occur.
- Mobile Optimization: Use bottom sheet presentation on mobile devices.
Integration Tips
- Popover Positioning: Position the reaction list near the message for context.
- Dismiss on Outside Click: Close the reaction list when clicking outside.
- Keyboard Escape: Allow closing with the Escape key.
- Real-time Updates: Listen for reaction events to update the list in real-time.
Related Components
- CometChatMessageList - Parent component that displays messages with reactions
- CometChatMessageBubble - Message container with reaction display
- CometChatEmojiKeyboard - Emoji picker for adding reactions
- CometChatPopover - Popover component for displaying reaction list