Overview
MessageList is a Composite Component that displays a list of messages and effectively manages real-time operations. It includes various types of messages such as Text Messages, Media Messages, Stickers, and more.
MessageList is primarily a list of the base component MessageBubble. The MessageBubble Component is utilized to create different types of chat bubbles depending on the message type.
Usage
Integration
The following code snippet illustrates how you can directly incorporate the MessageList component into your Application.
MessageListDemo.tsx
App.tsx
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
/>
</div>
) : null;
}
To fetch messages for a specific entity, you need to supplement it with User or Group Object.
Actions
Actions dictate how a component functions. They are divided into two types: Predefined and User-defined. You can override either type, allowing you to tailor the behavior of the component to fit your specific needs.
1. onThreadRepliesClick
onThreadRepliesClick is triggered when you click on the threaded message bubble. The onThreadRepliesClick action doesn’t have a predefined behavior. You can override this action using the following code snippet.
MessageListDemo.tsximport React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
const getOnThreadRepliesClick = () => {
//your custom actions
}
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
onThreadRepliesClick={getOnThreadRepliesClick}
/>
</div>
) : null;
}
2. onError
This action doesn’t change the behavior of the component but rather listens for any errors that occur in the MessageList component.
MessageListDemo.tsx
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
function handleError(error: CometChat.CometChatException) {
throw new Error("your custom error action");
}
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
onError={handleError}
/>
</div>
) : null;
}
Filters
You can adjust the MessagesRequestBuilder in the MessageList Component to customize your message list. Numerous options are available to alter the builder to meet your specific needs. For additional details on MessagesRequestBuilder, please visit MessagesRequestBuilder.
In the example below, we are applying a filter to the messages based on a search substring and for a specific user. This means that only messages that contain the search term and are associated with the specified user will be displayed
MessageListDemo.tsx
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
messagesRequestBuilder={new CometChat.MessagesRequestBuilder().setLimit(5)}
/>
</div>
) : null;
}
The following parameters in messageRequestBuilder will always be altered inside the message list
- UID
- GUID
Events
Events are emitted by a Component. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
The list of events emitted by the Message List component is as follows.
| Event | Description |
|---|
| ccOpenChat | this event alerts the listeners if the logged-in user has opened a user or a group chat |
| ccMessageEdited | Triggers whenever a loggedIn user edits any message from the list of messages .it will have three states such as: inProgress, success and error |
| ccMessageDeleted | Triggers whenever a loggedIn user deletes any message from the list of messages |
| ccActiveChatChanged | This event is triggered when the user navigates to a particular chat window. |
| ccMessageRead | Triggers whenever a loggedIn user reads any message. |
| ccLiveReaction | Triggers whenever a loggedIn clicks on live reaction |
Adding CometChatMessageEvents Listener’s
mport {CometChatMessageEvents, CometChatUIEvents} from "@cometchat/chat-uikit-react";
const ccOpenChat = CometChatUIEvents.ccOpenChat.subscribe(
() => {
// Your Code
}
);
const ccMessageEdited = CometChatMessageEvents.ccMessageEdited.subscribe(
() => {
// Your Code
}
);
const ccMessageDeleted = CometChatMessageEvents.ccMessageDeleted.subscribe(
() => {
// Your Code
}
);
const ccActiveChatChanged = CometChatUIEvents.ccActiveChatChanged.subscribe(
() => {
// Your Code
}
);
const ccMessageRead = CometChatMessageEvents.ccMessageRead.subscribe(
() => {
// Your Code
}
);
const ccLiveReaction = CometChatMessageEvents.ccLiveReaction.subscribe(
() => {
// Your Code
}
);
Removing CometChatMessageEvents Listener’s
ccMessageEdited?.unsubscribe();
ccActiveChatChanged?.unsubscribe();
Customization
To fit your app’s design requirements, you can customize the appearance of the Message List component. We provide exposed properties that allow you to modify the experience and behavior according to your specific needs.
Style
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
1. MessageList Style
You can set the MessageListStyle to the MessageList Component Component to customize the styling.
MessageListDemo.tsx
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList, MessageListStyle } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
const messageListStyle = new MessageListStyle({
background:"transparent",
border:"1px solid black",
borderRadius:"20px",
height:"100%",
width:"100%",
loadingIconTint:"red",
nameTextColor:"pink",
threadReplyTextColor:"green"
});
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
messageListStyle={messageListStyle}
/>
</div>
) : null;
}
List of properties exposed by MessageListStyle
| Property | Description | Code |
|---|
| border | Used to set border | border?: string, |
| borderRadius | Used to set border radius | borderRadius?: string; |
| background | Used to set background colour | background?: string; |
| height | Used to set height | height?: string; |
| width | Used to set width | width?: string; |
| loadingIconTint | used to set loading icon tint | loadingIconTint?: string; |
| emptyStateTextFont | used to set empty state text font | emptyStateTextFont?: string; |
| errorStateTextFont | used to set error state text font | errorStateTextFont?: string; |
| emptyStateTextColor | used to set empty state text color | emptyStateTextColor?: string; |
| errorStateTextColor | used to set error state text color | errorStateTextColor?: string; |
| nameTextColor | used to set sender/receiver name text color on a message bubble. | nameTextColor?: string; |
| nameTextFont | used to set sender/receiver name text font on a message bubble | nameTextFont?: string; |
| TimestampTextColor | used to set time stamp text color | TimestampTextColor?: string; |
| TimestampTextFont | used to set time stamp text font | TimestampTextFont?: string; |
| threadReplyTextColor | used to set thread reply text color | threadReplyTextColor?: string; |
| threadReplyTextFont | used to set thread reply text font | threadReplyTextFont?: string; |
| threadReplyIconTint | used to set thread reply icon tint | threadReplyIconTint?: string; |
| threadReplyUnreadTextColor | used to set thread reply unread text color | threadReplyUnreadTextColor?: string; |
| threadReplyUnreadTextFont | used to set thread reply unread text font | threadReplyUnreadTextFont?: string; |
| threadReplyUnreadBackground | used to set thread reply unread background | threadReplyUnreadBackground?: string; |
2. Avatar Style
To apply customized styles to the Avatar component in the Message List Component, you can use the following code snippet. For further insights on Avatar Styles refer
MessageListDemo.tsximport React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList, AvatarStyle } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
const avatarStyle = new AvatarStyle({
backgroundColor:"#cdc2ff",
border:"2px solid #6745ff",
borderRadius:"10px",
outerViewBorderColor:"#ca45ff",
outerViewBorderRadius:"5px",
nameTextColor:"#4554ff"
})
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
avatarStyle={avatarStyle}
/>
</div>
) : null;
}
3. DateSeparator Style
To apply customized styles to the DateSeparator in the Message list Component, you can use the following code snippet.
MessageListDemo.tsximport React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList, DateStyle } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
const dateSeparatorStyle = new DateStyle({
backgroundColor: "#cdc2ff",
border: "2px solid #6745ff",
borderRadius: "15px",
});
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
dateSeparatorStyle={dateSeparatorStyle}
/>
</div>
) : null;
}
4. EmojiKeyboard Style
To apply customized styles to the EmojiKeyBoard in the Message list Component, you can use the following code snippet.
MessageListDemo.tsximport React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList, EmojiKeyboardStyle } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
const emojiKeyboardStyle = new EmojiKeyboardStyle({
background:'red',
border:'2px solid green',
borderRadius:'15px',
activeIconTint:'yellow',
textColor:'#8830f2'
});
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
emojiKeyboardStyle={emojiKeyboardStyle}
/>
</div>
) : null;
}
Functionality
These are a set of small functional customizations that allow you to fine-tune the overall experience of the component. With these, you can change text, set custom icons, and toggle the visibility of UI elements.
MessageListDemo.tsximport React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
hideError={true}
hideReceipt={true}
/>
</div>
) : null;
}
Below is a list of customizations along with corresponding code snippets
| Property | Description | Code |
|---|
| user report | Used to pass user object of which header specific details will be shown | user={chatUser} |
| group report | Used to pass group object of which header specific details will be shown | group={chatGroup} |
| alignment | used to set the alignmet of messages in CometChatMessageList. It can be either left or standard | {MessageListAlignment.left} |
| emptyStateText | used to set text which will be visible when no messages are available | emptyStateText="Your Custom Empty State text" |
| errorStateText | used to set text which will be visible when error in messages retrieval | errorStateText="Your Custom Error State text" |
| hideError | used to toggle visibility of error in MessageList | hideError={true} |
| disableSoundForMessages report | used to enable/disable sound for incoming/outgoing messages , default false | disableSoundForMessages={true} |
| customSoundForMessages report | used to set custom sound for outgoing message | customSoundForMessages="your custom sound for messages" |
| readIcon | used to set custom read icon visible at read receipt | readIcon="your custom read icon" |
| deliveredIcon | used to set custom delivered icon visible at read receipt | deliveredIcon="your custom delivered icon" |
| sentIcon | used to set custom sent icon visible at read receipt | sentIcon="your custom sent icon " |
| waitIcon | used to set custom wait icon visible at read receipt | waitIcon="your custom wait icon" |
| showAvatar | used to toggle visibility for avatar | showAvatar={true} |
| hideDateSeparator | used to toggle visibility of date separator | hideDateSeparator={true} |
| timestampAlignment | used to set receipt’s time stamp alignment .It can be either top or bottom | timestampAlignment={TimestampAlignment.top} |
| newMessageIndicatorText report | used to set new message indicator text | newMessageIndicatorText="Custom Indicator text" |
| scrollToBottomOnNewMessage | should scroll to bottom on new message? , by default false | scrollToBottomOnNewMessages={true} |
| hideReceipt | Used to control the visibility of read receipts without affecting the functionality of marking messages as read and delivered. | hideReceipt={true} |
| Disable Mentions | Sets whether mentions in text should be disabled. Processes the text formatters If there are text formatters available and the disableMentions flag is set to true, it removes any formatters that are instances of CometChatMentionsFormatter. | disableMentions={true} |
| Disable Reactions | Sets A boolean value indicating whether to disable reactions.Pass true to disable reactions, false to enable them. | disableReactions={true} |
Advance
For advanced-level customization, you can set custom views to the component. This lets you tailor each aspect of the component to fit your exact needs and application aesthetics. You can create and define your views, layouts, and UI elements and then incorporate those into the component.
Templates
CometChatMessageTemplate is a pre-defined structure for creating message views that can be used as a starting point or blueprint for creating message views often known as message bubbles. For more information, you can refer to CometChatMessageTemplate.
You can set message Templates to MessageList by using the following code snippet
MessageListDemo.tsximport React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList, CometChatTheme, ChatConfigurator, CometChatActionsIcon } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
const getCustomOptions = (
loggedInUser: CometChat.User,
message: CometChat.BaseMessage,
theme: CometChatTheme,
group?: CometChat.Group
) => {
const defaultOptions: any =
ChatConfigurator.getDataSource().getMessageOptions(
loggedInUser,
message,
theme,
group
);
const myView: any = new CometChatActionsIcon({
id: "custom id",
title: "your custom title for options",
iconURL: "your custom icon url for options",
iconTint: "#7316f5",
onClick: () => console.log("custom action"),
});
defaultOptions.push(myView);
return defaultOptions;
};
const getTemplates = () => {
let templates = ChatConfigurator.getDataSource().getAllMessageTemplates();
templates.map((data) => {
data.options = (
loggedInUser: CometChat.User,
message: CometChat.BaseMessage,
theme: CometChatTheme,
group?: CometChat.Group
) => getCustomOptions(loggedInUser, message, theme, group);
});
return templates;
};
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
templates={getTemplates()}
/>
</div>
) : null;
}
DateSeparatorPattern
You can customize the date pattern of the message list separator using the DateSeparatorPattern prop. Choose from predefined options like time, DayDate, DayDateTime, or DateTime.
DateSeparatorPattern={DatePatterns.DateTime}
Example
Default
Custom
MessageListDemo.tsximport React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList, DatePatterns } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
DateSeparatorPattern={DatePatterns.DateTime}
/>
</div>
) : null;
}
DatePattern
You can modify the date pattern to your requirement using DatePattern. Choose from predefined options like time, DayDate, DayDateTime, or DateTime.
DatePatterns describes a specific format or arrangement used to represent dates in a human-readable form.
| Name | Description |
|---|
| time | Date format displayed in the format hh:mm a |
| DayDate | Date format displayed in the following format. 1) If timestamp < 24hrs display “Today” 2) If timestamp < 48hrs display “Yesterday” 3) If timestamp < 7days display “EEE” i.e , SUNDAY 4) else display “d MMM, yyyy” |
| DayDateTime | Date format displayed in the following format. 1) If timestamp < 24hrs display “hh:mm a” 2) If timestamp < 48hrs display “Yesterday” 3) If timestamp < 7days display “EEE” i.e SUNDAY 4) else display “dd MM yyyy” |
datePattern={DatePatterns.DateTime}
MessageListDemo.tsx
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList, DatePatterns } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
datePattern={DatePatterns.DateTime}
/>
</div>
) : null;
}
You can set custom headerView to the Message List component using the following method.
headerView={getHeaderView()}
Example
MessageListDemo.tsx
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
const getHeaderView = () => {
return (
<div style={{ height: '40px', width: '100px', background: '#a46efa', borderRadius: '20px', display: 'flex', justifyContent: 'center', alignItems: 'center', margin: '10px' }}>
<button style={{ height: '40px', width: '40px', background: '#a46efa', border: 'none', display: 'flex', justifyContent: 'center', alignItems: 'center', cursor: "pointer" }}>
<img src="img" style={{ height: 'auto', width: '100%', maxWidth: '100%', maxHeight: '100%', borderRadius: '50%' }} alt="bot" />
<span>Chat Bot</span>
</button>
</div>
)
}
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
headerView={getHeaderView()}
/>
</div>
) : null;
}
You can set custom footerview to the Message List component using the following method.
footerview={getFooterView()}
Example
MessageListDemo.tsx
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
const getFooterView = () => {
return (
<div style={{ height: '40px', width: '100px', background: '#a46efa', borderRadius: '20px', display: 'flex', justifyContent: 'center', alignItems: 'center', margin: '10px' }}>
<button style={{ height: '40px', width: '40px', background: '#a46efa', border: 'none', display: 'flex', justifyContent: 'center', alignItems: 'center', cursor: "pointer" }}>
<img src="img" style={{ height: 'auto', width: '100%', maxWidth: '100%', maxHeight: '100%', borderRadius: '50%' }} alt="bot" />
<span>Chat Bot</span>
</button>
</div>
)
}
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
footerview={getFooterView()}
/>
</div>
) : null;
}
ErrorStateView
You can set a custom errorStateView to match the error view of your app.
errorStateView={getErrorStateView()}
Example
Default
Custom
MessageListDemo.tsx
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
const getErrorStateView = () => {
return(
<div style={{height:"100vh", width:"100vw"}}>
<img src="custom image" alt="error icon" style= {{height:"100px", width:"100px", marginTop:"250px", justifyContent:"center"}}></img>
</div>
);
};
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
errorStateView={getErrorStateView()}
/>
</div>
) : null;
}
EmptyStateView
The emptyStateView method provides the ability to set a custom empty state view in your app. An empty state view is displayed when there are no messages for a particular user.
emptyStateView={getEmptyStateView()}
Example
MessageListDemo.tsximport React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
const getEmptyStateView = () => {
return(
<div>
Your Custom Empty State
</div>
);
};
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
emptyStateView={getEmptyStateView()}
/>
</div>
) : null;
}
LoadingStateView
The loadingStateView property allows you to set a custom loading view in your app. This feature enables you to maintain a consistent look and feel throughout your application,
loadingStateView={getLoadingStateView()}
Example
Default
Custom
MessageListDemo.tsx
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList, LoaderStyle } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
const getLoadingStateView = () => {
const getLoaderStyle = new LoaderStyle({
iconTint: "#890aff",
background:"transparent",
height: "100vh",
width: "100vw",
border: "none",
borderRadius: "0",
});
return(
<cometchat-loader
iconURL="your custom icon url"
loaderStyle={JSON.stringify(getLoaderStyle)}
></cometchat-loader>
);
};
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
loadingStateView={getLoadingStateView()}
/>
</div>
) : null;
}
TextFormatters
Assigns the list of text formatters. If the provided list is not null, it sets the list. Otherwise, it assigns the default text formatters retrieved from the data source. To configure the existing Mentions look and feel check out CometChatMentionsFormatter
Configuration
Configurations offer the ability to customize the properties of each component within a Composite Component.
From the MessageList, you can navigate to the MesssageInformation component as shown in the image.
If you wish to modify the properties of the MesssageInformation Component, you can use the MessageInformationConfiguration object.
MessageListDemo.tsximport React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList, MessageInformationStyle } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
const messageInformationStyle = new MessageInformationStyle({
background:"#f7f2fa",
border:"2px solid #d895fc",
borderRadius:"20px",
captionTextColor:"#8629e3",
titleTextColor:"#908deb",
})
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
messageInformationConfiguration={new MessageInformationConfiguration({
messageInformationStyle: messageInformationStyle
})}
/>
</div>
) : null;
}
The MessageInformationConfiguration indeed provides access to all the Action, Filters, Styles, Functionality, and Advanced properties of the MesssageInformation component.
Please note that the properties marked with the report symbol are not accessible within the Configuration Object.
Example
Default
Custom
In the above example, we are styling a few properties of the MesssageInformation component using MessageInformationConfiguration.
Reaction
If you wish to modify the properties of the Reaction Component, you can use the reactionsConfiguration object.
MessageListDemo.tsximport React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList, ReactionsStyle, ReactionsConfiguration } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
const [chatUser, setChatUser] = React.useState<CometChat.User>()
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
})
}, [])
const reactionsStyle = new ReactionsStyle({
border:'2px solid #8742f5',
activeReactionBackground:'#b88cff',
background:'#7b34ed',
baseReactionBackground:'#ebe3ff',
borderRadius:'20px'
})
return chatUser ? (
<div>
<CometChatMessageList
user={chatUser}
reactionsConfiguration={new ReactionsConfiguration({
reactionsStyle: reactionsStyle
//properties of reactions
})}
/>
</div>
) : null;
}