Skip to main content
Version: v4

Message Header

This component contains relevant information relevant to the chat conversation.

It includes the following elements and functionalities:

  1. User or Group Information: This displays name of the user or the group with whom the user is conversing. It indicates the online presence of the user showing a green dot. It also includes the avatar of the user or the group. It also displays the number of participants in case of a group.
  2. Typing events: Typing events appear as a "typing" indicator next to the name or profile picture of the person who is typing. The indicator takes an ellipsis ("...") form.
  3. Menu: It includes various actions related to the chat like buttons viewing the additional information or starting a video call.

Properties

Chat Information

Details associated with a chat conversation or chat participants.

NameTypeDescription
userUser ClassView details of this particular CometChat user
groupGroup ClassView details of this particular CometChat group

Asset URLs

Custom asset URL used for graphical representation

NameTypeDescription
backButtonIconURLstringAsset URL for the back button
privateGroupIconstringAsset URL for the icon representing private groups
protectedGroupIconstringAsset URL for the icon representing password protected groups

Custom view

UI component created and customised by the developer to meet your design or functional requirements.

NameTypeDescription
subtitleViewFunction as PropType<(user?: CometChat.User, group?: CometChat.Group) => ViewType>User-defined component to customise the secondary text shown in the default user profile.
listItemViewFunction as PropType<(user?: CometChat.User, group?: CometChat.Group) => ViewType>User-defined component to customise user profile view.

Actions

UI component created and customised by the developer to meet your design or functional requirements representing the chat actions.

NameTypeDescription
menuviewUser-defined component to showcase options related to the chat like buttons viewing the additional information or starting a video call.

Toggle

Switch to hide or show the default user profile.

NameTypeDescription
hideBackButtonbooleanWhen set to true, will hide the back button
disableTypingbooleanWhen set to true, Users will not be able to see if the chat participants are actively composing a response.
disableUsersPresencebooleanWhen set to true, Users will not be able to see whether a particular user is currently online or offline.

Function callbacks

NameTypeDescription
onBackFunction as PropType<() => void>Override the method that is invoked when when user clicks on the back button.
onErrorFunction as PropType<(error: CometChat.CometChatException) => void>Override the method that is invoked when an error is encountered within the component

Style

Styling properties and values of all the child components

NameTypeDescription
avatarStyleAvatarStyleStyling properties and values of the Avatar component
statusIndicatorStyleStatusIndicatorStyling properties and values of the StatusIndicator component
listItemStyleListItemStyleStyling properties and values of the ListItem component
messageHeaderStyleMessageHeaderStyleStyling properties and values of the MessageHeader component

Usage

//Group with guid=hello_group
const GUID = "hello_group";
const groupName = "Hello Group!";
const groupType = CometChat.GROUP_TYPE.PUBLIC;
const password = "";

var group = new CometChat.Group(GUID, groupName, groupType, password);

//Pass the user object to the details component
<CometChatMessageHeader :group="group"></CometChatMessageHeader>