CometChatThreadHeader component displays a header bar for threaded message views. It shows a truncated preview of the parent message, the reply count, and a close button to return to the main chat. Media parent messages display an appropriate icon (image, video, audio, file).
Overview
The Thread Header component provides:- Parent Message Preview: Truncated text preview of the parent message (max 50 characters)
- Media Icons: Displays type-specific icons for image, video, audio, and file messages
- Reply Count: Shows the number of replies with singular/plural localization
- Close Button: Returns the user to the main chat view
- Follow / Unfollow Control: An icon-only bell that subscribes the user to the thread’s replies, when the feature is enabled
- Keyboard Navigation: Supports Tab, Enter, Space, and Escape key interactions
- Full ARIA Support: Includes
role="banner", descriptive labels, and accessible close button
Live Preview — default thread header preview.
Open in Storybook ↗
Basic Usage
Simple Thread Header
Usage Patterns
CometChatThreadHeader supports two usage patterns. The default service-based approach usesChatStateService to automatically receive the parent message context. Alternatively, you can
pass data explicitly via @Input() bindings.
- Using Service
- Using Props
When a thread is opened via the message list, See the ChatStateService API reference for the full list of signals, observables, and setter methods.
ChatStateService stores the active thread’s parent message. cometchat-thread-header automatically subscribes to this state — no explicit [parentMessage] binding required.Thread Subscription
When thread subscription is enabled, the header’s top bar carries an icon-only bell that follows or unfollows the thread. Following opts the user into notifications for the thread’s replies; it is per-user and changes nothing anyone else sees. The control renders only when all of the following hold:enableThreadSubscription: trueis provided throughCOMETCHAT_GLOBAL_CONFIG— the feature is off by default- The installed Chat SDK exposes the thread API
hideThreadSubscriptionToggleisfalse- The server has not reported the thread as deleted or off-limits
The control carries the same two labels as the action-sheet option in
cometchat-message-list — “Subscribe to thread” / “Unsubscribe from thread” — so the action reads alike wherever it is invoked. Override both through the thread_subscription_subscribe and thread_subscription_unsubscribe keys.Properties
Events
Customization
CSS Variables
The Thread Header component uses BEM-style CSS classes with CSS variable overrides:Both subscription states share the same neutral icon color — the slash through the bell is what distinguishes them, not a tint. State is also carried by
aria-label and aria-pressed, so nothing rests on color alone.Responsive Behavior
The component adapts across breakpoints with dedicated CSS variables for tablet (max-width: 991px), mobile (max-width: 767px), and small mobile (max-width: 575px) — reducing padding, font sizes, and icon dimensions at smaller widths.
Accessibility
Keyboard Navigation
- Tab: Moves focus through the follow control and the close button
- Enter / Space: Activates the focused control
- Escape: Closes the thread from anywhere within the header (via
@HostListener)
Screen Reader Support
- The header uses
role="banner"for landmark navigation - An
aria-labelcombines the parent message preview and reply count for context - The close button has a dedicated
aria-label(e.g., “Close thread”) - The follow control exposes
aria-pressedfor its state, and its tooltip and accessible name are the same string, so a voice-control user can say what the tooltip showed them (WCAG 2.5.3) - Toggling announces the resulting state through a live region, rather than re-reading the button label — the label names the next action, which reads backwards once the state has changed
High Contrast & Reduced Motion
- Supports
prefers-contrast: highwith stronger borders and focus outlines - Supports
prefers-reduced-motion: reduceby disabling button transitions
Related
- Thread Subscription - Following and unfollowing threads, end to end
- Threaded Messages - Building the thread view itself
- CometChatMessageList - Displays messages within the thread
- CometChatMessageBubble - Renders individual messages in the thread