CometChatMessageList component displays a scrollable list of messages in a conversation. It supports text messages, media messages, reactions, threads, and real-time updates for new messages, edits, and deletions.

AI Agent Component Spec
AI Agent Component Spec
Where It Fits
CometChatMessageList is the core component for displaying messages in a chat. It’s typically used within CometChatMessages alongside CometChatMessageHeader and CometChatMessageComposer.

Minimal Render

Filtering
UseMessagesRequest.MessageRequestBuilder to filter which messages appear in the list. The builder pattern allows chaining multiple filter conditions.
Filter Recipes
| Recipe | Code |
|---|---|
| Text messages only | .set(types: ["text"]) |
| Media messages only | .set(types: ["image", "video", "audio", "file"]) |
| Search by keyword | .set(searchKeyword: "hello") |
| Limit results | .set(limit: 50) |
| Messages after timestamp | .set(timestamp: 1234567890) |
| Hide deleted messages | .hideDeletedMessages(true) |
| Specific categories | .set(categories: ["message", "custom"]) |
Actions and Events
Callback Props
onThreadRepliesClick
Fires when a user taps on the thread indicator of a message bubble.onReactionClick
Fires when a user taps on a reaction on a message bubble.onReactionListItemClick
Fires when a user taps on a specific reaction in the reaction list.onError
Fires when an error occurs while loading messages.onEmpty
Fires when the message list is empty.onLoad
Fires when messages are successfully loaded.Actions Reference
| Method | Description | Example |
|---|---|---|
set(onThreadRepliesClick:) | Triggered when thread indicator is tapped | Open thread view |
set(onReactionClick:) | Triggered when a reaction is tapped | Show reaction details |
set(onReactionListItemClick:) | Triggered when reaction list item is tapped | Show who reacted |
set(onError:) | Triggered when an error occurs | Show error alert |
set(onEmpty:) | Triggered when list is empty | Show empty state |
set(onLoad:) | Triggered when messages load | Analytics tracking |
scrollToBottom(isAnimated:) | Scrolls to the bottom of the list | Navigate to latest |
goToMessage(withId:) | Scrolls to a specific message | Jump to message |
SDK Events (Real-Time, Automatic)
| SDK Listener | Internal behavior |
|---|---|
onMessageReceived | Adds new message to the list |
onMessageEdited | Updates the edited message in place |
onMessageDeleted | Removes or marks message as deleted |
onTypingStarted | Shows typing indicator |
onTypingEnded | Hides typing indicator |
onMessageReactionAdded | Updates reaction count on message |
onMessageReactionRemoved | Updates reaction count on message |
Custom View Slots
| Slot | Signature | Replaces |
|---|---|---|
headerView | () -> UIView | Header above message list |
footerView | () -> UIView | Footer below message list |
emptyStateView | () -> UIView | Empty state display |
errorStateView | () -> UIView | Error state display |
loadingStateView | () -> UIView | Loading state display |
newMessageIndicatorView | () -> UIView | New message indicator |
headerView
Add a custom header above the message list.footerView
Add a custom footer below the message list.emptyStateView
Customize the view shown when there are no messages.loadingStateView
Customize the loading indicator.errorStateView
Customize the error state view.newMessageIndicatorView
Set a custom view for the unread message indicator.Text Formatters
Customize how text is displayed in messages using text formatters.Styling
Style Hierarchy
- Global styles (
CometChatMessageList.style) apply to all instances - Instance styles override global for specific instances
Global Level Styling
Instance Level Styling

Key Style Properties
| Property | Type | Default | Description |
|---|---|---|---|
backgroundColor | UIColor | CometChatTheme.backgroundColor01 | Background color of the list |
borderWidth | CGFloat | 0 | Border width for the component |
borderColor | UIColor | .clear | Border color for the component |
cornerRadius | CometChatCornerStyle? | nil | Corner radius for the component |
shimmerGradientColor1 | UIColor | CometChatTheme.backgroundColor04 | First shimmer gradient color |
shimmerGradientColor2 | UIColor | CometChatTheme.backgroundColor03 | Second shimmer gradient color |
emptyStateTitleColor | UIColor | CometChatTheme.textColorPrimary | Empty state title color |
emptyStateTitleFont | UIFont | CometChatTypography.Heading3.bold | Empty state title font |
emptyStateSubtitleColor | UIColor | CometChatTheme.textColorSecondary | Empty state subtitle color |
emptyStateSubtitleFont | UIFont | CometChatTypography.Body.regular | Empty state subtitle font |
errorStateTitleColor | UIColor | CometChatTheme.textColorPrimary | Error state title color |
errorStateTitleFont | UIFont | CometChatTypography.Heading3.bold | Error state title font |
newMessageIndicatorTextColor | UIColor? | nil | New message indicator text color |
newMessageIndicatorBackgroundColor | UIColor? | nil | New message indicator background |
Customization Matrix
| What to change | Where | Property/API | Example |
|---|---|---|---|
| Background color | Style | backgroundColor | UIColor.systemBackground |
| Empty state text | Style | emptyStateTitleColor, emptyStateTitleFont | Custom colors and fonts |
| Error state text | Style | errorStateTitleColor, errorStateTitleFont | Custom colors and fonts |
| Loading shimmer | Style | shimmerGradientColor1, shimmerGradientColor2 | Custom gradient colors |
| Outgoing bubble | Style | messageBubbleStyle.outgoing | UIColor.systemBlue |
| Incoming bubble | Style | messageBubbleStyle.incoming | UIColor.systemGray5 |
| Hide avatars | Property | hideAvatar | messageList.hideAvatar = true |
| Hide receipts | Property | hideReceipts | messageList.hideReceipts = true |
| Custom header | View Slot | set(headerView:) | See Custom View Slots section |
Props
All props are optional. Sorted alphabetically.disableSoundForMessages
Disables notification sounds for new messages.| Type | Bool |
| Default | false |
hideAvatar
Hides the sender’s avatar in message bubbles.| Type | Bool |
| Default | false |
hideCopyMessageOption
Hides the copy message option in message actions.| Type | Bool |
| Default | false |
hideDateSeparator
Hides the date separator between messages.| Type | Bool |
| Default | false |
hideDeleteMessageOption
Hides the delete message option in message actions.| Type | Bool |
| Default | false |
hideEditMessageOption
Hides the edit message option in message actions.| Type | Bool |
| Default | false |
hideEmptyView
Hides the empty state view when no messages are available.| Type | Bool |
| Default | false |
hideErrorView
Hides the error view when an error occurs.| Type | Bool |
| Default | false |
hideFooterView
Hides the footer view of the message list.| Type | Bool |
| Default | false |
hideGroupActionMessages
Hides group action messages (join/leave notifications).| Type | Bool |
| Default | false |
hideHeaderView
Hides the header view of the message list.| Type | Bool |
| Default | false |
hideLoadingView
Hides the loading view when fetching messages.| Type | Bool |
| Default | false |
hideMessageInfoOption
Hides the message info option in message actions.| Type | Bool |
| Default | false |
hideMessagePrivatelyOption
Hides the option to message privately.| Type | Bool |
| Default | false |
hideNewMessageIndicator
Hides the new message indicator.| Type | Bool |
| Default | false |
hideReactionOption
Hides the reaction option on messages.| Type | Bool |
| Default | false |
hideReceipts
Hides message read receipts (ticks).| Type | Bool |
| Default | false |
hideReplyInThreadOption
Hides the reply in thread option.| Type | Bool |
| Default | false |
hideTranslateMessageOption
Hides the message translation option.| Type | Bool |
| Default | false |
messageAlignment
Sets the alignment of messages in the list.| Type | MessageAlignment |
| Default | .standard |
messagesRequestBuilder
Custom request builder for filtering messages.| Type | MessagesRequest.MessageRequestBuilder? |
| Default | nil |
reactionsRequestBuilder
Custom request builder for fetching reactions.| Type | ReactionsRequest.ReactionsRequestBuilder? |
| Default | nil |
scrollToBottomOnNewMessages
Automatically scrolls to bottom when new messages arrive.| Type | Bool |
| Default | true |
showMarkAsUnreadOption
Shows the “Mark as unread” option in message actions.| Type | Bool |
| Default | false |
startFromUnreadMessages
Starts the message list from the first unread message.| Type | Bool |
| Default | false |
textFormatters
Array of text formatters for customizing message text display.| Type | [CometChatTextFormatter] |
| Default | [] |
Events
The MessageList component does not emit any global UI events. It relies on SDK listeners for real-time updates.Date Time Formatter
Customize how timestamps appear in the message list using theCometChatDateTimeFormatter.
Global Level Formatting
Instance Level Formatting
Date Separator Pattern
Available Formatters
| Formatter | Purpose | Default Format |
|---|---|---|
time | Standard time display | h:mm a |
today | Messages sent today | Today |
yesterday | Messages from yesterday | Yesterday |
lastweek | Messages within last week | Day name |
otherDay | Older messages | MMM d, yyyy |
datePattern | Custom date pattern | Configurable |
timePattern | Custom time pattern | Configurable |
dateSeparatorPattern | Date separator between messages | Configurable |
Troubleshooting
| Issue | Solution |
|---|---|
| Messages not loading | Ensure user/group is set and SDK is initialized |
| Real-time updates not working | Check SDK connection status and listeners |
| Reactions not showing | Verify reactions are enabled in dashboard |
| Thread replies not working | Ensure hideReplyInThreadOption is not set to true |
| Custom views not appearing | Ensure custom view has proper constraints and non-zero frame |
| Scroll position issues | Check scrollToBottomOnNewMessages setting |
Related Components
- Messages - Parent component containing MessageList
- Message Composer - Send messages in a conversation
- Message Header - Display user/group details
- Message Template - Create custom message bubble templates
- Threaded Messages - Display threaded conversations