Skip to main content

Overview

The Conversations is a Component, That shows all conversations related to the currently logged-in user, This component lists the most recent or latest conversations or contacts with whom you have exchanged messages. It provides a convenient way to quickly access and resume conversations with the people you have been in contact with recently.

Usage

Integration

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. OnItemClick
OnItemClick is triggered when you click on a ListItem of the Conversations component. The OnItemClick action doesn’t have a predefined behavior. You can override this action using the following code snippet.

2. OnSelect
The OnSelect event is triggered upon the completion of a selection in SelectionMode. It does not have a default behavior. However, you can override its behavior using the following code snippet.

3. OnError
This action doesn’t change the behavior of the component but rather listens for any errors that occur in the Conversations component.

Filters

You can set ConversationsRequestBuilder in the Conversations Component to filter the conversation list. You can modify the builder as per your specific requirements with multiple options available to know more refer to ConversationRequestBuilder. You can set filters using the following parameters.
  1. Conversation Type: Filters on type of Conversation, User or Groups
  2. Limit: Number of conversations fetched in a single request.
  3. WithTags: Filter on fetching conversations containing tags
  4. Tags: Filters on specific Tag
  5. UserTags: Filters on specific User Tag
  6. GroupTags: Filters on specific Group Tag

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.


Customization

To fit your app’s design requirements, you can customize the appearance of the conversation component. We provide exposed methods 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. Conversation Style
You can set the ConversationsStyle to the Conversations Component to customize the styling.
List of properties exposed by ConversationStyle
NameDescription
widthSets the width of the component
heightSets the height of the component
borderSets the border of the component
borderRadiusSets the border radius of the component
backgroundSets all background style properties at once, such as color, image, origin and size, or repeat method. Reference link
boxShadowAdds shadow effects around the component.
titleTextFontSets all the different properties of font for the heading text. Reference link
titleTextColorSets the foreground color of heading text.
loadingIconTintSets the tint or color applied to the loading indicator icon of the component
emptyStateTextFontSets all the different properties of font for the placeholder text. Reference link
emptyStateTextColorSets the foreground color of placeholder text displayed in the component.
errorStateTextFontSets all the different properties of font for the error message. Reference link
errorStateTextColorSets the foreground color of error message displayed in the component.
lastMessageTextFontSets all the different properties of font for the last message. Reference link
lastMessageTextColorSets the foreground color of the last message.
typingIndictorTextFontSets all the different properties of font for the typing indicator text. Reference link
typingIndictorTextColorSets the foreground color of typing indicator text
threadIndicatorTextFontSets all the different properties of font for the thread indicator text. Reference link
threadIndicatorTextColorSets the foreground color of thread indicator text.
onlineStatusColorSets the color of the status indicator representing the user’s online status
privateGroupIconBackgroundSets the background of the status indicator representing private groups.
passwordGroupIconBackgroundSets the background of the status indicator representing password protected groups.
2. Avatar Style
To apply customized styles to the Avatar component in the Conversations Component, you can use the following code snippet. For more information, visit Avatar Styles.
3. StatusIndicator Style
To apply customized styles to the Status Indicator component in the Conversations Component, you can use the following code snippet. For more information, visit Status Indicator Styles.
4. Date Style
To apply customized styles to the Date component in the Conversations Component, you can use the following code snippet. For more information, visit Date Styles.
5. Badge Style
To apply customized styles to the Badge component in the Conversations Component, you can use the following code snippet. For more information, visit Badge Styles.
7. Backdrop Style
To apply customized styles to the Backdrop component in the Conversations Component, you can use the following code snippet, you can use the following code snippet. For more information, visit Backdrop Styles.
8. Delete Conversation Dialog Style
To apply customized styles to the delete dialog component in the Conversations Component, you can use the following code snippet. For more information, visit Delete dialog Styles.
9. LisItem Style
To apply customized styles to the List Item component in the Conversations Component, you can use the following code snippet. For more information, visit List Item.

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.
Below is a list of customizations along with corresponding code snippets
PropertyDescriptionCode
TitleUsed to set custom title in the app bar.title="Your Custom Title"
EmptyState TextUsed to set a custom text response when fetching the conversations has returned an empty listemptyStateText="Your Custom Empty State text"
Selection ModeUsed to set a custom text response when fetching the conversations has returned an empty listselectionMode : SelectionMode = SelectionMode.multiple;
PasswordGroup IconUsed to set icon shown in place of status indicator for password protected grouppasswordGroupIcon="https://icon.svg"
privateGroupIconUsed to set icon shown in place of status indicator for private groupprivateGroupIcon="https://icon.svg"
SentIconUsed to customize the receipt icon shown in the subtitle of the conversation item if hideReceipt is false and if the status of the last message in the conversation is sentsentIcon="your custom sent icon"
Delivered IconUsed to customize the receipt icon shown in the subtitle of the conversation item if hideReceipt is false and if the status of the last message in the conversation is delivereddeliveredIcon="your custom delivered icon"
Read IconUsed to customize the receipt icon shown in the subtitle of the conversation item if hideReceipt is false and if the status of the last message in the conversation is readreadIcon="your custom read icon"
errorIconAsset URL for the error state indicating that an error has occurred when the message was in transit.errorIcon="your custom error icon"
Hide ErrorUsed to hide error on fetching conversationshideError=true
Hide SeparatorUsed to control visibility of Separators in the list viewhideSeparator=true
Disable UsersPresenceUsed to control visibility of status indicator shown if user is onlinedisableUsersPresence=true
Hide ReceiptUsed to control the visibility of read receipts without affecting the functionality of marking messages as read and deliveredhideReceipt=false
Disable TypingUsed to toggle visibility of typing indicatordisableTyping=true
Disable MentionsSets 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
disableSoundForMessagesWhen set to true, the component will not produce sound for all incoming messages.indicatordisableSoundForMessages=true
customSoundForMessagesmp3 file asset of your choice.customSoundForMessages="your custom sound for messages"
activeConversation Used to set the active conversationactiveConversation={activeConversation}

