AI Integration Quick Reference
AI Integration Quick Reference
Overview
CometChatThreadHeader displays the parent message bubble and reply count for threaded conversations. It renders a top bar with the thread title, sender name, and close button, followed by the parent message bubble and a real-time reply count divider. Wire it above a CometChatMessageList (with parentMessageId) and CometChatMessageComposer to build a complete thread view.
Live Preview — interact with the default thread header.Open in Storybook ↗
The component handles:
- Rendering the parent message as a bubble
- Real-time reply count updates via SDK listeners
- Parent message edit/delete detection
- A thread subscription (subscribe/unsubscribe) bell for group threads
- Close button and keyboard (Escape) dismissal
Usage
Flat API
Compound Composition
Full Layout Example
Filtering
This component does not support request builders or filtering. It renders a single parent message and its reply count.Actions and Events
Callback Props
Events Emitted
This component does not emit UI events.Events Received
UI events this component subscribes to (published by other components):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— increments reply count when other users send replies - Edits:
onMessageEdited— updates parent bubble when edited by another user - Deletes:
onMessageDeleted— triggersonParentDeletedwhen deleted by another user
Customization
View Props
Use view props to replace sections of the default UI while keeping the component’s behavior intact:messageBubbleView
Replace the parent message bubble with a custom view.Compound Composition
For full layout control, use sub-components. Omit any sub-component to hide it:Thread Subscription
In a group thread, the header shows a bell that lets the user subscribe to or unsubscribe from the thread, so they can receive updates about new replies even when they aren’t actively viewing it. The bell reflects the current subscription state and toggles it on click, with an optimistic UI update and a toast on failure. The bell renders automatically for group threads. It never appears in a 1:1 thread. To remove it, sethideThreadSubscriptionToggle; to react to changes, pass onThreadSubscriptionChange.
The same subscribe/unsubscribe action is also available as a message-context-menu option in
CometChatMessageList (hideThreadSubscriptionOption). For the underlying hook and events, see Threaded Messages → Thread Subscription.CSS Styling
Override design tokens on the component selector:Props
parentMessage is required. All other props are optional.
View slot props (
headerView, messageBubbleView, subtitleView) are convenience props available only on the flat API. In compound composition mode, use the corresponding sub-components directly.parentMessage
The parent message of the thread. Required.hideReceipts
Hide message delivery/read receipts on the parent bubble.hideDate
Hide the date chip shown above the parent bubble.hideReplyCount
Hide the reply count section below the parent bubble.hideThreadSubscriptionToggle
Hide the subscribe/unsubscribe (subscription) bell. The bell only renders for group threads to begin with — it never shows in a 1:1 thread.separatorDateTimeFormat
Custom date/time format for the date chip shown above the parent bubble.messageSentAtDateTimeFormat
Custom date/time format for the sent-at timestamp on the parent message bubble.showScrollbar
Show the native scrollbar on the bubble wrapper area.onClose
Callback when the close button is clicked or Escape is pressed.onSubtitleClicked
Callback when the sender name / subtitle is clicked (navigate to parent in main list).onParentDeleted
Callback when the parent message is deleted (thread should close).onThreadSubscriptionChange
Callback when the user subscribes to or unsubscribes from the thread via the subscription bell. Receives the new subscription state.onError
Callback when an SDK error occurs.headerView
Custom content to replace the entire top bar (title + sender name + close button).messageBubbleView
Custom content to replace the parent message bubble rendering.subtitleView
Custom subtitle view below the title.CSS Selectors
Next Steps
Message List
Display threaded replies below the parent message
Message Composer
Compose replies in the thread
Theming
Customize colors, fonts, and spacing