Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-react-uikit-v7.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
AI Integration Quick Reference
Overview
CometChatMessageList is a scrollable message feed component. It renders messages for a given user or group conversation and emits thread navigation via onThreadRepliesClick. Wire it between CometChatMessageHeader and CometChatMessageComposer to build a standard chat panel.

Live Preview — interact with the default message list.Open in Storybook ↗
The component handles:
- Paginated message fetching with infinite scroll (older messages load on scroll-up)
- Plugin-based bubble rendering — each message type is rendered by a registered plugin
- Reactions with emoji picker and reaction list
- Read/delivery receipts (single and group)
- Thread reply indicators with reply count
- Real-time updates (new messages, edits, deletes, typing indicators)
- Smart replies — AI-generated quick reply suggestions based on incoming messages
- Conversation starters — AI-generated prompts when the conversation is empty
- Date separators and sticky floating date header
- Jump-to-message for search results and deep links
- Mark-as-unread support
Note:userandgroupare mutually exclusive. Pass one or the other to specify the conversation context.
Usage
Flat API
Compound Composition
Full Layout Example
Filtering
Pass aCometChat.MessagesRequestBuilder to messagesRequestBuilder to control which messages load. Pass the builder instance — not the result of .build().
Filter Recipes
| Recipe | Code |
|---|---|
| Only text messages | new CometChat.MessagesRequestBuilder().setTypes(["text"]) |
| Only media | new CometChat.MessagesRequestBuilder().setTypes(["image", "video", "audio", "file"]) |
| Larger page size | new CometChat.MessagesRequestBuilder().setLimit(50) |
| Hide actions | new CometChat.MessagesRequestBuilder().setCategories(["message"]) |
| With tags | new CometChat.MessagesRequestBuilder().setTags(["important"]) |
Actions and Events
Callback Props
| Prop | Signature | Fires when |
|---|---|---|
onThreadRepliesClick | (message: CometChat.BaseMessage) => void | User clicks the thread reply indicator |
onAvatarClick | (user: CometChat.User) => void | User clicks an avatar on an incoming message |
onEditMessage | (message: CometChat.BaseMessage) => void | User selects “Edit” from context menu |
onReplyMessage | (message: CometChat.BaseMessage) => void | User selects “Reply” from context menu |
onReactionClick | (reaction: CometChat.ReactionCount, message: CometChat.BaseMessage) => void | User clicks a reaction count pill |
onReactionListItemClick | (reaction: CometChat.Reaction, message: CometChat.BaseMessage) => void | User clicks an individual reactor in the reaction list |
onActiveChatChanged | (data: { user?, group?, message?, unreadMessageCount? }) => void | Active chat context set on initial load |
onMessageRead | (message: CometChat.BaseMessage) => void | A message is marked as read |
onMessageDeleted | (message: CometChat.BaseMessage) => void | A message is deleted |
onConversationMarkedAsRead | (conversation: CometChat.Conversation) => void | Conversation marked as read |
onConversationUpdated | (conversation: CometChat.Conversation) => void | Conversation updated (e.g., mark-as-unread) |
onError | ((error: CometChat.CometChatException) => void) | null | SDK error occurs |
Events Emitted
UI events this component publishes:| Event | Payload | Fires when |
|---|---|---|
ui:message/read | { message } | Message marked as read (auto on scroll-to-bottom) |
ui:message/deleted | { message } | Message deleted by user via context menu |
ui:active-chat/changed | { user?, group?, message?, unreadMessageCount? } | Active chat context set on initial load |
ui:conversation/read | { conversationId } | Conversation marked as read (on init or scroll-to-bottom) |
ui:conversation/updated | { conversation } | Conversation updated (e.g., mark-as-unread) |
The “Edit” and “Reply” context menu options publish
ui:compose/edit and ui:compose/reply events respectively. These are emitted by the message options system (plugins), not by the MessageList component directly. The MessageComposer subscribes to these events to enter edit/reply mode.Events Received
UI events this component subscribes to (published by other components):| Event | Payload | Behavior |
|---|---|---|
ui:message/sent | { message, status } | Appends sent message (optimistic flow from composer) |
ui:compose/edit | { message, status } | Updates edited message in the list |
ui:group/member-added | { group, members, messages } | Appends group action message |
ui:group/member-kicked | { group, user, message } | Appends group action message |
ui:group/member-banned | { group, user, message } | Appends group action message |
ui:group/member-unbanned | { group, user, message } | Appends group action message |
ui:group/member-scope-changed | { group, user, newScope } | Appends group action message |
ui:group/left | { group } | Appends group action message |
ui:group/ownership-changed | { group } | Appends group action message |
ui:call/outgoing | { call } | Appends call message |
ui:call/accepted | { call } | Appends call message |
ui:call/rejected | { call } | Appends call message |
ui:call/ended | { call? } | Appends call message |
SDK Listeners (Automatic)
These SDK listeners are attached internally. The component updates its state automatically — no manual subscription needed:- Message listeners:
onTextMessageReceived,onMediaMessageReceived,onCustomMessageReceived,onInteractiveMessageReceived - Typing:
onTypingStarted,onTypingEnded - Receipts:
onMessagesDelivered,onMessagesRead,onMessagesDeliveredToAll,onMessagesReadByAll - Edits & deletes:
onMessageEdited,onMessageDeleted - Transient:
onTransientMessageReceived
Customization
View Props
Use view props to replace sections of the default UI while keeping the component’s behavior intact:| Slot | Signature | Replaces |
|---|---|---|
bubbleView | (message, loggedInUser) => ReactNode | Entire bubble rendering for each message |
headerView | ReactNode | Header area above the scroll container |
footerView | ReactNode | Footer area below the scroll container |
loadingView | ReactNode | Loading shimmer |
emptyView | ReactNode | Empty state |
errorView | ReactNode | Error state |
Compound Composition
For full layout control, use sub-components. Omit any sub-component to hide it:| Sub-component | Description | Props | Flat API equivalent |
|---|---|---|---|
Root | Context provider, data hook, container | All Root props + children | — |
View | Scrollable message feed | className | — |
Header | Content above the feed | children, className | headerView |
Footer | Content below the feed | children, className | footerView |
ScrollToBottom | Floating scroll button | className | — |
EmptyState | Empty state | children, className | emptyView |
ErrorState | Error state | children, className | errorView |
LoadingState | Loading shimmer | children, className | loadingView |
DateSeparator | Day separator | className | — |
AIFooter | Smart replies / starters | className | — |
CSS Styling
Override design tokens on the component selector:Props
All props are optional (though you must pass eitheruser or group to render messages).
View slot props (
headerView, searchView, loadingView, emptyView, errorView, itemView, leadingView, titleView, subtitleView, trailingView) are convenience props available only on the flat API. In compound composition mode, use the corresponding sub-components directly.Entity
user
The user entity for a 1-on-1 conversation. Mutually exclusive withgroup.
| Type | CometChat.User |
| Default | undefined |
group
The group entity for a group conversation. Mutually exclusive withuser.
| Type | CometChat.Group |
| Default | undefined |
parentMessageId
Enables thread mode. When set, the component fetches and displays replies to the specified parent message instead of the main conversation feed.| Type | number |
| Default | undefined |
Data
messagesRequestBuilder
Custom request builder for fetching messages. Controls pagination, filtering, and sorting.| Type | CometChat.MessagesRequestBuilder |
| Default | SDK default (limit 30) |
reactionsRequestBuilder
Custom request builder for fetching reactions on messages.| Type | CometChat.ReactionsRequestBuilder |
| Default | undefined |
messageTypes
Restrict which message types are fetched and displayed.| Type | string[] |
| Default | Plugin registry types |
messageCategories
Restrict which message categories are fetched and displayed.| Type | string[] |
| Default | Plugin registry categories |
goToMessageId
Jump to a specific message by ID (e.g., from search results or a deep link). The list scrolls to and highlights the target message.| Type | number |
| Default | undefined |
startFromUnreadMessages
Whentrue, the list scrolls to the first unread message on open instead of the bottom.
| Type | boolean |
| Default | false |
loadLastAgentConversation
Whentrue, loads the last agent conversation on initial render. Used for AI agent chat flows.
| Type | boolean |
| Default | false |
Visibility
hideReceipts
Hide message delivery/read receipts (double ticks) on message bubbles.| Type | boolean |
| Default | false |
hideStickyDate
Hide the sticky date header that floats at the top of the scroll area.| Type | boolean |
| Default | false |
hideDateSeparator
Hide date separators between calendar days in the message feed.| Type | boolean |
| Default | false |
hideAvatar
Hide the avatar on incoming messages in group conversations.| Type | boolean |
| Default | false |
hideGroupActionMessages
Filter out group action messages (member joined, left, kicked, etc.).| Type | boolean |
| Default | false |
hideModerationView
Hide the moderation footer beneath disapproved messages.| Type | boolean |
| Default | false |
showScrollbar
Show the native scrollbar on the message list. Whenfalse, the scrollbar is hidden but scrolling still works.
| Type | boolean |
| Default | false |
showSmartReplies
Show AI-generated smart reply suggestions in the footer when the last received message matches keyword criteria.| Type | boolean |
| Default | false |
showConversationStarters
Show AI-generated conversation starters in the footer when the message list is empty.| Type | boolean |
| Default | false |
showMarkAsUnreadOption
Show the “Mark as Unread” option in the message context menu.| Type | boolean |
| Default | false |
disableTruncation
Disable text truncation (read more / show less) in text bubbles. Whentrue, full message text is always shown.
| Type | boolean |
| Default | false |
isAgentChat
Whether this is an AI agent chat. Suppresses moderation UI and enables agent-specific behaviors.| Type | boolean |
| Default | false |
Option Toggles
hideReplyOption
Hide the “Reply” option from the message context menu.| Type | boolean |
| Default | false |
hideReplyInThreadOption
Hide the “Reply in Thread” option from the message context menu.| Type | boolean |
| Default | false |
hideEditMessageOption
Hide the “Edit” option from the message context menu.| Type | boolean |
| Default | false |
hideDeleteMessageOption
Hide the “Delete” option from the message context menu.| Type | boolean |
| Default | false |
hideCopyMessageOption
Hide the “Copy” option from the message context menu.| Type | boolean |
| Default | false |
hideReactionOption
Hide the “React” option from the message context menu.| Type | boolean |
| Default | false |
hideMessageInfoOption
Hide the “Message Info” option from the message context menu.| Type | boolean |
| Default | false |
hideFlagMessageOption
Hide the “Flag/Report” option from the message context menu.| Type | boolean |
| Default | false |
hideMessagePrivatelyOption
Hide the “Message Privately” option from the message context menu.| Type | boolean |
| Default | false |
hideTranslateMessageOption
Hide the “Translate” option from the message context menu.| Type | boolean |
| Default | false |
hideFlagRemarkField
Hide the remark textarea in the flag/report message dialog.| Type | boolean |
| Default | false |
quickOptionsCount
Number of quick-action options shown inline next to the bubble before overflowing into the “More” menu.| Type | number |
| Default | 3 |
Date Formatting
separatorDateTimeFormat
Custom date format for in-list day separators (“Today”, “Yesterday”, etc.).| Type | CometChatDateFormatConfig |
| Default | Built-in format |
stickyDateTimeFormat
Custom date format for the sticky date header floating above messages.| Type | CometChatDateFormatConfig |
| Default | Built-in format |
messageSentAtDateTimeFormat
Custom date format for the timestamp shown beside the message bubble.| Type | CometChatDateFormatConfig |
| Default | Built-in format |
messageInfoDateTimeFormat
Custom date format for timestamps in the MessageInformation sheet.| Type | CometChatDateFormatConfig |
| Default | Built-in format |
Alignment
messageAlignment
Controls message bubble alignment.0 aligns all messages to the left. 1 uses standard alignment (sent on right, received on left).
| Type | CometChatMessageListAlignment |
| Default | 1 (standard) |
Sound
disableSoundForMessages
Disable the notification sound when new messages arrive.| Type | boolean |
| Default | false |
customSoundForMessages
Custom sound URL to play when new messages arrive (replaces the built-in sound).| Type | string |
| Default | Built-in notification sound |
AI Features
smartRepliesKeywords
Keywords that trigger smart replies when found in a received text message. If set to an empty array, smart replies show for every received text message.| Type | string[] |
| Default | ['what', 'when', 'why', 'who', 'where', 'how', '?'] |
smartRepliesDelayDuration
Delay in milliseconds before showing smart replies after a qualifying message is received. Acts as a debounce — if another message arrives within this window, the timer resets.| Type | number |
| Default | 10000 |
Callbacks
onThreadRepliesClick
Callback when the thread reply indicator is clicked on a message bubble.| Type | (message: CometChat.BaseMessage) => void |
| Default | undefined |
onAvatarClick
Callback when an incoming message avatar is clicked.| Type | (user: CometChat.User) => void |
| Default | undefined |
onEditMessage
Callback when the “Edit” context menu option is clicked. Typically sets the message in edit mode in the composer.| Type | (message: CometChat.BaseMessage) => void |
| Default | undefined |
onReplyMessage
Callback when the “Reply” context menu option is clicked. Typically sets the message as reply-to in the composer.| Type | (message: CometChat.BaseMessage) => void |
| Default | undefined |
onReactionClick
Callback when a reaction count pill is clicked on a message.| Type | (reaction: CometChat.ReactionCount, message: CometChat.BaseMessage) => void |
| Default | undefined |
onReactionListItemClick
Callback when an individual reactor in the reaction list is clicked.| Type | (reaction: CometChat.Reaction, message: CometChat.BaseMessage) => void |
| Default | undefined |
onActiveChatChanged
Callback invoked on first load with the active chat context (user/group, last message, unread count).| Type | (data: { user?, group?, message?, unreadMessageCount? }) => void |
| Default | undefined |
onMessageRead
Callback when a message is marked as read.| Type | (message: CometChat.BaseMessage) => void |
| Default | undefined |
onMessageDeleted
Callback when a message is deleted.| Type | (message: CometChat.BaseMessage) => void |
| Default | undefined |
onConversationMarkedAsRead
Callback when the conversation is marked as read.| Type | (conversation: CometChat.Conversation) => void |
| Default | undefined |
onConversationUpdated
Callback when mark-as-unread succeeds (conversation updated).| Type | (conversation: CometChat.Conversation) => void |
| Default | undefined |
onError
Callback when an SDK error occurs during fetch or real-time operations.| Type | ((error: CometChat.CometChatException) => void) | null |
| Default | null |
View Slots
bubbleView
Replace the entire bubble rendering for each message. When provided, the default plugin-based BubbleRenderer is skipped entirely.| Type | (message: CometChat.BaseMessage, loggedInUser: CometChat.User) => ReactNode |
| Default | undefined |
headerView
Custom content rendered above the scroll container (e.g., typing indicator, pinned message).| Type | ReactNode |
| Default | undefined |
footerView
Custom content rendered below the scroll container (e.g., smart replies bar).| Type | ReactNode |
| Default | undefined |
loadingView
Custom loading state shown while messages are being fetched.| Type | ReactNode |
| Default | Built-in shimmer |
emptyView
Custom empty state shown when there are no messages in the conversation.| Type | ReactNode |
| Default | Built-in empty state |
errorView
Custom error state shown when message fetching fails.| Type | ReactNode |
| Default | Built-in error state |
CSS Selectors
| Target | Selector |
|---|---|
| Root container | .cometchat-message-list |
| Header area | .cometchat-message-list__header |
| Footer area | .cometchat-message-list__footer |
| Scroll container | .cometchat-message-list__scroll-container |
| Date separator | .cometchat-message-list__date-separator |
| Floating sticky date | .cometchat-message-list__floating-date |
| New message divider | .cometchat-message-list__new-message-divider |
| Scroll-to-bottom button | .cometchat-message-list__scroll-to-bottom |
| Empty state | .cometchat-message-list__empty-state |
| Error state | .cometchat-message-list__error-state |
| Loading state | .cometchat-message-list__loading-state |
Next Steps
Message Composer
Add a composer below the message list for sending messages
Thread Header
Display thread context above a threaded message list
Plugins Overview
Learn how plugins register custom bubble renderers
Theming
Customize colors, fonts, and spacing