Advanced

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.

ListItemView

With this function, you can assign a custom ListItem to the Conversations Component.
Example Default
Custom

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
You can set the Custom Menu view to add more options to the Conversations component. Example

DatePattern

You can modify the date pattern to your requirement using DatePattern. datePattern formats date and time values according to a predefined standard, enhancing consistency and clarity in their presentation. DatePatterns describes a specific format or arrangement used to represent dates in a human-readable form.
NameDescription
timeDate format displayed in the format hh:mm a
DayDateDate format displayed in the following format.1) If timestamp < 24hrs display “Today”
  1. If timestamp < 48hrs display “Yesterday”
  2. If timestamp < 7days display “EEE” i.e , SUNDAY
  3. else display “d MMM, yyyy” | | DayDateTime | Date format displayed in the following format.1) If timestamp < 24hrs display “hh:mm a”
  4. If timestamp < 48hrs display “Yesterday”
  5. If timestamp < 7days display “EEE” i.e SUNDAY
  6. else display “dd MM yyyy” |
Example Default
Custom

Options

User-defined actions which appears for each conversation on mouseover.
Structure of CometChatOption
NameDescription
idUnique identifier for each option
titleHeading text for each option
titleFontSets all the different properties of font for the option text. Reference link
titleColorSets the foreground color of option text
iconURLSets the asset URL of the icon for each option
iconTintSets the tint or color applied to each option
backgroundColorSets the background color of each option
onClickMethod to be invoked when user clicks on each option
Example Default
Custom

LoadingStateView

You can set a custom loader view using loadingStateView to match the loading view of your app. Example Default
Custom
You can customize the loading state view by modifying the getLoadingStateView function as follows:

ErrorStateView

You can set a custom ErrorStateView to match the error view of your app. Example Default
Custom
You can customize the empty state view by modifying the getErrorStateView function as follows: