Skip to main content

Where It Fits

CometChatMessageList renders a scrollable, real-time message feed for a user or group conversation. Wire it alongside CometChatMessageHeader and CometChatMessageComposer to build a standard chat view.

Minimal Render

Root CSS class: .cometchat-message-list

Filtering Messages

Pass a CometChat.MessagesRequestBuilder to messagesRequestBuilder. The UID/GUID parameters are always overridden internally based on the user/group prop.

Reactions Request Builder

Refer to MessagesRequestBuilder for the full builder API.

Actions and Events

Callback Props

onThreadRepliesClick

Fires when a threaded message reply count is clicked.

onReactionClick

Fires when a reaction on a message bubble is clicked.

onReactionListItemClick

Fires when a specific reaction in the reaction detail view is clicked.

onError

Fires on internal errors.

Global UI Events

SDK Events (Real-Time, Automatic)

The component listens to these SDK events internally:

Custom View Slots

headerView

Custom view above the message list.

footerView

Custom view below the message list.

templates

Custom message bubble templates via CometChatMessageTemplate.

Date Time Formatting

Customize timestamps using CalendarObject:

Common Patterns

Threaded message list

Hide all chrome — minimal list

Left-aligned messages

AI conversation starters and smart replies


CSS Architecture

The component uses CSS custom properties (design tokens) defined in @cometchat/chat-uikit-react/css-variables.css. The cascade:
  1. Global tokens set on the .cometchat root wrapper.
  2. Component CSS (.cometchat-message-list) consumes these tokens via var().
  3. Overrides target .cometchat-message-list descendant selectors.

Key Selectors

Customization Matrix


Props

All props are optional. Sorted alphabetically.

customSoundForMessages

URL to a custom audio file for incoming message notifications.

disableSoundForMessages

Disables the notification sound for incoming messages.

emptyView

Custom component displayed when there are no messages.

errorView

Custom component displayed when an error occurs.

footerView

Custom component displayed below the message list.

goToMessageId

Scrolls to the specified message on initial load.

group

The group for group conversation messages.

headerView

Custom component displayed above the message list.

hideAvatar

Hides avatars on messages.

hideCopyMessageOption

Hides the copy message option.

hideDateSeparator

Hides date separators between message groups.

hideDeleteMessageOption

Hides the delete message option.

hideEditMessageOption

Hides the edit message option.

hideError

Hides the default and custom error views.

hideFlagMessageOption

Hides the “Report Message” option.

hideFlagRemarkField

Hides the remark text area in the flag message dialog.

hideGroupActionMessages

Hides group action messages (join, leave, kick, etc.).

hideMessageInfoOption

Hides the message info option.

hideMessagePrivatelyOption

Hides the “Message Privately” option.

hideModerationView

Hides the moderation view below moderated messages.

hideReactionOption

Hides the reaction option.

hideReceipts

Hides read/delivery receipt indicators.

hideReplyInThreadOption

Hides the “Reply in Thread” option.

hideReplyOption

Hides the reply option.

hideStickyDate

Hides the sticky date header.

hideTranslateMessageOption

Hides the translate message option.

isAgentChat

Toggles AI Agent functionality for the message list.

loadingView

Custom component displayed during the loading state.

loadLastAgentConversation

Loads the most recent existing agent conversation on mount.

messageAlignment

Controls message alignment.

messageInfoDateTimeFormat

Format for message info timestamps.

messageSentAtDateTimeFormat

Format for message sent-at timestamps.

messagesRequestBuilder

Controls which messages load and in what order. UID/GUID are always overridden internally.

onError

Callback fired when the component encounters an error.

onReactionClick

Callback fired when a reaction on a message is clicked.

onReactionListItemClick

Callback fired when a reaction list item is clicked.

onThreadRepliesClick

Callback fired when a threaded message reply count is clicked.

parentMessageId

Displays threaded conversation for the specified parent message.

quickOptionsCount

Number of message options visible in the main menu before overflow.

reactionsRequestBuilder

Controls how reactions are fetched for messages.

scrollToBottomOnNewMessages

Auto-scrolls to bottom when new messages arrive.

separatorDateTimeFormat

Format for date separator timestamps.

showConversationStarters

Shows AI conversation starters.

showMarkAsUnreadOption

Shows “Mark Unread” option in message actions.

showScrollbar

Shows the scrollbar in the message list.

showSmartReplies

Shows AI smart replies.

smartRepliesDelayDuration

Delay in milliseconds before smart replies appear.

smartRepliesKeywords

Keywords that trigger smart replies.

startFromUnreadMessages

Loads from the first unread message if available.

stickyDateTimeFormat

Format for sticky date header timestamps.

templates

Custom message bubble templates. See CometChatMessageTemplate.

textFormatters

Custom text formatters for message content. See CometChatMentionsFormatter.

user

The user for 1-on-1 conversation messages.

Events


CSS Selectors