AI Integration Quick Reference
AI Integration Quick Reference
Where It Fits
CometChatReactionList is a standalone component — it manages its own state and does not depend on CometChatReactions.Root context. It is distinct from CometChatReactions.List, which is a sub-component of CometChatReactions.
Live Preview — interact with the reaction list component.Open in Storybook ↗
Use
CometChatReactionList when you want to show a dedicated panel (e.g., inside a popover or bottom sheet) listing all users who reacted to a message, with tab filtering by emoji and the ability for the current user to remove their own reaction.
The parent component (typically CometChatMessageList) owns the SDK reaction add/remove calls and passes an updated message prop when reactions change.
Minimal Render
.cometchat-reaction-list
Sub-Components
CometChatReactionList is a compound component with these sub-components:
Custom Layout
Compose sub-components to customize the layout:Custom Header
Add a custom header above the tabs:Actions and Events
Callback Props
onItemClick
Called when a reaction item is clicked. Only fires for the current user’s own reactions — non-current-user items are read-only. The parent should call the SDK to remove the reaction.onEmpty
Called when all reactions are removed (after optimistic removal). The parent should close the panel.onError
Called when an error occurs during reaction fetching.Behavior Details
Emoji Tabs
- “All” tab shows every reactor across all emojis.
- Per-emoji tabs show only reactors for that emoji.
- Tab counts update optimistically when the current user removes a reaction.
- Keyboard navigation:
ArrowLeft/ArrowRightto move between tabs,Enter/Spaceto select.
Reactor Items
- Each item shows: avatar, name (or “You” for the current user), “Click to remove” hint (current user only), and the emoji.
- Current user items:
cursor: pointer,tabIndex={0}, clickable viaEnter/Space. - Non-current-user items:
cursor: default,tabIndex={-1}, not interactive.
Pagination
Reactions are fetched in pages (default limit: 30). AnIntersectionObserver sentinel at the bottom of the list triggers fetchMore() when the user scrolls near the bottom.
Optimistic Removal
When the current user clicks their reaction:- The reaction is removed from the list immediately (optimistic update).
onItemClickis called so the parent can call the SDK.- If no reactions remain,
onEmptyis called.
Custom Request Builder
Pass a customReactionsRequestBuilder to control the fetch limit or other parameters:
CSS Architecture
The component uses CSS custom properties provided by the UI Kit.Key Selectors
Example: Custom styling
App.css
Props
All props are optional unless noted otherwise.message
The SDK message object to show reactions for. Required.reactionsRequestBuilder
Custom request builder for fetching reactor details. Controls limit and other fetch parameters.onItemClick
Called when the current user clicks their own reaction item (to remove it). Not called for other users’ reactions.onEmpty
Called when all reactions are removed. The parent should close the panel.onError
Error callback for reaction fetching failures.children
Custom sub-components. When omitted, renders the default layout (Tabs + LoadingState + ErrorState + EmptyState + Items).className
Optional custom CSS class for the root container.Accessibility
- Root has
role="dialog"andaria-label="Reaction list". - Tab bar has
role="tablist"witharia-label="Reaction filters". - Each tab has
role="tab"andaria-selected. - Items container has
role="list"with a descriptivearia-label. - Each item has
role="listitem"andaria-labeldescribing the user, emoji, and hint. - Current user items have
tabIndex={0}and respond toEnter/Space. - Read-only items have
tabIndex={-1}. - All interactive elements have
:focus-visiblestyles. - Shimmer respects
prefers-reduced-motion. - Spinner respects
prefers-reduced-motion. - High contrast mode supported via
@media (prefers-contrast: high).