Skip to main content

Overview

The CometChatSearch component is a powerful and customizable search interface that allows users to search across conversations and messages in real time. It supports a wide variety of filters, scopes, and customization options. CometChatSearch helps users find messages, conversations, media, and more through an intuitive and filterable search experience. It can be embedded in multiple contexts — as part of the conversation list, message header, or as a full-screen search experience.

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. onConversationClicked

onConversationClicked is triggered when you click on a Conversation from the search result. The onConversationClicked action doesn’t have a predefined behavior. You can override this action using the following code snippet.

2. onMessageClicked

onMessageClicked is triggered when you click on a Message from the search result. The onMessageClicked action doesn’t have a predefined behavior. You can override this action using the following code snippet.

3. OnBack

OnBack is triggered when you click on the back button of the Message Header component. You can override this action using the following code snippet.

4. onError

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

Filters

1. ConversationsRequestBuilder

You can set the ConversationsRequestBuilder in the Search Component to filter the search result. You can modify the builder as per your specific requirements with multiple options available to know more refer to ConversationRequestBuilder.

2. MessagesRequestBuilder

You can set the MessagesRequestBuilder in the Search Component to filter the search result. You can modify the builder as per your specific requirements with multiple options available to know more refer to MessagesRequestBuilder.

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 CometChatSearch component does not produce any events.

Customization

To fit your app’s design requirements, you can customize the appearance of the CometChatSearch component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.

Style

To customize the appearance, you can customise css of CometChatSearch Example

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. Here is a code snippet demonstrating how you can customize the functionality of the Message Header component.
Following is a list of customizations along with their corresponding code snippets:

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.

ConversationItemView

With this function, you can assign a custom list item view to an conversation in the search result. For more information, refer to the itemView prop of the CometChatConversations component.

ConversationLeadingView

With this function, you can assign a custom leading view of an conversation in the search result. For more information, refer to the leadingView prop of the CometChatConversations component.

ConversationTitleView

With this function, you can assign a custom title view to an conversation in the search result. For more information, refer to the titleView prop of the CometChatConversations component.

ConversationSubtitleView

With this function, you can assign a custom subtitle view to an conversation in the search result. For more information, refer to the subtitleView prop of the CometChatConversations component.

ConversationTrailingView

With this function, you can assign a custom trailing view to an conversation in the search result. For more information, refer to the trailingView prop of the CometChatConversations component.

ConversationOptions

A function that returns a list of actions available when hovering over a conversation item in the search result. For more information, refer to the options prop of the CometChatConversations component.

MessageItemView

With this function, you can assign a custom item view of a message in the search result. Shown below is the default message search interface.
The customized message search interface is displayed below.
Use the following code to achieve the customization shown above.

MessageLeadingView

With this function, you can assign a custom leading view of a message in the search result. Shown below is the default message leading view interface.
The customized message leading view interface is displayed below.
Use the following code to achieve the customization shown above.

MessageTitleView

With this function, you can assign a custom title view of a message in the search result. Shown below is the default message title view interface.
The customized message title view interface is displayed below.
Use the following code to achieve the customization shown above.

MessageSubtitleView

With this function, you can assign a custom subtitle view of a message in the search result. Shown below is the default message subtitle view interface.
The customized message subtitle view interface is displayed below.
Use the following code to achieve the customization shown above.

MessageTrailingView

With this function, you can assign a custom trailing view of a message in the search result. Shown below is the default message trailing view interface.
The customized message trailing view interface is displayed below.
Use the following code to achieve the customization shown above.

Message SentAt Date Time Format

The MessageSentAtDateTimeFormat property allows you to customize the Message Sent At timestamp displayed in the Search. Default Date Time Format:
The following example demonstrates how to modify the Sent At timestamp format using a custom CalendarObject.

Text Formatters

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.