Skip to main content
The 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 uses ChatStateService to automatically receive the parent message context. Alternatively, you can pass data explicitly via @Input() bindings.
When a thread is opened via the message list, ChatStateService stores the active thread’s parent message. cometchat-thread-header automatically subscribes to this state — no explicit [parentMessage] binding required.
See the ChatStateService API reference for the full list of signals, observables, and setter methods.
This is the recommended approach for most applications. It reduces boilerplate and keeps components in sync automatically.

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:
  1. enableThreadSubscription: true is provided through COMETCHAT_GLOBAL_CONFIG — the feature is off by default
  2. The installed Chat SDK exposes the thread API
  3. hideThreadSubscriptionToggle is false
  4. 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.
The control stays enabled in every state, including an unknown one — a disabled control on a deep-linked thread is a dead end, and following something you already follow is idempotent server-side. See the Thread Subscription guide for the full feature.

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-label combines 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-pressed for 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: high with stronger borders and focus outlines
  • Supports prefers-reduced-motion: reduce by disabling button transitions