-
-
-***
-
-## Usage
-
-### Integration
+
+
+
+## Core Concepts
+
+- **`CometChatAIAssistantChatHistory`**: The main component class that renders the AI assistant chat history list. It is a Composite Component that can be launched via button clicks or any user-triggered action.
+- **Actions**: Callbacks such as `setOnItemClickListener`, `setOnItemLongClickListener`, `setOnNewChatClickListener`, and `setOnCloseClickListener` that let you respond to user interactions.
+- **Style**: XML theme styles applied via `setStyle()` to customize colors, fonts, and visual appearance of the chat history.
+- **Functionality**: Methods like `setUser`, `setErrorStateVisibility`, and `setEmptyStateVisibility` that configure the component's behavior and state visibility.
+
+## Actions and Events
+
+### Callback Methods
+
+What you're changing: How the component responds to user interactions such as taps, long-presses, new chat clicks, and close clicks.
-##### setOnItemClickListener
+- **Where**: Activity or Fragment where you hold a reference to `CometChatAIAssistantChatHistory`.
+- **Applies to**: `CometChatAIAssistantChatHistory`.
+- **Default behavior**: Predefined actions execute automatically when the user interacts with the component.
+- **Override**: Call the corresponding setter method to replace the default behavior with your own logic.
-Function invoked when a chat history item is clicked, typically used to open an ai assistant chat screen.
+#### `setOnItemClickListener`
+
+Function invoked when a chat history item is clicked, used to open an AI assistant chat screen.
-```xml themes.xml
-
-
-
+- **Code**:
+
+```xml themes.xml lines
+
+
+
```
+> **What this does:** Defines a custom style `CustomAIAssistantChatHistoryStyle` that sets the background color to `#FFFAF6` for the component, header, new chat area, date separator, and items. It applies a Times New Roman font to the header, new chat text, date separator, and item text. A helper style `textStyleTimesNewRoman` defines the font family.
+
-## Conversation Starters
+## Conversation Starter
-When a user initiates a new chat, the UI kit displays a list of suggested opening lines that users can select, making it easier for them to start a conversation. These suggestions are powered by CometChat's AI, which predicts contextually relevant conversation starters.
+When a user initiates a new chat, the UI kit displays a list of suggested opening lines that users can select, making it easier for them to start a conversation. These suggestions are powered by CometChat's AI, which predicts contextually relevant conversation starter options.
-For a comprehensive understanding and guide on implementing and using the Conversation Starters, refer to our specific guide on the [Conversation Starter](/fundamentals/ai-user-copilot/conversation-starter).
+For a comprehensive understanding and guide on implementing and using the Conversation Starter, refer to our specific guide on the [Conversation Starter](/fundamentals/ai-user-copilot/conversation-starter).
Once you have successfully activated the [Conversation Starter](/fundamentals/ai-user-copilot/conversation-starter) from your CometChat Dashboard, the feature will automatically be incorporated into the [MessageList](/ui-kit/android/message-list) Component of UI Kits.
@@ -40,7 +52,7 @@ The Conversation Summary feature provides concise summaries of long conversation
For a comprehensive understanding and guide on implementing and using the Conversation Summary, refer to our specific guide on the [Conversation Summary](/fundamentals/ai-user-copilot/conversation-summary).
-Once you have successfully activated the [Smart Replies](/fundamentals/ai-user-copilot/smart-replies) from your CometChat Dashboard, the feature will automatically be incorporated into the Action sheet of [MessageComposer](/ui-kit/android/message-composer) Component of UI Kits.
+Once you have successfully activated the [Conversation Summary](/fundamentals/ai-user-copilot/conversation-summary) from your CometChat Dashboard, the feature will automatically be incorporated into the Action sheet of [MessageComposer](/ui-kit/android/message-composer) Component of UI Kits.
diff --git a/ui-kit/android/android-conversation.mdx b/ui-kit/android/android-conversation.mdx
index 4bebefe49..791267aff 100644
--- a/ui-kit/android/android-conversation.mdx
+++ b/ui-kit/android/android-conversation.mdx
@@ -1,37 +1,50 @@
---
title: "Building A Conversation List + Message View"
sidebarTitle: "Conversation List + Message View"
+description: "Build a conversation list with a full-screen message view using a sequential navigation pattern."
---
-The **Conversation List + Message View** layout offers a seamless **two-panel chat interface**, commonly used in modern messaging applications like **WhatsApp Web, Slack, and Microsoft Teams**.
+
-### **Key Components**
+Three sections working together:
-1. **Chat Header** – Displays user/group name, profile image, and status.
-2. **Message List** – Shows chat history and new messages.
-3. **Message Composer** – Allows users to send messages, media, and reactions.
+1. **Conversation list** — shows all active conversations (users and groups)
+2. **Message header** — displays user/group name, avatar, and status
+3. **Message list + composer** — chat history with real-time updates and text input
-***
+This implementation uses Android's standard Activity navigation: `ConversationActivity` displays the list, user taps a conversation, `MessageActivity` launches with the selected user/group data via Intent extras.
-## **Step-by-Step Guide**
+---
-### **Step 1: Set Up Conversation Activity**
-Create an Activity - `ConversationActivity.kt` to manage and display the chat UI.
+### Step 1: Set Up Conversation Activity
+Create a new Activity called `ConversationActivity` to display the list of conversations.
-#### **Layout**
-Define the layout using the `CometChatConversations` component:
+#### Layout
+Define the layout using the `CometChatConversations` component in `activity_conversations.xml`:
-```xml activity_conversations.xml
+```xml activity_conversations.xml lines
-### **Key Components**
+Three components stacked vertically:
-1. **Chat Header** – Displays user/group name, profile image, and status.
-2. **Message List** – Shows chat history and new messages.
-3. **Message Composer** – Allows users to send messages, media, and reactions.
+1. **Message header** — displays user/group name, avatar, and status
+2. **Message list** — real-time chat history with scrolling
+3. **Message composer** — text input with media and attachments
-***
+The user or group ID is passed via Intent extras when launching the Activity — ideal for launching from a user profile, support button, or notification.
-## **Step-by-Step Guide**
+---
-### **Step 1: Set Up Message Activity**
-Create an Activity - `MessageActivity.kt` to manage and display the chat UI.
+### Step 1: Set Up Message Activity
+Create an Activity - `MessageActivity` to display the full-screen chat interface.
-#### **Layout**
+#### Layout
-Define the layout using CometChat UI Kit components:
+Define the layout with `CometChatMessageHeader`, `CometChatMessageList`, and `CometChatMessageComposer` in `activity_message.xml`:
-```xml activity_message.xml
+```xml activity_message.xml lines
-This layout consists of:
+Three sections working together:
-1. **Sidebar (Conversation List)** – Displays recent conversations with active users and groups.
-2. **Message View** – Shows the selected chat with real-time messages.
-3. **Message Input Box** – Allows users to send messages seamlessly.
+1. **Bottom navigation bar** — switches between Chats, Calls, Users, and Groups
+2. **Fragment container** — renders the CometChat component for the active tab
+3. **Dynamic content** — each tab loads its respective Fragment with real-time data
-***
+This uses Android's `BottomNavigationView` pattern: `TabbedActivity` hosts the navigation and fragment container, user taps a tab, the corresponding Fragment loads.
-## **Step-by-Step Guide**
-
-### **Step 1: Create a Tab Component**
+---
-To manage navigation, let's build a **`CometChatTabs`** component. This component will render different tabs and allow switching between sections dynamically.
+### Step 1: Set Up Tabbed Activity
+Create a new Activity called `TabbedActivity` with **BottomNavigationView** to manage tab navigation.
-#### **Folder Structure**
+#### Project Structure
-Create a `TabbedActivity` inside your `src` directory and add the following files:
+Create the following files in your Android project:
-```txt
+```txt lines
src/main/java/your-package-name/
-├── TabbedActivity.kt
-├── ChatsFragment.kt
-├── CallLogsFragment.kt
-├── UsersFragment.kt
-├── GroupsFragment.kt
+├── TabbedActivity.kt (or .java)
+├── ChatsFragment.kt (or .java)
+├── CallLogsFragment.kt (or .java)
+├── UsersFragment.kt (or .java)
+└── GroupsFragment.kt (or .java)
src/main/java/your-package-name/
├── res/
@@ -51,16 +65,19 @@ src/main/java/your-package-name/
│ └── bottom_nav_menu.xml
```
-#### **Download the Icons**
+#### Vector Drawable Icons
+
+Download the navigation icons from the **CometChat UI Kit repository**:
-These icons are available in the **CometChat UI Kit res folder**. You can find them at:\
-🔗 [GitHub Assets Folder](https://github.com/cometchat/cometchat-uikit-android/tree/v5/sample-app-java/src/main/res/drawable)
+🔗 [GitHub Drawable Resources](https://github.com/cometchat/cometchat-uikit-android/tree/v5/sample-app-java/src/main/res/drawable)
-#### **Implementation**
+Place the icon files (`ic_chats.xml`, `ic_calls.xml`, `ic_user.xml`, `ic_group.xml`) in your `res/drawable/` directory.
+
+#### Implementation
-
-
-You can create an `custom_title_view.xml` as a custom layout file. Which we will inflate in `setTitleView()`
-
-```html
-
-
+
+
+### `setTitleView`
+
+Replace the name / title text.
+
+
+
-You can create an `item_converation_list.xml` as a custom layout file. Which we will inflate in `setListItemView()`
+Create an `item_converation_list.xml` custom layout file:
-```html
+```html lines
+
+
+
+
-This method enables developers to define and apply text formatters that dynamically modify or transform message content before rendering it in the UI. Text formatters can be used for purposes such as:
+
-```xml themes.xml
+```xml themes.xml lines
- @Override
- public void bindView(Context context, View createdView, Conversation conversation, RecyclerView.ViewHolder holder, List
@@ -91,7 +100,7 @@ CometChat's User Presence feature allows users to see whether their contacts are
| ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Conversations](/ui-kit/android/conversations) | [Conversations](/ui-kit/android/conversations) is a Component that renders Conversations item List, Conversations item also shows user presence information. |
| [Message Header](/ui-kit/android/message-header) | [Message Header](/ui-kit/android/message-header) that renders details of User or Groups in ToolBar. The MessageHeader also handles user Presence information. |
-| [Users](/ui-kit/android/users) | [Users](/ui-kit/android/users) renders list of users available in your app.It also responsible to render users Presence information. |
+| [Users](/ui-kit/android/users) | [Users](/ui-kit/android/users) renders a list of users available in your app. It is also responsible for rendering user presence information. |
| [Group Members](/ui-kit/android/group-members) | [Group Members](/ui-kit/android/group-members) renders list of users available in the group. The Group Members component also handles user Presence information. |
## Reactions
@@ -117,12 +126,26 @@ Mentions is a robust feature provided by CometChat that enhances the interactivi
| Components | Functionality |
| -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Conversations](/ui-kit/android/conversations) | [Conversations](/ui-kit/android/conversations) component provides an enhanced user experience by integrating the Mentions feature. This means that from the conversation list itself, users can see where they or someone else have been specifically mentioned. |
-| [MessageComposer](/ui-kit/android/message-composer) | [MessageComposer](/ui-kit/android/message-composer)is a component that allows users to craft and send various types of messages, including the usage of the Mentions feature for direct addressing within the conversation. |
+| [MessageComposer](/ui-kit/android/message-composer) | [MessageComposer](/ui-kit/android/message-composer) is a component that allows users to craft and send various types of messages, including the usage of the Mentions feature for direct addressing within the conversation. |
| [MessageList](/ui-kit/android/message-list) | [MessageList](/ui-kit/android/message-list) is a component that displays a list of sent and received messages. It also supports the rendering of Mentions, enhancing the readability and interactivity of conversations. |
-## Quoted Reply
+## Threaded Conversations
-Quoted Reply is a robust feature provided by CometChat that enables users to quickly reply to specific messages by selecting the "Reply" option from a message's action menu. This enhances context, keeps conversations organized, and improves overall chat experience in both 1-1 and group chats.
+The Threaded Conversations feature enables users to respond directly to a specific message in a chat. This keeps conversations organized and enhances the user experience by maintaining context, especially in group chats.
+
+
+
+
+
+| Components | Functionality |
+| ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [Threaded Header](/ui-kit/android/threaded-messages-header) | [Threaded Header](/ui-kit/android/threaded-messages-header) that displays all replies made to a particular message in a conversation. |
+| [MessageComposer](/ui-kit/android/message-composer) | [MessageComposer](/ui-kit/android/message-composer) is a component that allows users to craft and send various types of messages, including the usage of the Mentions feature for direct addressing within the conversation. |
+| [MessageList](/ui-kit/android/message-list) | [MessageList](/ui-kit/android/message-list) is a component that displays a list of sent and received messages. It also supports the rendering of Mentions, enhancing the readability and interactivity of conversations. |
+
+## Quoted Replies
+
+Quoted Replies are a robust feature provided by CometChat that enables users to quickly reply to specific messages by selecting the "Reply" option from a message's action menu. This enhances context, keeps conversations organized, and improves overall chat experience in both 1-1 and group chats.
@@ -133,20 +156,15 @@ Quoted Reply is a robust feature provided by CometChat that enables users to qui
| [Message List](/ui-kit/android/message-list) | [Message List](/ui-kit/android/message-list) supports replying to messages via the "Reply" option. Users can select "Reply" on a message to open the composer with the quoted reply pre-filled, maintaining context. |
| [Message Composer](/ui-kit/android/message-composer) | [Message Composer](/ui-kit/android/message-composer) works seamlessly with Quoted Message by showing the quoted reply above the input field, letting users compose their response in proper context. |
-## Conversation and Advanced Search
+## Group Chats
-Conversation and Advanced Search is a powerful feature provided by CometChat that enables users to quickly find conversations, messages, and media across chats in real time. It supports filters, scopes, and custom actions, allowing users to locate content efficiently while keeping the chat experience smooth and intuitive.
+CometChat facilitates Group Chats, allowing users to have conversations with multiple participants simultaneously. This feature is crucial for team collaborations, group discussions, social communities, and more.
-
+
-| Components | Functionality |
-| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Search](/ui-kit/android/search) | [Search](/ui-kit/android/search) allows users to search across conversations and messages in real time. Users can click on a result to open the conversation or jump directly to a specific message. |
-| [Message Header](/ui-kit/android/message-header) | [Message Header](/ui-kit/android/message-header) shows the search button in the chat header, allowing users to search within a conversation. |
-| [Message List](/ui-kit/android/message-list) | [Message List](/ui-kit/android/message-list) shows the selected message when clicked from search results and highlights it in the message list. |
-| [Conversations](/ui-kit/android/conversations) | [Conversations](/ui-kit/android/conversations) displays the search input. |
+For a comprehensive understanding and guide on implementing and using the Groups feature in CometChat, you should refer to our detailed guide on [Groups](/ui-kit/android/groups).
## Moderation
@@ -182,26 +200,36 @@ Learn more about how flagged messages are handled, reviewed, and moderated in th
| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Message List](/ui-kit/android/message-list) | [Message List](/ui-kit/android/message-list) provides the "Report Message" option in the message actions menu, allowing users to initiate the reporting process for inappropriate messages. |
-## Threaded Conversations
+## Conversation and Advanced Search
-The Threaded Conversations feature enables users to respond directly to a specific message in a chat. This keeps conversations organized and enhances the user experience by maintaining context, especially in group chats.
+Conversation and Advanced Search is a powerful feature provided by CometChat that enables users to quickly find conversations, messages, and media across chats in real time. It supports filters, scopes, and custom actions, allowing users to locate content efficiently while keeping the chat experience smooth and intuitive.
-
+
-| Components | Functionality |
-| ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Threaded Header](/ui-kit/android/threaded-messages-header) | [Threaded Header](/ui-kit/android/threaded-messages-header) that displays all replies made to a particular message in a conversation. |
-| [MessageComposer](/ui-kit/android/message-composer) | [MessageComposer](/ui-kit/android/message-composer)is a component that allows users to craft and send various types of messages, including the usage of the Mentions feature for direct addressing within the conversation. |
-| [MessageList](/ui-kit/android/message-list) | [MessageList](/ui-kit/android/message-list) is a component that displays a list of sent and received messages. It also supports the rendering of Mentions, enhancing the readability and interactivity of conversations. |
-
-## Group Chat
-
-CometChat facilitates Group Chats, allowing users to have conversations with multiple participants simultaneously. This feature is crucial for team collaborations, group discussions, social communities, and more.
+| Components | Functionality |
+| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [Search](/ui-kit/android/search) | [Search](/ui-kit/android/search) allows users to search across conversations and messages in real time. Users can click on a result to open the conversation or jump directly to a specific message. |
+| [Message Header](/ui-kit/android/message-header) | [Message Header](/ui-kit/android/message-header) shows the search button in the chat header, allowing users to search within a conversation. |
+| [Message List](/ui-kit/android/message-list) | [Message List](/ui-kit/android/message-list) shows the selected message when clicked from search results and highlights it in the message list. |
+| [Conversations](/ui-kit/android/conversations) | [Conversations](/ui-kit/android/conversations) displays the search input. |
-
-
-
+---
-For a comprehensive understanding and guide on implementing and using the Groups feature in CometChat, you should refer to our detailed guide on [Groups](/ui-kit/android/groups).
+## Next Steps
+
+
-### Profanity Filter
-
-The Profanity Filter extension helps in maintaining the chat decorum by censoring obscene and inappropriate words in the messages. For a comprehensive understanding and guide on implementing and using the Profanity Filter Extension, refer to our specific guide on the [Legacy Extensions](/moderation/legacy-extensions).
-
-Once you have successfully activated the Profanity Filter Extension from your CometChat Dashboard, the feature will automatically be incorporated into the Message Bubble of [MessageList Component](/ui-kit/android/message-list) component of UI Kits.
-
### Thumbnail Generation
The Thumbnail Generation extension automatically creates a smaller preview image whenever a larger image is shared, helping to reduce the upload/download time and bandwidth usage. For a comprehensive understanding and guide on implementing and using the Thumbnail Generation Extension, refer to our specific guide on the [Thumbnail Generation Extension](/fundamentals/thumbnail-generation).
@@ -91,3 +97,9 @@ Once you have successfully activated the [Thumbnail Generation Extension](/funda
---------
-
-***
-
-## **Prerequisites**
-
-Before installing the **CometChat UI Kit for Android**, you must first **create a CometChat application** via the **[CometChat Dashboard](https://app.cometchat.com/)**. The dashboard provides all the essential chat service components, including:
-
-* **User Management**
-* **Group Chat & Messaging**
-* **Voice & Video Calling**
-* **Real-time Notifications**
-
-
-**Use When:**
-
-* You need **mobile-friendly navigation** between multiple chats.
-* Your app supports **both 1:1 and group messaging**.
-* You want a **clean switch between list and message view** without sidebars.
-
-[Integrate Conversation List + Message View](./android-conversation)
-
-***
-
-### **2️⃣ One-to-One / Group Chat**
+
-**Use When:**
-
-* Your flow starts with **a specific contact or ticket** (e.g., customer support).
-* You want a **no-frills, clean chat screen**.
-* Perfect for **helpdesks, dating apps, or onboarding flows**.
-
-[Integrate One-to-One / Group Chat](./android-one-to-one-chat)
-
-***
-
-### **3️⃣ Tab-Based Messaging UI (All-in-One)**
+
-**Use When:**
-
-* You want a **multi-functional chat app** in one interface.
-* Your users need to **navigate easily between modules**.
-* Ideal for **support, enterprise, or social apps**.
-
-[Integrate Tab-Based Chat](./android-tab-based-chat)
-
-***
+
-
+`CometChatGroupMembers` is a list component. It renders all members of a specific group and emits the selected `GroupMember` via `setOnItemClick`. It requires a `Group` object set via `setGroup()` before it can load data. Wire it to `CometChatMessageHeader`, `CometChatMessageList`, and `CometChatMessageComposer` to build a group messaging layout.
+
+
+
-
-
-
-```xml themes.xml
-
+
+
-| Methods | Description | Code |
-| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
-| setGroup | Sets the group whose members need to be fetched. This is a required property for the component to function properly. | `.setGroup(group);` |
-| setBackIconVisibility | Used to toggle visibility for back button in the app bar | `.setBackIconVisibility(View.VISIBLE);` |
-| setToolbarVisibility | Used to toggle visibility for back button in the app bar | `.setToolbarVisibility(View.GONE);` |
-| setErrorStateVisibility | Used to hide error state on fetching Users | `.setErrorStateVisibility(View.GONE);` |
-| setEmptyStateVisibility | Used to hide empty state on fetching Users | `.setEmptyStateVisibility(View.GONE);` |
-| setLoadingStateVisibility | Used to hide loading state while fetching Users | `.setLoadingStateVisibility(View.GONE);` |
-| setSeparatorVisibility | Used to control visibility of Separators in the list view | `.setSeparatorVisibility(View.GONE);` |
-| setUsersStatusVisibility | Used to control visibility of status indicator shown if user is online | `.setUsersStatusVisibility(View.GONE);` |
-| setSelectionMode | This method determines the selection mode for members, enabling users to select either a single or multiple members at once. | `.setSelectionMode(UIKitConstants.SelectionMode.MULTIPLE);` |
-| setSearchkeyword | Used for fetching members matching the passed keywords | `.setSearchkeyword("anything");` |
-| setSearchBoxVisibility | Used to hide search box shown in the tool bar | `.setSearchBoxVisibility(View.GONE);` |
+Create a custom layout file named `custom_title_view.xml`:
-***
-
-### 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 own views, layouts, and UI elements and then incorporate those into the component.
-
-The `Group Memebers` component does not provide additional functionalities beyond this level of customization.
-
-***
-
-#### setOptions
-
-Defines a set of available actions that users can perform when they interact with a group member item.
+```xml custom_title_view.xml lines
+
+
+
-Configures a view to be displayed when no group members are found.
+Create a custom layout file named `custom_title_view.xml`:
-Use Cases:
+```xml custom_title_view.xml lines
+
+
-
-
-You can indeed create a custom layout file named `custom_title_view.xml` for more complex or unique list items.
+
+
-
+
-You can indeed create a custom layout file named `custom_title_view.xml` for more complex or unique list items.
-
-Once this layout file is made, you would inflate it inside the `createView()` method of the `GroupsViewHolderListener`. The inflation process prepares the layout for use in your application:
+Create a custom layout file named `custom_tail_view.xml`:
-Following this, you would use the `bindView()` method to initialize and assign values to your individual views. This could include setting text on TextViews, images on ImageViews, and so on based on the properties of the Group object:
-
-```xml custom_title_view.xml
+```xml custom_tail_view.xml lines
-You can indeed create a custom layout file named `item_list.xml` for more complex or unique list items.
-
-Once this layout file is made, you would inflate it inside the `createView()` method of the `GroupsViewHolderListener`. The inflation process prepares the layout for use in your application:
+Create a custom layout file named `item_list.xml`:
-Following this, you would use the `bindView()` method to initialize and assign values to your individual views. This could include setting text on TextViews, images on ImageViews, and so on based on the properties of the Group object:
-
-```xml item_list.xml
+```xml item_list.xml lines
+
-You can indeed create a custom layout file named `subtitle_layout.xml` for more complex or unique list items.
-
-Once this layout file is made, you would inflate it inside the `createView()` method of the `GroupsViewHolderListener`. The inflation process prepares the layout for use in your application:
-
-Following this, you would use the `bindView()` method to initialize and assign values to your individual views. This could include setting text on TextViews, images on ImageViews, and so on based on the properties of the Group object:
-
-
+### Hide kick/ban/scope options
-You can indeed create a custom layout file named `tail_view_layout.xml` for more complex or unique list items.
+
+
-
-
+`CometChatGroups` is a list component. It renders all available groups and emits the selected `Group` via `setOnItemClick`. Wire it to `CometChatMessageHeader`, `CometChatMessageList`, and `CometChatMessageComposer` to build a group messaging layout.
+
+
+
-##### setOnItemClick
+Prerequisites: CometChat SDK initialized with `CometChatUIKit.init()`, a user logged in, and the `cometchat-chat-uikit-android` dependency added.
-Function invoked when a Group item is clicked, typically used to open a Group profile or chat screen.
+To add programmatically in an Activity:
-
-
-```html
-
-
-
-```
-
-
-You can indeed create a custom layout file named `custom_leading_avatar_view.xml` for more complex or unique list items.
-
-Once this layout file is made, you would inflate it inside the `createView()` method of the `GroupsViewHolderListener`. The inflation process prepares the layout for use in your application:
-
-Following this, you would use the `bindView()` method to initialize and assign values to your individual views. This could include setting text on TextViews, images on ImageViews, and so on based on the properties of the Group object:
+Create a `custom_leading_avatar_view.xml` layout:
-```xml custom_leading_avatar_view.xml
+```xml custom_leading_avatar_view.xml lines
-You can indeed create a custom layout file named `custom_title_view.xml` for more complex or unique list items.
+Create a `custom_group_title_view.xml` layout:
-Once this layout file is made, you would inflate it inside the `createView()` method of the `GroupsViewHolderListener`. The inflation process prepares the layout for use in your application:
-
-Following this, you would use the `bindView()` method to initialize and assign values to your individual views. This could include setting text on TextViews, images on ImageViews, and so on based on the properties of the Group object:
-
-```xml custom_title_view.xml
+```xml custom_group_title_view.xml lines
+
-You can indeed create a custom layout file named `custom_tail_view.xml` for more complex or unique list items.
-
-Once this layout file is made, you would inflate it inside the `createView()` method of the `GroupsViewHolderListener`. The inflation process prepares the layout for use in your application:
-
-Following this, you would use the `bindView()` method to initialize and assign values to your individual views. This could include setting text on TextViews, images on ImageViews, and so on based on the properties of the Group object:
+Create a `custom_tail_view.xml` layout:
-```xml custom_tail_view.xml
+```xml custom_tail_view.xml lines
-You can indeed create a custom layout file named `item_list.xml` for more complex or unique list items.
-
-Once this layout file is made, you would inflate it inside the `createView()` method of the `GroupsViewHolderListener`. The inflation process prepares the layout for use in your application:
-
-Following this, you would use the `bindView()` method to initialize and assign values to your individual views. This could include setting text on TextViews, images on ImageViews, and so on based on the properties of the Group object:
-
-```xml custom_group_list_itemd.xml
+Create a `custom_group_list_item.xml` layout:
+```xml custom_group_list_item.xml lines
-
-
-You can indeed create a custom layout file named `subtitle_layout.xml` for more complex or unique list items.
-
-Once this layout file is made, you would inflate it inside the `createView()` method of the `GroupsViewHolderListener`. The inflation process prepares the layout for use in your application:
-
-Following this, you would use the `bindView()` method to initialize and assign values to your individual views. This could include setting text on TextViews, images on ImageViews, and so on based on the properties of the Group object:
+Append to the long-press context menu without removing defaults.
-You need to create a `overflow_menu_layout.xml` as a custom view file. Which we will inflate and pass to `.setOverflowMenu()`.
+Create an `overflow_menu_layout.xml` layout:
-```xml overflow_menu_layout.xml
+```xml overflow_menu_layout.xml lines
+
+
+```xml themes.xml lines
+
+
```
+
-
+`CometChatIncomingCall` is a call-handling component. It renders when the logged-in user receives an incoming voice or video call, displaying the caller's information and providing accept/reject controls. Wire it to `CometChatOngoingCallActivity` after the user accepts the call.
-***
+
+
-##### Activity and Fragment
+Prerequisites: CometChat SDK initialized with `CometChatUIKit.init()`, a user logged in, and the `cometchat-chat-uikit-android` dependency added.
-You can integrate `CometChatIncomingCall` into your Activity and Fragment by adding the following code snippets into the respective classes.
+In your Activity, get a reference and set the `Call` object:
-
+ override fun ccCallEnded(call: Call?) {
+ super.ccCallEnded(call)
+ }
+})
+```
-```xml themes.xml
-
+Remove Listener
-
```
+CometChatCallEvents.removeListener("LISTENER_TAG")
+```
+
-```xml leading_view.xml
+```xml leading_view.xml lines
-```xml custom_title_view.xml
+```xml custom_title_view.xml lines
-trailing\_view\.xml
-
-```xml trailing_view.xml
+```xml trailing_view.xml lines
+
+
+```xml themes.xml lines
+
+
+
+```
+
+
-In CometChat UIKit, a string resource is defined as:
-
-```xml strings.xml
+```xml strings.xml lines
-
+Use `setTextFormatters()` on [CometChatMessageComposer](/ui-kit/android/message-composer), [CometChatMessageList](/ui-kit/android/message-list), or [CometChatConversations](/ui-kit/android/conversations).
+
+
-```xml themes.xml
-
+```xml themes.xml lines
-```
-```html
-
+
+
+
+
```
-**Customizing Outgoing Message Bubble**
+Customizing Incoming Message Bubble
-
+
-```html
-
-
-```
+Customizing Outgoing Message Bubble
-```html
-
-
-```
+
+
+
-To know more such attributes, visit the [attributes file](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_message_bubble.xml).
+**Attribute references:**
+- [Message bubble attributes](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_message_bubble.xml)
-### Text Bubble
-Text bubbles display plain text messages. These are the most common bubble type in a chat interface.
+## Core Message Bubbles
+
+The following sections define how to style specific types of messages. Define the custom style, then link it to the central hubs (`CustomIncomingMessageBubbleStyle` or `CustomOutgoingMessageBubbleStyle`) established above.
-**Default**
+### Text Bubble
+Text bubbles display plain text messages. These are the most common bubble type.
+**Default & Customization**
-
-**Customization**
-
-**Customizing Incoming Bubble**
-
-```xml themes.xml
-
-
+
-```
-
-```xml themes.xml
-
-
-```
-
-**Customizing Outgoing Bubble**
-```html
-
-
+
```
+**Attribute reference:**
+- [Text bubble attributes](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_text_bubble.xml)
-```html
-
-
-```
-
-To know more such attributes, visit the [attributes file](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_text_bubble.xml).
### Link Preview Bubble
+Displays a preview of links shared in messages, enriching the experience with titles, descriptions, and images.
-The Link Preview Bubble is designed to display a preview of links shared in messages. It enriches the messaging experience by showing details such as the page title, description, and an image from the linked content, making links more engaging and informative.
-
-**Default**
-
+**Default & Customization**
-
-**Customization**
-
-**Customizing Incoming Bubble**
-
-```html
-
-
-
-```
-
-```html
-
-
-```
-
-**Customizing Outgoing Bubble**
-
-```html
-
-
-
-
-```
-
-```html
-
-
```
-To know more such attributes, visit the [attributes file](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_text_bubble.xml).
### Image Bubble
-
Image bubbles display images shared within a conversation.
-**Default**
-
+**Default & Customization**
-
-**Customization**
-
-**Customizing Incoming Bubble**
-
-```html
-
-
-```
-
-```html
-
-
-```
-**Customizing Outgoing Bubble**
-
-```html
-
+
@@ -242,32 +199,20 @@ Image bubbles display images shared within a conversation.
-**Customizing Incoming Bubble**
-
-```html
-
+```xml themes.xml lines
+
-```
-
-```html
-
-
-```
-**Customizing Outgoing Bubble**
-
-```html
-
+
```
+**Attribute reference:**
+- [Video bubble attributes](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_video_bubble.xml)
-```html
-
-
-```
-
-To know more such attributes, visit the [attributes file](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_video_bubble.xml).
### Audio Bubble
-
Audio bubbles represent audio messages or voice recordings.
-**Default**
-
+**Default & Customization**
-
-**Customization**
-
-**Customizing Incoming Bubble**
-
-```html
-
+```xml themes.xml lines
+
-```
-
-```html
-
-
-```
-**Customizing Outgoing Bubble**
-
-```html
-
+
```
+**Attribute reference:**
+- [Audio bubble attributes](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_audio_bubble.xml)
-```html
-
-
-```
-
-To know more such attributes, visit the [attributes file](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_audio_bubble.xml).
### File Bubble
+Displays shared files, such as documents, PDFs, or spreadsheets.
-File bubbles are used to display shared files, such as documents, PDFs, or spreadsheets.
-
-**Default**
-
+**Default & Customization**
-
-**Customization**
-
-**Customizing Incoming Bubble**
-
-```html
-
+```xml themes.xml lines
+
-```
-
-```html
-
-
-```
-**Customizing Outgoing Bubble**
-
-```html
-
+
@@ -420,36 +306,23 @@ File bubbles are used to display shared files, such as documents, PDFs, or sprea
-
-**Customization**
-
-**Customizing Incoming Bubble**
-
-```html
-
+```xml themes.xml lines
+
@@ -457,19 +330,8 @@ Sticker bubbles display stickers shared in a conversation, enhancing visual expr
-```
-
-```html
-
-
-```
-**Customizing Outgoing Bubble**
-
-```html
-
+
@@ -478,36 +340,23 @@ Sticker bubbles display stickers shared in a conversation, enhancing visual expr
-
-**Customization**
-
-**Customizing Incoming Bubble**
-
-```html
-
+```xml themes.xml lines
+
@@ -515,19 +364,8 @@ Poll bubbles represent polls shared within the chat, showing options and results
-```
-
-```html
-
-
-```
-**Customizing Outgoing Bubble**
-
-```html
-
+
```
+**Attribute reference:**
+- [Poll bubble attributes](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_poll_bubble.xml)
-```html
-
-
-```
-
-To know more such attributes, visit the [attributes file](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_poll_bubble.xml).
### Collaborative Bubble
+Displays collaborative content, such as shared documents or tasks.
-Collaborative bubbles display collaborative content, such as shared documents or tasks.
-
-**Default**
-
+**Default & Customization**
-
-**Customization**
-
-**Customizing Incoming Bubble**
-
-```html
-
+```xml themes.xml lines
+
@@ -574,19 +399,8 @@ Collaborative bubbles display collaborative content, such as shared documents or
-```
-
-```html
-
-
-```
-**Customizing Outgoing Bubble**
-
-```html
-
+
```
+**Attribute reference:**
+- [Collaborative bubble attributes](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_collaborative_bubble.xml)
-```html
-
-
-```
-
-To know more such attributes, visit the [attributes file](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_collaborative_bubble.xml).
### Meet Call Bubble
+Displays call-related actions and statuses in the chat interface.
-Meet call bubbles display call-related actions and statuses in the chat interface.
-
-**Default**
-
+**Default & Customization**
-
-**Customization**
-
-**Customizing Incoming Bubble**
-
-```html
-
+```xml themes.xml lines
+
-```
-
-```html
-
-
-```
-**Customizing Outgoing Bubble**
-
-```html
-
+
```
+**Attribute reference:**
+- [Meet call bubble attributes](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_meet_call_bubble.xml)
-```html
-
-
-```
-
-To know more such attributes, visit the [attributes file](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_meet_call_bubble.xml).
### Delete Bubble
+Indicates a message that has been removed by the sender.
-Delete bubbles are used to display messages that have been deleted by the sender. These indicate the message removal within the chat interface.
-
-**Default**
-
+**Default & Customization**
-
-**Customization**
-
-**Customizing Incoming Bubble**
-
-```html
-
-
-```
-
-```html
-
-
-```
-**Customizing Outgoing Bubble**
-
-```html
-
+
```
+**Attribute reference:**
+- [Delete bubble attributes](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_delete_bubble.xml)
-```html
-
-
-```
-
-To know more such attributes, visit the [attributes file](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_delete_bubble.xml).
-### Call Action Bubble
+## List-Level Bubbles & Special Features
-Call action bubbles display call-related actions, such as missed calls, in the chat interface.
+Unlike standard messages, **Call Action** and **Action** bubbles are tied to the **Message List Style**, not the Incoming/Outgoing Hubs. AI Assistants and Quoted Replies have specialized formatting.
-**Default**
+### Call Action Bubble
+Displays call actions like missed calls within the message list.
+**Default & Customization**
-
-**Customization**
-
-**Customizing Bubble**
-
-```html
-
+```xml themes.xml lines
+
+
-```
-```html
-
+
```
+**Attribute references:**
+- [Call action bubble attributes](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_call_action_bubble.xml)
+- [Message list attributes](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_message_list.xml)
-To know more such attributes, visit the [attributes file](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_call_action_bubble.xml).
### Action Bubble
+Displays global group actions (e.g., "User joined the chat").
-Action bubbles provide a customizable interface for displaying a variety of actions, such as group actions, within a chat.
-
-**Default**
-
+**Default & Customization**
-
-**Customization**
-
-**Customizing Bubble**
-
-```html
-
+```xml themes.xml lines
+
+
-```
-```html
-
+
```
+**Attribute reference:**
+- [Action bubble attributes](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_action_bubble.xml)
-To know more such attributes, visit the [attributes file](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_action_bubble.xml).
### AI Assistant Bubble
+Styles interactions generated by the AI assistant. These are anchored to the `IncomingMessageBubbleStyle`.
-AI Assistant bubbles display messages and interactions from an AI assistant within the chat interface.
-
-**Default**
-
+**Default & Customization**
-
-**Customization**
-
-**Customizing Bubble**
-
-```html
-
-
-
-
-
-
+```xml themes.xml lines
+
+
-
-```
+
+
-```html
-
-
```
+**Attribute reference:**
+- [AI assistant bubble attributes](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/att_cometchat_ai_assistant_bubble.xml)
-To know more such attributes, visit the [attributes file](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_action_bubble.xml).
### Quoted Reply
+Styles the preview block when a user replies to a specific message.
-```xml themes.xml
-
-
-
-
-
-
-
-
-
-
-
-```
+```xml themes.xml lines
+
+
-```xml themes.xml
-
-```
-To know more such attributes, visit the [attributes file](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_message_preview.xml).
\ No newline at end of file
+
+
+
+
+
+
+
+
+```
+**Attribute reference:**
+- [Message preview attributes](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_message_preview.xml)
+
+## Customization matrix
+
+| What you want to change | Where | Property/API | Example |
+| --- | --- | --- | --- |
+| Incoming bubble background | `res/values/themes.xml` | `cometchatMessageBubbleBackgroundColor` in `CometChatIncomingMessageBubbleStyle` | `
-
+
+
-The MessageComposer is responsible for managing runtime permissions. To ensure the **ActivityResultLauncher** is properly initialized, its object should be created in the the **onCreate** state of an activity. To ensure that the composer is loaded within the fragment, it is important to make sure that the fragment is loaded in the `onCreate` state of the activity.
+Prerequisites: CometChat SDK initialized with `CometChatUIKit.init()`, a user logged in, and the `cometchat-chat-uikit-android` dependency added.
+
+
+
+Create a `custom_header_layout.xml` layout:
+
+```xml custom_header_layout.xml lines
+
+
+
-```html
-
+First, create a custom send button drawable:
+
+```xml drawable/custom_send_button.xml lines
+
+
+
+
+
+
-```xml themes.xml
-
+```xml themes.xml lines
+```
+
-
+`CometChatMessageHeader` is a header bar component. It sits at the top of a chat screen and displays the avatar, name, and status of the user or group in the conversation. Wire it alongside `CometChatMessageList` and `CometChatMessageComposer` to build a complete messaging layout.
-***
+
+
-This action doesn't change the behavior of the component but rather listens for any errors that occur in the Users component.
+Prerequisites: CometChat SDK initialized with `CometChatUIKit.init()`, a user logged in, and the `cometchat-chat-uikit-android` dependency added.
-
-
+## Custom View Slots
-```xml themes.xml
-
+Each slot replaces a section of the default header UI. Slots accept a `Function3
-
+Sets a custom style for the overflow popup menu.
+
+
+```xml themes.xml lines
+
+
+
+```
+
+
+
-#### setLoadingView
+```xml custom_footer_layout.xml lines
-Customizes the loading indicator when messages are being fetched.
+
+
-```xml themes.xml
+```xml themes.xml lines
-
+
+```
+
+> **What this does:** Defines custom mention styles for incoming and outgoing message bubbles. Incoming mentions appear in pink (`#D6409F`) and outgoing mentions appear in white (`#FFFFFF`), both with green self-mentions (`#30A46C`).
+
+
-
+cometchatMessageList.setDateTimeFormatter(new DateTimeFormatterCallback() {
-```html custom_header_layout.xml
+ private final SimpleDateFormat fullTimeFormatter = new SimpleDateFormat("hh:mm a", Locale.getDefault());
+ private final SimpleDateFormat dateFormatter = new SimpleDateFormat("dd MMM yyyy", Locale.getDefault());
-
-
-
+Replaces the entire message list with a new list.
-```xml custom_footer_layout.xml
+
+
+
+```xml themes.xml lines
+
+
+
+```
+
+> **What this does:** Defines two custom styles: `CustomOutgoingMessageBubbleStyle` sets the outgoing message bubble background to orange (`#F76808`); `CustomCometChatMessageListStyle` sets the message list background to light peach (`#FEEDE1`) and applies the custom outgoing bubble style.
+
+
-
-
-The MessageBubble structure can typically be broken down into the following views:
-
-1. **Leading view**: This is where the sender's avatar is displayed. It's typically on the left of the MessageBubble for messages from others and on the right for messages from the current user.
-
-2. **Header view**: This displays the sender's name and is especially useful in group chats where multiple users are sending messages.
-
-3. **Content view**: This is the core of the MessageBubble where the message content (text, images, videos, etc.) is displayed.
-
-4. **Bottom view**: This view can be used to extend the MessageBubble with additional elements, such as link previews or a 'load more' button for long messages. It's typically placed beneath the Content view.
-
-5. **Footer view**: This is where the timestamp of the message and its delivery or read status are displayed. It's located at the bottom of the MessageBubble.
-
-### Properties
-
-MessageTemplate provides you with methods that allow you to alter various properties of the MessageBubble. These properties include aspects such as the `type` and `category` of a message, the appearance and behavior of the header, content, and footer sections of the message bubble,
-
-1. **Type**
-
- Using `setType()` you can set the type of CometChatMessage, This will map your MessageTemplate to the corresponding CometChatMessage. You can set the MessageTemplate Type using the following code snippet.
-
- ```swift
- messageTemplate.setType(UIKitConstants.MessageType.CUSTOM);
- ```
-
-2. **Category**
-
- Using `.setCategory()` you can set the category of a MessageTemplate. This will create a MessageTemplate with the specified category and link it with a CometChatMessage of the same category.
-
- Please refer to our guide on [Message Categories](/sdk/android/message-structure-and-hierarchy) for a deeper understanding of message categories.
-
- ```swift
- messageTemplate.setCategory(UIKitConstants.MessageCategory.CUSTOM);
- ```
-
-3. **Header View**
-
- The .`setHeaderView()` method allows you to assign a custom header view to the MessageBubble. By default, it is configured to display the sender's name.
-
-```typescript
-messageTemplate.setHeaderView(new MessagesViewHolderListener() {
- @Override
- public View createView(Context context, CometChatMessageBubble messageBubble, UIKitConstants.MessageBubbleAlignment alignment) {
- return null;
- }
-
- @Override
- public void bindView(Context context,
- View createdView,
- BaseMessage message,
- UIKitConstants.MessageBubbleAlignment alignment,
- RecyclerView.ViewHolder holder,
- List
+
+
+The `MessageBubble` structure is broken down into these views:
+
+1. **Leading view**: Displays the sender's avatar. It appears on the left of the `MessageBubble` for messages from others and on the right for messages from the current user.
+
+2. **Header view**: Displays the sender's name. This is useful in group chats where multiple users are sending messages.
+
+3. **Content view**: The core of the `MessageBubble` where the message content (text, images, videos, etc.) is displayed.
+
+4. **Bottom view**: Extends the `MessageBubble` with additional elements, such as link previews or a "load more" button for long messages. It is placed beneath the Content view.
+
+5. **Footer view**: Displays the timestamp of the message and its delivery or read status. It is located at the bottom of the `MessageBubble`.
+
+### Template Properties
+
+`MessageTemplate` provides methods that allow you to alter various properties of the `MessageBubble`, including the `type` and `category` of a message, and the appearance and behavior of the header, content, and footer sections.
+
+**Type**: Use `setType()` to set the type of `CometChatMessage`. This maps your `MessageTemplate` to the corresponding `CometChatMessage`.
+
+```java
+messageTemplate.setType(UIKitConstants.MessageType.CUSTOM);
```
-
-```xml message_template_header_view.xml
+**XML Layout:**
+
+```xml message_template_header_view.xml lines
-```xml image_bubble_content_view.xml
+**XML Layout:**
+
+```xml image_bubble_content_view.xml lines
-```xml status_info_layout.xml
+**XML Layout:**
+
+```xml status_info_layout.xml lines
-```xml message_template_bottom_view.xml
+**XML Layout:**
+
+```xml message_template_bottom_view.xml lines
-```html
+**XML Layout:**
+
+```html lines
+**XML Layouts:**
+
drawable/left\_bubble\_bg
-```html
+```html lines
+**Code:**
+
-First, let's see how to send a custom message:
+**Sending a custom message:**
-
-
-***
-
-## Usage
-
-### Integration
-
-`CometChatOutgoingCall` being a custom component, offers versatility in its integration. It can be seamlessly launched via button clicks or any user-triggered action, enhancing the overall user experience and facilitating smoother interactions within the application.
-
-Since `CometChatOutgoingCall` can be launched by adding the following code snippet into the XML layout file.
-
-
+
- setContentView(cometchatOutgoingCall);
-}
-```
+Prerequisites: CometChat SDK initialized with `CometChatUIKit.init()`, a user logged in, and the `cometchat-chat-uikit-android` dependency added.
-
-
-
-```xml themes.xml
-
-
-```
-
-
-```xml custom_title_view.xml
+Create a `custom_title_view.xml` layout:
+
+```xml custom_title_view.xml lines
-```html custom_subtitle_view.xml
+Create a `custom_subtitle_view.xml` layout:
+
+```xml custom_subtitle_view.xml lines
-```xml end_call_button.xml
+Create an `end_call_button.xml` layout:
+
+```xml end_call_button.xml lines
+
+
+```xml themes.xml lines
+
+
+```
+
+
-***
+---
-## **Download the CometChat Demo App**
+## Try It
-Get started with the **CometChat UI Kit** on your mobile device:
+
](https://link.cometchat.com/android-demo-app)
-**Or Scan the QR Code**
+Or scan the QR code to install directly:
-> **Tip:** On Android, you can use Google Lens or any QR code scanning app to install directly.
-
-***
-
-## **Getting Started**
-
-Before integrating the CometChat UI Kit, familiarize yourself with the key concepts and features offered by CometChat’s platform.
-
-* Review the [Key Concepts](/fundamentals/key-concepts) to understand essential terminology and features.
-* Follow the [Getting Started Guide](/ui-kit/android/getting-started) for detailed steps on initial setup and integration.
-
-***
-
-## **Integration and Customization**
-
-The CometChat UI Kit comprises modular Android Views that can be integrated effortlessly into your app, offering flexible customization:
-
-* **Prebuilt UI Components:** Ready-to-use UI elements.
-* **Modular Structure:** Easy to integrate and modify.
-* **Customization Options:** Highly configurable to fit your brand and UI requirements.
-
-Explore more about UI customization in the [Customization Guide](/ui-kit/android/theme-introduction).
-
-***
-
-## **Helpful Resources**
-
-Explore these essential resources to gain a deeper understanding of **CometChat UI Kits** and streamline your integration process.
-
-
-
+`CometChatSearch` is a composite search component. It searches across conversations and messages in real time and emits the selected result via `setOnConversationClicked` or `setOnMessageClicked`. Wire it to navigation so tapping a conversation opens the message view, or tapping a message scrolls to it in context.
-***
+
+
-
+
-```xml themes.xml
-
+
-
+#### `setTextFormatters`
-Bellow is the list of message item view functions available for customization:
+Enables developers to define and apply text formatters that dynamically modify or transform message content before rendering it in the UI. Text formatters can be used for:
-| Function | Message Type |
-| -------------------------------- | ---------------------|
-| **setTextMessageItemView** | Text Message |
-| **setImageMessageItemView** | Image Message |
-| **setVideoMessageItemView** | Video Message |
-| **setAudioMessageItemView** | Audio Message |
-| **setDocumentMessageItemView** | Document Message |
-| **setLinkMessageItemView** | Link Message |
+* Automatically converting URLs into clickable links
+* Applying Markdown or rich text styling
+* Replacing certain words or patterns with emojis or predefined text
+* Censoring specific words for moderation
-#### DateTime Formatters
+For implementation details, refer to the [MentionsFormatter Guide](/ui-kit/android/mentions-formatter-guide).
-#### setDateTimeFormatter
+### Date/Time Formatting
-By providing a custom implementation of the DateTimeFormatterCallback, you can configure how time and date values are displayed. This ensures consistent formatting for labels such as "Today", "Yesterday", "X minutes ago", and more.
+#### `setDateTimeFormatter`
-Each method in the interface corresponds to a specific case:
+Provides a custom implementation of `DateTimeFormatterCallback` to configure how time and date values are displayed in search results.
-`time(long timestamp)` → Custom full timestamp format
+
+
- override fun lastWeek(timestamp: Long): String {
- return "Last Week"
- }
+```xml themes.xml lines
+
-#### Text Formatters
+
+```
-#### setTextFormatters
+> **What this does:** Defines a custom search style that sets a light purple background color (`#EDEAFA`) for the search component, conversation items, and message items, and applies a Times New Roman font to all text elements including filter chips, section headers, conversation titles/subtitles, message titles/subtitles, timestamps, "see more" text, and the search bar.
-This method enables developers to define and apply text formatters that dynamically modify or transform message content before rendering it in the UI. Text formatters can be used for purposes such as:
+
+
-
-
+---
+
+## Next Steps
+
+
+
+
+### Apply a theme to a specific activity
+What you're changing: The theme for a single activity.
+
+- **Where to change it**: `AndroidManifest.xml`.
+
+- **Applies to**: Only the targeted activity.
+
+- **Default behavior**: Activities inherit the application theme.
+
+- **Override**: Set `android:theme` on the `
-
+- **What this does**: Applies `ChatTheme` only to `ChatActivity`.
-## Customization
+- **Verify**: Open `ChatActivity` and confirm the theme differs from the rest of the app.
-To customize the primary color in your app, you can override the cometchatPrimaryColor attribute in your theme. Here's how:
+### Change the primary color
+What you're changing: The primary brand color used across UI Kit.
-```html
-
-
```
-To know more such attributes, visit the [theme attributes file](https://github.com/cometchat/cometchat-uikit-android/blob/v5/chatuikit/src/main/res/values/attr_cometchat_theme.xml).
+- **What this does**: Replaces the UI Kit primary color with your brand color.
+
+- **Verify**: Buttons and highlights use the new color.
+
+### Customize common theme attributes
+What you're changing: Background, text, and stroke colors.
+
+- **Where to change it**: `app/src/main/res/values/themes.xml`.
+
+- **Applies to**: All UI Kit components that use these attributes.
+
+- **Default behavior**: UI Kit uses its default theme values.
+
+- **Override**: Define the attributes in your app theme.
+
+- **Code**:
+
+```xml themes.xml lines
+
+```
+
+- **What this does**: Updates common UI Kit colors in one place.
+
+- **Verify**: Backgrounds, text, and dividers reflect the new values.
+
+### Add dark mode overrides
+What you're changing: Theme values used in dark mode.
+
+- **Where to change it**: `app/src/main/res/values-night/themes.xml`.
+
+- **Applies to**: Dark mode only.
+
+- **Default behavior**: Dark mode uses the same values as light mode.
+
+- **Override**: Create `values-night/themes.xml` and override the attributes.
+
+- **Code**:
+
+```xml values-night/themes.xml lines
+
+
+
+```xml themes.xml lines
+
+
+
+
+```
+
+
@@ -14,7 +13,7 @@ The **CometChat v5 Android UI Kit** streamlines the integration of in-app chat f
## Integration
-In **v4**, integration was straightforward due to the availability of composite components like `CometChatConversationsWithMessages`. This single component provided end-to-end functionality, including listing conversations, handling conversation clicks, loading messages (message header, list, composer), displaying user or group details, and supporting threaded messages. Developers could achieve all these features with minimal setup. However, customization posed significant challenges. Customizing the UI or adding custom views required a deep understanding of the internal flow of the composite component. Additionally, configurations were a mix of custom view props, behavioural props, and style props, which often led to confusion. Styling deeply nested components also proved cumbersome, limiting the developer’s ability to make meaningful changes.
+In **v4**, integration was straightforward due to the availability of composite components like `CometChatConversationsWithMessages`. This single component provided end-to-end functionality, including listing conversations, handling conversation clicks, loading messages (message header, list, composer), displaying user or group details, and supporting threaded messages. Developers could achieve all these features with minimal setup. However, customization posed significant challenges. Customizing the UI or adding custom views required a deep understanding of the internal flow of the composite component. Additionally, configurations were a mix of custom view props, behavioural props, and style props, which often led to confusion. Styling deeply nested components also proved cumbersome, limiting the developer's ability to make meaningful changes.
@@ -22,7 +21,7 @@ In **v4**, integration was straightforward due to the availability of composite
With **v5**, composite components have been replaced with smaller, modular components, such as `Conversations`, `Message Header`, `Message List`, and `Message Composer`. This modular approach makes integration more flexible and easier to understand. Each component has a well-defined purpose, allowing developers to use them in ways that suit their specific requirements. The need for complex configurations has been eliminated, as developers can now customize behavior and styling directly via props. Styling has been significantly simplified, with every component carefully assigned, enabling developers to customize styles globally or at the component level effortlessly.
-To support the transition from v4 to v5, CometChat has built a [sample app](https://github.com/cometchat/cometchat-uikit-android) that replicates the functionality of v4’s composite components. This sample app serves as a reference for developers looking to build additional features such as user/group details, call log details, threaded messages, and advanced messaging capabilities. By following this approach, developers can take full advantage of v5’s modular design while implementing complex functionality in an organized manner.
+To support the transition from v4 to v5, CometChat has built a [sample app](https://github.com/cometchat/cometchat-uikit-android) that replicates the functionality of v4's composite components. This sample app serves as a reference for developers looking to build additional features such as user/group details, call log details, threaded messages, and advanced messaging capabilities. By following this approach, developers can take full advantage of v5's modular design while implementing complex functionality in an organized manner.
@@ -64,11 +63,11 @@ In **v5**, the composite approach is replaced with smaller, modular components l
In **v4**, theming was managed using the `Palette` and `Typography` classes. The `Palette` class provided methods like `background`, `mode`, `primary`, `secondary`, and similar setters for configuring colors and themes. While this approach worked, it required instantiating multiple objects and passing them through constructors, which added complexity to the theming process. Developers had to create palette and typography instances, configure them with various color and font settings, and then pass them to create a theme object.
-The reliance on Context for theming introduced several challenges. Customizing themes often required developers to consume the theme from the context and then explicitly update values programmatically, which added unnecessary complexity. For example, switching between light and dark modes required interacting with the theme’s context and invoking specific methods like `mode`. This process was less straightforward compared to the traditional approach to define themes dynamically.
+The reliance on Context for theming introduced several challenges. Customizing themes often required developers to consume the theme from the context and then explicitly update values programmatically, which added unnecessary complexity. For example, switching between light and dark modes required interacting with the theme's context and invoking specific methods like `mode`. This process was less straightforward compared to the traditional approach to define themes dynamically.
-You can indeed create a custom layout file named `custom_user_title_view.xml` for more complex or unique list items.
-
-Once this layout file is made, you would inflate it inside the `createView()` method of the `UsersViewHolderListener`. The inflation process prepares the layout for use in your application:
+Create a `custom_user_title_view.xml` layout:
-Following this, you would use the `bindView()` method to initialize and assign values to your individual views. This could include setting text on TextViews, images on ImageViews, and so on based on the properties of the User object:
-
-```xml custom_user_title_view.xml
+```xml custom_user_title_view.xml lines
+
-You can indeed create a custom layout file named `custom_user_tail_view.xml` for more complex or unique list items.
-
-Once this layout file is made, you would inflate it inside the `createView()` method of the `UsersViewHolderListener`. The inflation process prepares the layout for use in your application:
+Create a `custom_user_tail_view.xml` layout:
-Following this, you would use the `bindView()` method to initialize and assign values to your individual views. This could include setting text on TextViews, images on ImageViews, and so on based on the properties of the User object:
-
-```xml custom_user_tail_view.xml
+```xml custom_user_tail_view.xml lines
-You can indeed create a custom layout file named `custom_list_item_view.xml` for more complex or unique list items.
+Create a `custom_list_item_view.xml` layout:
-Once this layout file is made, you would inflate it inside the `createView()` method of the `UsersViewHolderListener`. The inflation process prepares the layout for use in your application:
-
-Following this, you would use the `bindView()` method to initialize and assign values to your individual views. This could include setting text on TextViews, images on ImageViews, and so on based on the properties of the User object:
-
-```xml custom_list_item_view.xml
+```xml custom_list_item_view.xml lines
+
-You can indeed create a custom layout file named `subtitle_layout.xml` for more complex or unique list items.
+
-
+Returns the list of currently selected `User` objects.
+
+
+```xml themes.xml lines
+
+
```
+
-## Usage
-
-### Integration
-
-##### Using Navigation Controller to Present `CometChatAIAssistantChatHistory`
-
-The `CometChatAIAssistanceChatHistory` component can be launched using a navigation controller.
-This approach is ideal when you want to present the chat history as a standalone screen within your app’s navigation flow
-
-
-
-
-***
+import UIKit
+import CometChatUIKitSwift
+
+class CustomErrorView: UIView {
+
+ private let iconView: UIImageView = {
+ let iv = UIImageView()
+ iv.image = UIImage(systemName: "exclamationmark.triangle")
+ iv.tintColor = .systemRed
+ iv.contentMode = .scaleAspectFit
+ iv.translatesAutoresizingMaskIntoConstraints = false
+ return iv
+ }()
+
+ private let titleLabel: UILabel = {
+ let label = UILabel()
+ label.text = "Something went wrong"
+ label.font = .systemFont(ofSize: 18, weight: .semibold)
+ label.textAlignment = .center
+ label.translatesAutoresizingMaskIntoConstraints = false
+ return label
+ }()
+
+ private let messageLabel: UILabel = {
+ let label = UILabel()
+ label.text = "We couldn't load your AI chat history.\nPlease check your connection."
+ label.font = .systemFont(ofSize: 14)
+ label.textColor = .secondaryLabel
+ label.textAlignment = .center
+ label.numberOfLines = 0
+ label.translatesAutoresizingMaskIntoConstraints = false
+ return label
+ }()
+
+ let retryButton: UIButton = {
+ let button = UIButton(type: .system)
+ button.setTitle("Try Again", for: .normal)
+ button.titleLabel?.font = .systemFont(ofSize: 16, weight: .medium)
+ button.backgroundColor = .systemBlue
+ button.setTitleColor(.white, for: .normal)
+ button.layer.cornerRadius = 10
+ button.translatesAutoresizingMaskIntoConstraints = false
+ return button
+ }()
+
+ override init(frame: CGRect) {
+ super.init(frame: frame)
+ setupUI()
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ private func setupUI() {
+ addSubview(iconView)
+ addSubview(titleLabel)
+ addSubview(messageLabel)
+ addSubview(retryButton)
+
+ NSLayoutConstraint.activate([
+ iconView.centerXAnchor.constraint(equalTo: centerXAnchor),
+ iconView.centerYAnchor.constraint(equalTo: centerYAnchor, constant: -60),
+ iconView.widthAnchor.constraint(equalToConstant: 60),
+ iconView.heightAnchor.constraint(equalToConstant: 60),
+
+ titleLabel.topAnchor.constraint(equalTo: iconView.bottomAnchor, constant: 16),
+ titleLabel.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 24),
+ titleLabel.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -24),
+
+ messageLabel.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 8),
+ messageLabel.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 24),
+ messageLabel.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -24),
+
+ retryButton.topAnchor.constraint(equalTo: messageLabel.bottomAnchor, constant: 20),
+ retryButton.centerXAnchor.constraint(equalTo: centerXAnchor),
+ retryButton.widthAnchor.constraint(equalToConstant: 140),
+ retryButton.heightAnchor.constraint(equalToConstant: 44)
+ ])
+ }
+}
-### Functionality
+// Usage
+let chatHistory = CometChatAIAssistanceChatHistory()
+chatHistory.user = user
-These functional customizations allow you to fine-tune the overall behavior and user experience of the component.
-With these options, you can modify text, customize icons, and toggle visibility for specific UI elements within the `CometChatAIAssistanceChatHistory` component.
+let errorView = CustomErrorView()
+errorView.retryButton.addTarget(self, action: #selector(retryLoading), for: .touchUpInside)
-
-## Conversation Starters
+| Feature | What It Does | Where It Appears |
+|---------|--------------|------------------|
+| Conversation Starters | Suggests opening messages for new chats | `CometChatMessageList` |
+| Smart Replies | Suggests responses based on context | `CometChatMessageComposer` |
+| Conversation Summary | Summarizes long conversations | `CometChatMessageComposer` |
+| AI Assistant | Chat with AI bot | `CometChatAIAssistanceChatHistory` |
+
+---
+
+## Enable AI Features
+
+
-## Smart Replies
+### How It Works
+
+1. User opens chat with someone they haven't messaged before
+2. AI analyzes user profiles and context
+3. Suggested messages appear in the message list
+4. User taps a suggestion to send it
+
+### Implementation
+
+Conversation starters appear automatically in `CometChatMessages`:
+
+
-## Conversation Summary
+### How It Works
+
+1. User receives a message
+2. AI analyzes the message and conversation context
+3. Smart reply suggestions appear in the composer action sheet
+4. User taps a suggestion to insert it
+
+### Implementation
+
+Smart replies appear automatically in `CometChatMessageComposer`:
+
+
+
+### How It Works
+
+1. User opens a conversation with many messages
+2. User taps the summary option in composer action sheet
+3. AI processes the conversation
+4. Summary of key points is displayed
+
+### Implementation
+
+Conversation summary is available automatically:
+
+
+
+
+
List of properties exposed by ButtonStyle
@@ -332,3 +374,95 @@ callButtons.set(controller: UIViewController) // Passing the controller is requi
***
+
+## Props
+
+All props are optional.
+
+---
+
+### user
+
+The user for 1-on-1 call buttons. Pass either `user` or `group`, not both.
+
+| | |
+|---|---|
+| Type | `User?` |
+| Default | `nil` |
+
+---
+
+### group
+
+The group for group call buttons. Pass either `user` or `group`, not both.
+
+| | |
+|---|---|
+| Type | `Group?` |
+| Default | `nil` |
+
+---
+
+### hideVoiceCallButton
+
+Hides the voice call button.
+
+| | |
+|---|---|
+| Type | `Bool` |
+| Default | `false` |
+
+---
+
+### hideVideoCallButton
+
+Hides the video call button.
+
+| | |
+|---|---|
+| Type | `Bool` |
+| Default | `false` |
+
+---
+
+### outgoingCallConfiguration
+
+Configuration object for the internal `CometChatOutgoingCall` sub-component.
+
+| | |
+|---|---|
+| Type | `OutgoingCallConfiguration` |
+| Default | `OutgoingCallConfiguration()` |
+
+---
+
+### customSoundForCalls
+
+Custom sound file URL for calls.
+
+| | |
+|---|---|
+| Type | `URL?` |
+| Default | `nil` |
+
+---
+
+## Events
+
+Events emitted by the Call Buttons component:
+
+| Event | Description |
+|-------|-------------|
+| `onOutgoingCallAccepted` | Triggers when the outgoing call is accepted |
+| `onOutgoingCallRejected` | Triggers when the outgoing call is rejected |
+| `onCallEnded` | Triggers when the call ends |
+
+---
+
+## Related Components
+
+- [Incoming Call](/ui-kit/ios/incoming-call) - Display incoming call interface
+- [Outgoing Call](/ui-kit/ios/outgoing-call) - Display outgoing call interface
+- [Call Logs](/ui-kit/ios/call-logs) - Display call history
+
+***
diff --git a/ui-kit/ios/call-features.mdx b/ui-kit/ios/call-features.mdx
index c22dfa285..d39515839 100644
--- a/ui-kit/ios/call-features.mdx
+++ b/ui-kit/ios/call-features.mdx
@@ -1,39 +1,47 @@
---
-title: "Call"
+title: "Calling Features"
+sidebarTitle: "Call"
+description: "Complete guide to adding voice and video calling to iOS apps with CometChat UI Kit - production-ready code included"
---
-## Overview
-
-CometChat's Calls feature is an advanced functionality that allows you to seamlessly integrate one-on-one as well as group audio and video calling capabilities into your application. This document provides a technical overview of these features, as implemented in the iOS UI Kit.
-
-## Integration
-
-First, make sure that you've correctly integrated the UI Kit library into your project. If you haven't done this yet or are facing difficulties, refer to our [Getting Started](/ui-kit/ios/getting-started) guide. This guide will walk you through a step-by-step process of integrating our UI Kit into your iOS project.
-
-Once you've successfully integrated the UI Kit, the next step is to add the CometChat Calls SDK to your project. This is necessary to enable the calling features in the UI Kit. Here's how you do it:
-
-**1. CocoaPods**
-
-We recommend using CocoaPods, as they are the most advanced way of managing iOS project dependencies. Open a terminal window, move to your project directory, and then create a Podfile by running the following command.
-
-
+
-```ruby Swift
-$ pod init
-```
+---
-Add the following lines to the Podfile.
+## Quick Setup
-```ruby Swift
-platform :ios, '11.0'
+
-
+incomingCall.set(onAcceptClick: { call in })
+incomingCall.set(onDeclineClick: { call in })
+```
-## Features
+### CometChatOutgoingCall
-### Incoming Call
+Displays outgoing call screen while waiting for answer.
-The [Incoming Call](/ui-kit/ios/incoming-call) component of the CometChat UI Kit provides the functionality that lets users receive real-time audio and video calls in the app.
+```swift
+let outgoingCall = CometChatOutgoingCall()
+outgoingCall.set(call: call)
-When a call is made to a user, the Incoming Call component triggers and displays a call screen. This call screen typically displays the caller information and provides the user with options to either accept or reject the incoming call.
+outgoingCall.set(onCancelClick: { call in })
+```
-
-
-
+### CometChatCallLogs
+
+Displays call history. See [Call Logs](/ui-kit/ios/call-logs) for full documentation.
-### Outgoing Call
+```swift
+let callLogs = CometChatCallLogs()
+callLogs.set(onItemClick: { callLog, indexPath in })
+```
-The [Outgoing Call](/ui-kit/ios/incoming-call) component of the CometChat UI Kit is designed to manage the outgoing call process within your application. When a user initiates an audio or video call to another user or group, this component displays an outgoing call screen, showcasing information about the recipient and the call status.
+---
-Importantly, the Outgoing Call component is smartly designed to transition automatically into the ongoing call screen once the receiver accepts the call. This ensures a smooth flow from initiating the call to engaging in a conversation, without any additional steps required from the user.
+## Troubleshooting
-
-
-
+| Problem | Solution |
+|---------|----------|
+| Call buttons not showing | Verify `CometChatCallsSDK` is in Podfile and run `pod install` |
+| "Permission denied" error | Add camera/microphone permissions to Info.plist |
+| Calls not connecting | Check network connection and CometChat credentials |
+| No incoming call UI | Ensure `CometChatCallsSDK` is initialized before login |
+| Audio not working | Check device is not on silent mode |
-### Call Logs
+---
-[Call Logs](/ui-kit/ios/call-logs) component provides you with the records call events such as who called who, the time of the call, and the duration of the call. This information can be fetched from the CometChat server and displayed in a structured format for users to view their past call activities.
+## Related
-
-
-
+- [Call Logs](/ui-kit/ios/call-logs) - Display call history
+- [Call Buttons](/ui-kit/ios/call-buttons) - Call button component
+- [Incoming Call](/ui-kit/ios/incoming-call) - Incoming call screen
+- [Outgoing Call](/ui-kit/ios/outgoing-call) - Outgoing call screen
+- [Ongoing Call](/ui-kit/ios/ongoing-call) - Active call screen
diff --git a/ui-kit/ios/call-logs.mdx b/ui-kit/ios/call-logs.mdx
index f59346b3a..503e71e94 100644
--- a/ui-kit/ios/call-logs.mdx
+++ b/ui-kit/ios/call-logs.mdx
@@ -1,15 +1,64 @@
---
title: "Call Logs"
+description: "Displays a list of call logs with call type, duration, and participant information"
---
-## Overview
-
-`CometChatCallLogs` is a [Component](/ui-kit/ios/components-overview#components) that shows the list of Call Log available . By default, names are shown for all listed users, along with their avatar if available.
+The `CometChatCallLogs` component shows the list of call logs available. By default, names are shown for all listed users, along with their avatar if available.
-
+
+
+
List of properties exposed by CallLogStyle
@@ -432,7 +481,7 @@ callLogs.set(listItemView: { callLog in
-
+
+
+
+
+
+
+
+
+
-
+---
+
+## Dark Mode Support
-Example: Dark Mode Color Usage
+CometChat automatically adapts to system appearance. You can also customize dark mode colors:
-
+---
+
+## Troubleshooting
+
+| Problem | Solution |
+|---------|----------|
+| Colors not applying | Apply theme before `CometChatUIKit.init()` |
+| Dark mode not working | Use `UIColor { traitCollection in }` for dynamic colors |
+| Inconsistent colors | Set all related colors (text, background, border) together |
+
+---
+
+## Related
+
+- [Component Styling](/ui-kit/ios/component-styling) - Style individual components
+- [Theme Introduction](/ui-kit/ios/theme-introduction) - Complete theming guide
+- [Getting Started](/ui-kit/ios/getting-started) - Initial setup
diff --git a/ui-kit/ios/component-styling.mdx b/ui-kit/ios/component-styling.mdx
index 369923b4e..f3308ea0a 100644
--- a/ui-kit/ios/component-styling.mdx
+++ b/ui-kit/ios/component-styling.mdx
@@ -1,240 +1,320 @@
---
title: "Component Styling"
+sidebarTitle: "Component Styling"
+description: "Complete guide to styling CometChat iOS UI Kit components - colors, fonts, and custom appearances"
---
## Overview
-CometChat UIKit for iOS enables developers to integrate customizable components into their applications effortlessly. Each component is designed to ensure a consistent user experience, offering flexibility to align with your app’s design system. You can modify attributes such as colors, fonts, sizes, and more using CometChatTheme or directly applying styles to components.
+Every CometChat component can be styled to match your app's design. You can apply styles globally (affects all instances) or per-instance (affects one component).
-Below is a detailed guide for styling individual components within the UIKit.
-
-## Components
+---
-### Conversations
+## Styling Methods
-The `CometChatConversations` component provides a list of recent chats, displaying participants, message previews, and timestamps. It supports default themes while offering extensive customization for text appearance, icons, and layout. This component allows you to create an intuitive and visually appealing chat list that matches your app's branding.
+### Global Styling
-You can check out the list of styling properties offered by [CometChatConversations](https://github.com/cometchat/cometchat-uikit-ios/blob/v5/CometChatUIKitSwift/Components/Conversations/ConversationsStyle.swift)
+Apply once, affects all instances of a component:
-
-
-### Users
+### Instance Styling
-The CometChatUsers component displays a scrollable list of users, ideal for showcasing available contacts for messaging, calls, or group creation. Customization includes user avatars, status indicators, and list backgrounds, enabling alignment with your app's design system.
-
-You can check out the list of styling properties offered by [CometChatUsers](https://github.com/cometchat/cometchat-uikit-ios/blob/v5/CometChatUIKitSwift/Components/Users/UsersStyle.swift)
+Apply to a specific component instance:
-
+---
-### Groups
+## Component Styles
-The CometChatGroups component enables displaying and interacting with chat groups. Each group item highlights key details like group name, participant count, and last active time. Developers can customize avatar styles, fonts, borders, and background colors.
+### Conversations
-You can check out the list of styling properties offered by [CometChatGroups](https://github.com/cometchat/cometchat-uikit-ios/blob/v5/CometChatUIKitSwift/Components/Groups/GroupsStyle.swift)
+
+
+
+
+
-
+[View all UsersStyle properties →](https://github.com/cometchat/cometchat-uikit-ios/blob/v5/CometChatUIKitSwift/Components/Users/UsersStyle.swift)
-### Message Header
+---
-The CometChatMessageHeader component displays essential information about the active chat, such as the recipient's name, avatar, and status (online/offline). It also includes navigation, search, or menu buttons. Customization options include header background, text appearance, and icon styles.
+### Groups
-You can check out the list of styling properties offered by [CometChatMessageHeader](https://github.com/cometchat/cometchat-uikit-ios/blob/v5/CometChatUIKitSwift/Components/Message%20Header/MessageHeaderStyle.swift)
+
+
+
-
+[View all GroupsStyle properties →](https://github.com/cometchat/cometchat-uikit-ios/blob/v5/CometChatUIKitSwift/Components/Groups/GroupsStyle.swift)
-### Message List
+---
-The CometChatMessageList component displays a conversation's sequence of messages, supporting text, media, reactions, and more. Developers can customize bubble colors, text appearance, timestamps, and alignment to enhance the chat experience.
+### Message Header
-You can check out the list of styling properties offered by [CometChatMessageList](https://github.com/cometchat/cometchat-uikit-ios/blob/v5/CometChatUIKitSwift/Components/Message%20List/MessageListStyle.swift)
+
+
+
-
+[View all MessageHeaderStyle properties →](https://github.com/cometchat/cometchat-uikit-ios/blob/v5/CometChatUIKitSwift/Components/Message%20Header/MessageHeaderStyle.swift)
-### Message Composer
+---
-The CometChatMessageComposer component provides users with an interface to compose and send messages, including text, attachments, and stickers. Developers can style input boxes, buttons, and icons to match their app’s design.
+### Message List
-You can check out the list of styling properties offered by [CometChatMessageList](https://github.com/cometchat/cometchat-uikit-ios/blob/v5/CometChatUIKitSwift/Components/Message%20Composer/MessageComposerStyle.swift)
+
+
+
-
+[View all MessageListStyle properties →](https://github.com/cometchat/cometchat-uikit-ios/blob/v5/CometChatUIKitSwift/Components/Message%20List/MessageListStyle.swift)
-### Call Logs
+---
-The CometChatCallLogs Component provides a comprehensive list of recent voice and video calls. Each call log displays details such as the caller’s name, avatar, call type (audio/video), call status (missed, incoming, outgoing), and timestamps. This component ensures smooth integration and allows developers to customize styles, icons, and colors to align with the app’s branding.
+### Message Composer
-You can check out the list of styling properties offered by [CometChatCallLogs](https://github.com/cometchat/cometchat-uikit-ios/blob/v5/CometChatUIKitSwift/Components/Calls/Call%20Log/Call%20Logs/CallLogStyle.swift)
+
+
+
-### AI Assistant Chat History
-
-The CometChatAIAssistantChatHistory component provides a pre-built interface to display the conversation history between a user and an AI assistant. Each message shows the sender, timestamp, and message content. This component ensures smooth integration and allows developers to customize styles, icons, and colors to align with the app’s branding.
-
@@ -242,129 +322,231 @@ The `CometChatSearch` component allows users to search through conversations and
+
+
+
+
-## Usage
+---
-### Integration
+## Minimal Render
-As CometChatConversations is a custom view controller, it can be initiated either by tapping a button or through the trigger of any event. It offers multiple parameters and methods for tailoring its user interface.
+```swift
+import CometChatUIKitSwift
-```ruby swift
-let cometChatConversations = CometChatConversations()
-self.navigationController.pushViewController(cometChatConversations, animated: true)
+let conversations = CometChatConversations()
+navigationController?.pushViewController(conversations, animated: true)
```
-* Integration (With Custom Request Builder)
+
+
+
+
+---
+
+## Filtering
+
+Use `ConversationRequest.ConversationRequestBuilder` to filter which conversations appear in the list. The builder pattern allows chaining multiple filter conditions.
-During the initialization of **CometChatConversations,** users can provide this custom request builder.
+```swift
+import CometChatUIKitSwift
+import CometChatSDK
-```ruby swift
-// You can create ConversationRequestBuilder as per your requirement
-let conversationRequestBuilder = ConversationRequest.ConversationRequestBuilder(limit: 20).set(conversationType: .both)
+// Create a custom request builder
+let requestBuilder = ConversationRequest.ConversationRequestBuilder(limit: 30)
+ .set(conversationType: .both)
-let cometChatConversations = CometChatConversations(conversationRequestBuilder: conversationRequestBuilder)
-self.navigationController.pushViewController(cometChatConversations, animated: true)
+let conversations = CometChatConversations(conversationRequestBuilder: requestBuilder)
```
-
+
-
-
+Sets custom text formatters for processing and displaying message text in conversation subtitles.
-List of properties exposed by ConversationStyle
-
-| **Property** | **Description** | **Code** |
-| ------------------------------- | ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
-| **Background Color** | Used to set the background color of the conversation screen. | `CometChatConversation.style.backgroundColor = UIColor.white` |
-| **Background Drawable** | Used to set a background image for the conversation screen. | `CometChatConversation.style.backgroundDrawable = UIImage(named: "background")` |
-| **Border Width** | Used to set the border width of the conversation UI. | `CometChatConversation.style.borderWidth = 2.0` |
-| **Border Color** | Used to set the border color of the conversation UI. | `CometChatConversation.style.borderColor = UIColor.gray` |
-| **Corner Radius** | Used to set the corner radius of the conversation UI. | `CometChatConversation.style.cornerRadius = 10.0` |
-| **Back Icon Tint** | Used to set the tint color of the back icon in the conversation UI. | `CometChatConversation.style.backIconTint = UIColor.blue` |
-| **Back Icon** | Used to set a custom back icon for the conversation UI. | `CometChatConversation.style.backIcon = UIImage(named: "customBackIcon")` |
-| **Separator Color** | Used to set the color of separators in the conversation list. | `CometChatConversation.style.separatorColor = UIColor.lightGray` |
-| **Separator Width** | Used to set the width of separators in the conversation list. | `CometChatConversation.style.separatorWidth = 1.0` |
-| **Error Text Color** | Used to set the color of error messages in the conversation UI. | `CometChatConversation.style.errorTextColor = UIColor.red` |
-| **Last Message Text Color** | Used to set the color of the last message text in the conversation list. | `CometChatConversation.style.lastMessageTextColor = UIColor.darkGray` |
-| **Typing Indicator Color** | Used to set the color of the typing indicator in the conversation UI. | `CometChatConversation.style.typingIndicatorColor = UIColor.green` |
-| **Title Appearance** | Used to customize the appearance of the conversation screen's title. | `CometChatConversation.style.titleAppearance = UIFont.boldSystemFont(ofSize: 18.0)` |
-| **Last Message Appearance** | Used to customize the appearance of the last message text in the list. | `CometChatConversation.style.lastMessageAppearance = UIFont.italicSystemFont(ofSize: 14.0)` |
-| **Thread Indicator Appearance** | Used to customize the appearance of thread indicators in the list. | `CometChatConversation.style.threadIndicatorTextAppearance = UIFont.systemFont(ofSize: 12.0)` |
-| **Avatar Style** | Used to customize the appearance of avatars in the conversation list. | `CometChatConversation.style.avatarStyle = customAvatarStyle` |
-| **Status Indicator Style** | Used to customize the style of status indicators for online/offline members. | `CometChatConversation.style.statusIndicatorStyle = customStatusIndicatorStyle` |
-| **Date Style** | Used to customize the appearance of date labels in the conversation list. | `CometChatConversation.style.dateStyle = customDateStyle` |
-| **Badge Style** | Used to customize the appearance of badges in the conversation list. | `CometChatConversation.style.badgeStyle = customBadgeStyle` |
-| **List Item Style** | Used to customize the appearance of the list items in the conversation list. | `CometChatConversation.style.listItemStyle = customListItemStyle` |
-
-##### 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](/ui-kit/ios/component-styling#avatar).
-
-**Global level styling**
-
-
-
+| | |
+|---|---|
+| Type | `BadgeStyle` |
+| Default | `BadgeStyle()` |
-##### 4. Badge Style
+```swift
+import CometChatUIKitSwift
-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](https://www.cometchat.com/docs/ui-kit/ios/component-styling#badge)
+let conversations = CometChatConversations()
-**Global level styling**
+let badgeStyle = BadgeStyle()
+badgeStyle.backgroundColor = UIColor.systemRed
+badgeStyle.textColor = UIColor.white
+badgeStyle.textFont = UIFont.systemFont(ofSize: 12, weight: .bold)
+badgeStyle.cornerRadius = CometChatCornerStyle(cornerRadius: 10)
-
-
+```swift
+import CometChatUIKitSwift
+
+let conversations = CometChatConversations()
-### Functionality
+let dateStyle = DateStyle()
+dateStyle.textColor = UIColor.secondaryLabel
+dateStyle.textFont = UIFont.systemFont(ofSize: 12)
-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.
+conversations.set(dateStyle: dateStyle)
+```
-Below is a list of customizations along with corresponding code snippets
+### dateTimeFormatter
-| Property | Description | Code |
-| ---------------------------- | ------------------------------------------ | ------------------------------------- |
-| hideErrorView | Hides the error state view. | `hideErrorView = true` |
-| hideNavigationBar | Hides or shows the navigation bar. | `hideNavigationBar = true` |
-| hideSearch | Hides the search bar. | `hideSearch = true` |
-| hideBackButton | Hides the back button. | `hideBackButton = true` |
-| hideLoadingState | Hides the loading state indicator. | `hideLoadingState = true` |
-| hideReceipts | Hides message read/delivery receipts. | `hideReceipts = true` |
-| hideDeleteConversationOption | Hides the option to delete a conversation. | `hideDeleteConversationOption = true` |
-| hideUserStatus | Hides the online/offline status of users. | `hideUserStatus = true` |
-| hideGroupType | Hides the group type (private/public). | `hideGroupType = true` |
+Custom formatter for date/time display in conversation list items.
-### Advanced
+| | |
+|---|---|
+| Type | `CometChatDateTimeFormatter?` |
+| Default | `nil` |
-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.
+```swift
+import CometChatUIKitSwift
-***
+let conversations = CometChatConversations()
-#### Date Time Formatter
+let dateTimeFormatter = CometChatDateTimeFormatter()
+dateTimeFormatter.todayFormat = "h:mm a"
+dateTimeFormatter.yesterdayFormat = "'Yesterday'"
+dateTimeFormatter.otherFormat = "MMM d"
-The **CometChatConversations** component supports full customization of how date and time are displayed using the [CometChatDateTimeFormatter](/ui-kit/ios/localize#datetimeformatter).
+conversations.dateTimeFormatter = dateTimeFormatter
+```
-This enables developers to localize, format, or personalize the date and time strings shown next to each conversation—such as “Today”, “Yesterday”, “12:45 PM”, etc.
+### customSoundForMessages
-1. Component-Level (Global)
+Custom sound URL for new message notifications.
-
-
+### hideUserStatus
+
+Hides online/offline status indicators.
-***
+| | |
+|---|---|
+| Type | `Bool` |
+| Default | `false` |
-#### SetOptions
+### onSearchClick
-You can define custom options for each conversation using .set(options:). This method allows you to return an array of CometChatConversationOption based on the conversation object.
+Callback triggered when the search button is clicked.
+
+| | |
+|---|---|
+| Type | `(() -> Void)?` |
+| Default | `nil` |
-
-
+### statusIndicatorStyle
-You can create a `CustomListItemView` as a custom `UIView`. Which we will inflate in `setListItemView()`
+Customizes the appearance of online/offline status indicators.
-```swift swift
+| | |
+|---|---|
+| Type | `StatusIndicatorStyle` |
+| Default | `StatusIndicatorStyle()` |
-import UIKit
+```swift
import CometChatUIKitSwift
-class CustomListItem: UIView {
- // Initialize UI components
- private var profileImageView: CometChatAvatar = {
- let imageView = CometChatAvatar(image: UIImage())
- imageView.translatesAutoresizingMaskIntoConstraints = false // Important for manual layout
- return imageView
- }()
+let conversations = CometChatConversations()
- private var nameLabel: UILabel = {
- let label = UILabel()
- label.translatesAutoresizingMaskIntoConstraints = false // Important for manual layout
- return label
- }()
+let statusIndicatorStyle = StatusIndicatorStyle()
+statusIndicatorStyle.backgroundColor = UIColor.systemGreen
+statusIndicatorStyle.borderWidth = 2
+statusIndicatorStyle.borderColor = UIColor.white
- override init(frame: CGRect) {
- super.init(frame: frame)
- setupUI()
- }
+conversations.set(statusIndicatorStyle: statusIndicatorStyle)
+```
- required init?(coder aDecoder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
+### textFormatters
- private func setupUI() {
- addSubview(profileImageView)
- addSubview(nameLabel)
-
- NSLayoutConstraint.activate([
- // Profile image constraints
- profileImageView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 8),
- profileImageView.centerYAnchor.constraint(equalTo: centerYAnchor),
- profileImageView.widthAnchor.constraint(equalToConstant: 40),
- profileImageView.heightAnchor.constraint(equalToConstant: 40),
-
- nameLabel.leadingAnchor.constraint(equalTo: profileImageView.trailingAnchor, constant: 8),
- nameLabel.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -8),
- nameLabel.centerYAnchor.constraint(equalTo: centerYAnchor)
- ])
- }
+Array of text formatters for customizing message text display.
- func set(conversation: Conversation) {
- var avatarURL: String?
- if let group = conversation.conversationWith as? Group {
- nameLabel.text = group.name
- avatarURL = group.icon
- }
+| | |
+|---|---|
+| Type | `[CometChatTextFormatter]` |
+| Default | `[]` |
- if let user = conversation.conversationWith as? User {
- nameLabel.text = user.name
- avatarURL = user.avatar
- }
+### typingIndicatorStyle
+Customizes the appearance of typing indicators in conversation list items.
+| | |
+|---|---|
+| Type | `TypingIndicatorStyle` |
+| Default | `TypingIndicatorStyle()` |
+```swift
+import CometChatUIKitSwift
- self.profileImageView.setAvatar(avatarUrl: avatarURL, with: nameLabel.text)
- }
-}
-```
+let conversations = CometChatConversations()
-***
+let typingIndicatorStyle = TypingIndicatorStyle()
+typingIndicatorStyle.textColor = UIColor.systemGray
+typingIndicatorStyle.textFont = UIFont.italicSystemFont(ofSize: 14)
-#### SetLeadingView
+conversations.set(typingIndicatorStyle: typingIndicatorStyle)
+```
-You can modify the leading view of a conversation cell using .set(leadingView:).
+---
-
-
+Customize how timestamps appear in the conversation list using the `datePattern` callback.
-You can create a `CustomLeadingView` as a custom `UIView`. Which we will inflate in `setLeadingView()`
+### Global Level Formatting
-
-
+```swift
+import CometChatUIKitSwift
-You can create a `CustomTitleView` as a custom `UIView`. Which we will inflate in `setTitleView()`
+let conversations = CometChatConversations()
-
-
+let conversations = CometChatConversations()
-You can create a `CustomTrailView` as a custom `UIView`. Which we will inflate in `setTrailView()`
+// Set a custom label for @all mentions
+conversations.setMentionAllLabel("all", "Everyone")
+```
-
-
-
-You need to create a `SubtitleView` a custom `UIView` `cocoa touch file` and inflate it in the setSubtitleView apply function. Then, you can define individual actions depending on your requirements.
-
-* `SubtitleView` file should should appear as follows:
-
-```swift swift
import UIKit
import CometChatUIKitSwift
import CometChatSDK
-class CustomSubtitleView: UIView {
-
- // MARK: - Properties
- private let subtitleLabel: UILabel = {
- let label = UILabel()
- label.translatesAutoresizingMaskIntoConstraints = false
- label.font = UIFont.systemFont(ofSize: 14, weight: .regular) // Customize font
- label.textColor = .darkGray // Customize text color
- label.numberOfLines = 1 // Single line
- label.textAlignment = .left // Align to the left
- return label
- }()
-
- // MARK: - Initializers
- override init(frame: CGRect) {
- super.init(frame: frame)
- setupView()
- }
+class MainTabBarController: UITabBarController {
- required init?(coder: NSCoder) {
- super.init(coder: coder)
- setupView()
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ setupTabs()
}
- // MARK: - Setup
- private func setupView() {
- addSubview(subtitleLabel)
+ private func setupTabs() {
+ // Conversations Tab
+ let conversationsVC = ConversationsContainerViewController()
+ conversationsVC.tabBarItem = UITabBarItem(
+ title: "Chats",
+ image: UIImage(systemName: "message"),
+ selectedImage: UIImage(systemName: "message.fill")
+ )
+
+ // Users Tab
+ let usersVC = UINavigationController(rootViewController: CometChatUsers())
+ usersVC.tabBarItem = UITabBarItem(
+ title: "Users",
+ image: UIImage(systemName: "person.2"),
+ selectedImage: UIImage(systemName: "person.2.fill")
+ )
- // Constraints
- NSLayoutConstraint.activate([
- subtitleLabel.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 8),
- subtitleLabel.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -8),
- subtitleLabel.topAnchor.constraint(equalTo: topAnchor, constant: 4),
- subtitleLabel.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -4)
- ])
+ // Groups Tab
+ let groupsVC = UINavigationController(rootViewController: CometChatGroups())
+ groupsVC.tabBarItem = UITabBarItem(
+ title: "Groups",
+ image: UIImage(systemName: "person.3"),
+ selectedImage: UIImage(systemName: "person.3.fill")
+ )
+
+ viewControllers = [conversationsVC, usersVC, groupsVC]
}
+}
+
+class ConversationsContainerViewController: UINavigationController {
- // MARK: - Configuration
- func set(conversation: Conversation) {
- subtitleLabel.text = conversation.lastMessage
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let conversations = CometChatConversations()
+
+ // Navigate to messages on tap
+ conversations.set(onItemClick: { [weak self] conversation, _ in
+ let messagesVC = CometChatMessages()
+
+ if let user = conversation.conversationWith as? User {
+ messagesVC.set(user: user)
+ } else if let group = conversation.conversationWith as? Group {
+ messagesVC.set(group: group)
+ }
+
+ self?.pushViewController(messagesVC, animated: true)
+ })
+
+ setViewControllers([conversations], animated: false)
}
}
```
-***
-
-#### SetLoadingView
-
-You can set a custom loading view using .set(loadingView:). This method accepts a UIView to display while data is being fetched.
-
-
-| Components | Functionality |
-| ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [MessageComposer](/ui-kit/ios/message-composer) | [MessageComposer](/ui-kit/ios/message-composer) is a Component that has ActionSheet, ActionSheet is a menu that appears over the context of the app, providing multiple options for sharing media files. |
-| [MessageList](/ui-kit/ios/message-list) | [MessageList](/ui-kit/ios/message-list) is a Component that renders different Media Message bubbles like [Image Bubble](/ui-kit/ios/message-bubble-styling-styling#image-bubble), [File Bubble](/ui-kit/ios/message-bubble-styling-styling), [Audio Bubble](/ui-kit/ios/message-bubble-styling-styling#audio-bubble) [Video Bubble](/ui-kit/ios/message-bubble-styling#video-bubble) |
+```swift
+import UIKit
+import CometChatUIKitSwift
+import CometChatSDK
+
+class ChatViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ // For one-on-one chat
+ let messagesVC = CometChatMessages()
+
+ // Set the user to chat with
+ CometChat.getUser(UID: "user-123") { user in
+ DispatchQueue.main.async {
+ messagesVC.set(user: user)
+ self.navigationController?.pushViewController(messagesVC, animated: true)
+ }
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+}
+```
+
+**Components Used:**
+- [MessageComposer](/ui-kit/ios/message-composer) - Text input and send button
+- [MessageList](/ui-kit/ios/message-list) - Displays sent and received messages
+- [Messages](/ui-kit/ios/message-header) - Complete messaging screen (includes both)
-> [Messages](/ui-kit/ios/message-header) component in CometChat's UI Kit is a comprehensive component that includes both the [MessageComposer](/ui-kit/ios/message-composer) and the [MessageList](/ui-kit/ios/message-list) components. So, if you're looking to implement a messaging feature in your application, using the Messages component would be a straightforward and efficient way to do it.
+## Media Sharing
+
+Share images, videos, audio files, and documents.
+
+```swift
+import UIKit
+import CometChatUIKitSwift
+import CometChatSDK
+
+class MediaChatViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let messagesVC = CometChatMessages()
+
+ // The message composer automatically includes media sharing options
+ // Users can tap the attachment button to share:
+ // - Photos from library
+ // - Camera capture
+ // - Documents
+ // - Audio files
+
+ CometChat.getUser(UID: "user-123") { user in
+ DispatchQueue.main.async {
+ messagesVC.set(user: user)
+ self.navigationController?.pushViewController(messagesVC, animated: true)
+ }
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+
+ // Send media programmatically
+ func sendImage(to receiverUID: String, imageURL: URL) {
+ let mediaMessage = MediaMessage(
+ receiverUid: receiverUID,
+ fileurl: imageURL.absoluteString,
+ messageType: .image,
+ receiverType: .user
+ )
+
+ CometChat.sendMediaMessage(message: mediaMessage) { message in
+ print("Image sent successfully")
+ } onError: { error in
+ print("Error sending image: \(error?.errorDescription ?? "")")
+ }
+ }
+}
+```
+
+**Supported Media Types:**
+| Type | Bubble Component |
+|------|------------------|
+| Images | [Image Bubble](/ui-kit/ios/message-bubble-styling#image-bubble) |
+| Videos | [Video Bubble](/ui-kit/ios/message-bubble-styling#video-bubble) |
+| Audio | [Audio Bubble](/ui-kit/ios/message-bubble-styling#audio-bubble) |
+| Files | [File Bubble](/ui-kit/ios/message-bubble-styling#file-bubble) |
## Read Receipts
-CometChat's Read Receipts feature provides visibility into the message status, letting users know when a message has been delivered and read. This brings clarity to the communication and ensures users are informed about the status of their messages.
+Show when messages are delivered and read.
-| Components | Functionality |
-| ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Conversations](/ui-kit/ios/conversations) | [Conversations](/ui-kit/ios/conversations) is a Component that renders Conversations item List, Conversation item also displays the delivery status of the last message providing users with real-time updates on the status of their messages. |
-| [MessageList](/ui-kit/ios/message-list) | [MessageList](/ui-kit/ios/message-list) is a Component that renders different types of Message bubbles, Read Recept status is an integral part of all message bubbles, no matter the type, and provides real-time updates about the status of the message. |
-| [MessageInformation](/ui-kit/ios/message-information) | [MessageInformation](/ui-kit/ios/message-information) component provides transparency into the status of each sent message, giving the sender insights into whether their message has been delivered and read. |
-
+```swift
+import UIKit
+import CometChatUIKitSwift
+import CometChatSDK
+
+class ReceiptsViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ // Read receipts are enabled by default
+ let messagesVC = CometChatMessages()
+
+ // To hide receipts:
+ // messagesVC.hideReceipts = true
+
+ CometChat.getUser(UID: "user-123") { user in
+ DispatchQueue.main.async {
+ messagesVC.set(user: user)
+ self.navigationController?.pushViewController(messagesVC, animated: true)
+ }
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+
+ // View detailed message information
+ func showMessageInfo(for message: BaseMessage) {
+ let messageInfo = CometChatMessageInformation()
+ messageInfo.set(message: message)
+ navigationController?.pushViewController(messageInfo, animated: true)
+ }
+}
+```
+
+**Receipt States:**
+- ✓ Sent - Message sent to server
+- ✓✓ Delivered - Message delivered to recipient's device
+- ✓✓ (blue) Read - Recipient has seen the message
+
+**Components Used:**
+- [Conversations](/ui-kit/ios/conversations) - Shows receipt status on last message
+- [MessageList](/ui-kit/ios/message-list) - Shows receipts on each message
+- [MessageInformation](/ui-kit/ios/message-information) - Detailed delivery/read info
## Mark As Unread
-Mark as Unread feature allows users to manually mark messages as unread, helping them keep track of important conversations they want to revisit later. When enabled, the message list can automatically start from the first unread message, making it easier to pick up where you left off.
+Let users mark messages as unread to revisit later.
-| Components | Functionality |
-| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Message List](/ui-kit/ios/message-list) | [Message List](/ui-kit/ios/message-list#functionality) provides the "Mark as unread" option in message actions and supports starting from the first unread message when enabled. |
-| [Conversations](/ui-kit/ios/conversations) | [Conversations](/ui-kit/ios/conversations#functionality) component listens to conversation updates and reflects the updated unread count in real-time. |
-
-## Typing Indicator
-
-The Typing Indicator feature in CometChat shows when a user is typing a response in real-time, fostering a more interactive and engaging chat environment. This feature enhances the real-time communication experience, making conversations feel more natural and fluid.
+```swift
+import UIKit
+import CometChatUIKitSwift
+import CometChatSDK
+
+class UnreadMessagesViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let messagesVC = CometChatMessages()
+
+ // Enable starting from first unread message
+ messagesVC.scrollToUnreadMessages = true
+
+ CometChat.getUser(UID: "user-123") { user in
+ DispatchQueue.main.async {
+ messagesVC.set(user: user)
+ self.navigationController?.pushViewController(messagesVC, animated: true)
+ }
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+
+ // Mark a message as unread programmatically
+ func markAsUnread(message: BaseMessage) {
+ CometChat.markAsUnread(
+ baseMessage: message
+ ) { _ in
+ print("Marked as unread")
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+}
+```
+
+## Typing Indicators
+
+Show when users are typing in real-time.
-| Components | Functionality |
-| ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Conversations](/ui-kit/ios/conversations) | [Conversations](/ui-kit/ios/conversations) is a Component that renders Conversations item List, Conversations item also shows real-time typing status indicators. This means that if a user in a one-on-one chat or a participant in a group chat is currently typing a message |
-| [Message Header](/ui-kit/ios/message-header) | [Message Header](/ui-kit/ios/message-header) that renders details of User or Groups in ToolBar. The MessageHeader also handles the Typing Indicator functionality. When a user or a member in a group is typing, the MessageHeader dynamically updates to display a 'typing...' status in real-time. |
+```swift
+import UIKit
+import CometChatUIKitSwift
+import CometChatSDK
+
+class TypingIndicatorViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ // Typing indicators are enabled by default in:
+ // - CometChatConversations (shows "typing..." in conversation list)
+ // - CometChatMessageHeader (shows "typing..." below user name)
+
+ let messagesVC = CometChatMessages()
+
+ CometChat.getUser(UID: "user-123") { user in
+ DispatchQueue.main.async {
+ messagesVC.set(user: user)
+ self.navigationController?.pushViewController(messagesVC, animated: true)
+ }
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+
+ // Send typing indicator manually
+ func startTyping(to receiverUID: String) {
+ let typingIndicator = TypingIndicator(
+ receiverID: receiverUID,
+ receiverType: .user
+ )
+ CometChat.startTyping(indicator: typingIndicator)
+ }
+
+ func stopTyping(to receiverUID: String) {
+ let typingIndicator = TypingIndicator(
+ receiverID: receiverUID,
+ receiverType: .user
+ )
+ CometChat.endTyping(indicator: typingIndicator)
+ }
+}
+```
+
+**Components Used:**
+- [Conversations](/ui-kit/ios/conversations) - Shows typing in conversation list
+- [MessageHeader](/ui-kit/ios/message-header) - Shows typing below user/group name
## User Presence
-CometChat's User Presence feature allows users to see whether their contacts are online, offline. This helps users know the best time to initiate a conversation and sets expectations about response times.
+Display online/offline status for users.
-| Components | Functionality |
-| ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Conversations](/ui-kit/ios/conversations) | [Conversations](/ui-kit/ios/conversations) is a Component that renders Conversations item List, Conversations item also shows user presence information. |
-| [Message Header](/ui-kit/ios/message-header) | [Message Header](/ui-kit/ios/message-header) that renders details of User or Groups in ToolBar. The MessageHeader also handles user Presence information. |
-| [Users](/ui-kit/ios/users) | [Users](/ui-kit/ios/users) renders list of users available in your app.It also responsible to render users Presence information. |
-| [Group Members](/ui-kit/ios/group-members) | [Group Members](/ui-kit/ios/group-members) renders list of users available in the group. The Group Members component also handles user Presence information. |
+```swift
+import UIKit
+import CometChatUIKitSwift
+import CometChatSDK
+
+class PresenceViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ // User presence is shown automatically in:
+ // - CometChatConversations (green dot for online users)
+ // - CometChatMessageHeader (shows "Online" or "Last seen")
+ // - CometChatUsers (green dot for online users)
+ // - CometChatGroupMembers (green dot for online members)
+
+ let conversations = CometChatConversations()
+
+ // To hide user status:
+ // conversations.hideUserStatus = true
+
+ navigationController?.pushViewController(conversations, animated: true)
+ }
+
+ // Listen for presence changes
+ func listenForPresenceChanges() {
+ CometChat.addUserListener("presence-listener", self)
+ }
+}
+
+extension PresenceViewController: CometChatUserDelegate {
+ func onUserOnline(user: User) {
+ print("\(user.name ?? "") is now online")
+ }
+
+ func onUserOffline(user: User) {
+ print("\(user.name ?? "") went offline")
+ }
+}
+```
## Reactions
-CometChat's Reactions feature adds a layer of expressiveness to your chat application by allowing users to react to messages. With Reactions, users can convey a range of emotions or express their thoughts on a particular message without typing out a full response, enhancing their user experience and fostering greater engagement.
-
-The number of reactions displayed depends on the width of the view. For instance, if a message contains 5 reactions but the width of the CometChatReactions view can only accommodate 4 reactions at a time, the first three reactions will be shown along with an additional UI element at the end of the row. This element indicates the number of other unique reactions that are not immediately visible, informing users of the total count of different reactions.
-
-In the example, tapping on this element (depicted as "+2" in the provided image) will by default trigger the CometChatReactionList component. This action opens a modal sheet from the bottom of the screen, displaying all reactions received by the message.
+Let users react to messages with emojis.
-| Components | Functionality |
-| -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [MessageList](/ui-kit/ios/message-list) | [MessageList](/ui-kit/ios/message-list) is a Component that renders different types of Message bubbles, Irrespective of the type of message bubble, Reactions are an integral part and offer a more engaging, expressive way for users to respond to messages. |
-| [Messages](/ui-kit/ios/message-header) | [Messages](/ui-kit/ios/message-header) component in CometChat's UI Kit is a comprehensive component that includes both the [MessageComposer](/ui-kit/ios/message-composer) and the [MessageList](/ui-kit/ios/message-list) components. So, if you're looking to implement a messaging feature in your application, using the Messages component would be a straightforward and efficient way to do it. |
+```swift
+import UIKit
+import CometChatUIKitSwift
+import CometChatSDK
+
+class ReactionsViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ // Reactions are enabled by default
+ // Users can long-press a message to add reactions
+
+ let messagesVC = CometChatMessages()
+
+ CometChat.getUser(UID: "user-123") { user in
+ DispatchQueue.main.async {
+ messagesVC.set(user: user)
+ self.navigationController?.pushViewController(messagesVC, animated: true)
+ }
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+
+ // Add reaction programmatically
+ func addReaction(to message: BaseMessage, emoji: String) {
+ CometChat.addReaction(
+ messageId: message.id,
+ reaction: emoji
+ ) { message in
+ print("Reaction added")
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+
+ // Remove reaction
+ func removeReaction(from message: BaseMessage, emoji: String) {
+ CometChat.removeReaction(
+ messageId: message.id,
+ reaction: emoji
+ ) { message in
+ print("Reaction removed")
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+}
+```
## Mentions
-Mentions is a robust feature provided by CometChat that enhances the interactivity and clarity of group or 1-1 chats by allowing users to directly address or refer to specific individuals in a conversation.
+Tag users in messages with @mentions.
-| Components | Functionality |
-| ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Conversations](/ui-kit/ios/conversations) | [Conversations](/ui-kit/ios/conversations) component provides an enhanced user experience by integrating the Mentions feature. This means that from the conversation list itself, users can see where they or someone else have been specifically mentioned. |
-| [MessageComposer](/ui-kit/ios/message-composer) | [MessageComposer](/ui-kit/ios/message-composer)is a component that allows users to craft and send various types of messages, including the usage of the Mentions feature for direct addressing within the conversation. |
-| [MessageList](/ui-kit/ios/message-list) | [MessageList](/ui-kit/ios/message-list) is a component that displays a list of sent and received messages. It also supports the rendering of Mentions, enhancing the readability and interactivity of conversations. |
-| [Messages](/ui-kit/ios/message-header) | [Messages](/ui-kit/ios/message-header) The component is a comprehensive element in CometChat's UI Kit, encapsulating both the [MessageComposer](/ui-kit/ios/message-composer) and [MessageList](/ui-kit/ios/message-list) components. It fully supports the Mentions feature, providing a streamlined way to implement an interactive and engaging messaging function in your application. |
+```swift
+import UIKit
+import CometChatUIKitSwift
+import CometChatSDK
+
+class MentionsViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ // Mentions are enabled by default
+ // Type @ in the composer to see mention suggestions
+
+ let messagesVC = CometChatMessages()
+
+ CometChat.getGroup(GUID: "group-123") { group in
+ DispatchQueue.main.async {
+ messagesVC.set(group: group)
+ self.navigationController?.pushViewController(messagesVC, animated: true)
+ }
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+
+ // Send message with mention programmatically
+ func sendMessageWithMention(to groupID: String, mentionedUser: User) {
+ let textMessage = TextMessage(
+ receiverUid: groupID,
+ text: "Hey @\(mentionedUser.name ?? ""), check this out!",
+ receiverType: .group
+ )
+
+ // Add mentioned users
+ textMessage.mentionedUsers = [mentionedUser]
+
+ CometChat.sendTextMessage(message: textMessage) { message in
+ print("Message with mention sent")
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+}
+```
## Threaded Conversations
-The Threaded Conversations feature enables users to respond directly to a specific message in a chat. This keeps conversations organized and enhances the user experience by maintaining context, especially in group chats.
+Reply to specific messages in threads.
-| Components | Functionality |
-| ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
-| [Threaded Messages](/ui-kit/ios/threaded-messages-header) | [Threaded Messages](/ui-kit/ios/threaded-messages-header) that displays all replies made to a particular message in a conversation. |
+```swift
+import UIKit
+import CometChatUIKitSwift
+import CometChatSDK
+
+class ThreadedMessagesViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ // Threaded messages are enabled by default
+ // Users can tap "Reply in thread" on any message
+
+ let messagesVC = CometChatMessages()
+
+ CometChat.getUser(UID: "user-123") { user in
+ DispatchQueue.main.async {
+ messagesVC.set(user: user)
+ self.navigationController?.pushViewController(messagesVC, animated: true)
+ }
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+
+ // Open thread view for a message
+ func openThread(for parentMessage: BaseMessage, user: User) {
+ let threadedMessages = CometChatThreadedMessages()
+ threadedMessages.set(parentMessage: parentMessage)
+ threadedMessages.set(user: user)
+ navigationController?.pushViewController(threadedMessages, animated: true)
+ }
+
+ // Send reply in thread programmatically
+ func sendThreadReply(parentMessage: BaseMessage, text: String) {
+ let reply = TextMessage(
+ receiverUid: parentMessage.receiverUid,
+ text: text,
+ receiverType: parentMessage.receiverType
+ )
+ reply.parentMessageId = parentMessage.id
+
+ CometChat.sendTextMessage(message: reply) { message in
+ print("Thread reply sent")
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+}
+```
+
+**Component Used:**
+- [ThreadedMessages](/ui-kit/ios/threaded-messages-header) - Displays thread replies
## Group Chat
-CometChat facilitates Group Chats, allowing users to have conversations with multiple participants simultaneously. This feature is crucial for team collaborations, group discussions, social communities, and more.
+Create and manage group conversations.
-For a comprehensive understanding and guide on implementing and using the Groups feature in CometChat, you should refer to our detailed guide on [Groups](/ui-kit/ios/groups).
-
+```swift
+import UIKit
+import CometChatUIKitSwift
+import CometChatSDK
+
+class GroupChatViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ showGroupsList()
+ }
+
+ // Show all groups
+ func showGroupsList() {
+ let groups = CometChatGroups()
+
+ groups.set(onItemClick: { [weak self] group, _ in
+ self?.openGroupChat(group: group)
+ })
+
+ navigationController?.pushViewController(groups, animated: true)
+ }
+
+ // Open chat for a group
+ func openGroupChat(group: Group) {
+ let messagesVC = CometChatMessages()
+ messagesVC.set(group: group)
+ navigationController?.pushViewController(messagesVC, animated: true)
+ }
+
+ // Create a new group
+ func createGroup(name: String, type: CometChat.groupType) {
+ let group = Group(
+ guid: UUID().uuidString,
+ name: name,
+ groupType: type,
+ password: nil
+ )
+
+ CometChat.createGroup(group: group) { createdGroup in
+ print("Group created: \(createdGroup.name ?? "")")
+ DispatchQueue.main.async {
+ self.openGroupChat(group: createdGroup)
+ }
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+
+ // Join a public group
+ func joinGroup(guid: String) {
+ CometChat.joinGroup(
+ GUID: guid,
+ groupType: .public,
+ password: nil
+ ) { group in
+ print("Joined group: \(group.name ?? "")")
+ DispatchQueue.main.async {
+ self.openGroupChat(group: group)
+ }
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+}
+```
+
+**Related Guide:** [Groups](/ui-kit/ios/groups)
## Quoted Reply
-Quoted Reply is a robust feature provided by CometChat that enables users to quickly reply to specific messages by selecting the "Reply" option from a message's action menu. This enhances context, keeps conversations organized, and improves overall chat experience in both 1-1 and group chats.
+Reply to specific messages with context.
-| Components | Functionality |
-| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Message List](/ui-kit/android/message-list) | [Message List](/ui-kit/android/message-list) supports replying to messages via the "Reply" option. Users can select "Reply" on a message to open the composer with the quoted reply pre-filled, maintaining context. |
-| [Message Composer](/ui-kit/android/message-composer) | [Message Composer](/ui-kit/android/message-composer) works seamlessly with Quoted Message by showing the quoted reply above the input field, letting users compose their response in proper context. |
-
-## Conversation and Advanced Search
-
-Conversation and Advanced Search is a powerful feature provided by CometChat that enables users to quickly find conversations, messages, and media across chats in real time. It supports filters, scopes, and custom actions, allowing users to locate content efficiently while keeping the chat experience smooth and intuitive.
+```swift
+import UIKit
+import CometChatUIKitSwift
+import CometChatSDK
+
+class QuotedReplyViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ // Quoted reply is enabled by default
+ // Users can swipe right on a message or tap "Reply" in message actions
+
+ let messagesVC = CometChatMessages()
+
+ CometChat.getUser(UID: "user-123") { user in
+ DispatchQueue.main.async {
+ messagesVC.set(user: user)
+ self.navigationController?.pushViewController(messagesVC, animated: true)
+ }
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+}
+```
+
+## Search
+
+Search across conversations and messages.
-| Components | Functionality |
-| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Search](/ui-kit/ios/search) | [Search](/ui-kit/ios/search) allows users to search across conversations and messages in real time. Users can click on a result to open the conversation or jump directly to a specific message. |
-| [Message Header](/ui-kit/ios/message-header) | [Message Header](/ui-kit/ios/message-header) shows the search button in the chat header, allowing users to search within a conversation. |
-| [Message List](/ui-kit/ios/message-list) | [Message List](/ui-kit/ios/message-list) shows the selected message when clicked from search results and highlights it in the message list. |
-| [Conversations](/ui-kit/ios/conversations) | [Conversations](/ui-kit/ios/conversations) displays the search input. |
-
+```swift
+import UIKit
+import CometChatUIKitSwift
+import CometChatSDK
+
+class SearchViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ // Search is available in:
+ // - CometChatConversations (search bar at top)
+ // - CometChatMessageHeader (search button)
+
+ let conversations = CometChatConversations()
+
+ // Search is enabled by default
+ // To hide search:
+ // conversations.hideSearch = true
+
+ navigationController?.pushViewController(conversations, animated: true)
+ }
+
+ // Open dedicated search screen
+ func openSearch() {
+ let search = CometChatSearch()
+ navigationController?.pushViewController(search, animated: true)
+ }
+}
+```
+
+**Components Used:**
+- [Search](/ui-kit/ios/search) - Dedicated search screen
+- [MessageHeader](/ui-kit/ios/message-header) - Search within conversation
+- [Conversations](/ui-kit/ios/conversations) - Search conversations
## Moderation
-CometChat's Message Moderation feature helps maintain a safe and respectful chat environment by automatically filtering and managing inappropriate content. Messages can be automatically blocked or flagged based on predefined rules, ensuring harmful content is handled before it reaches users.
+Automatically filter inappropriate content.
+```swift
+import UIKit
+import CometChatUIKitSwift
+import CometChatSDK
+
+class ModerationViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ // Moderation is handled automatically based on your
+ // CometChat dashboard settings
+
+ // Blocked messages are displayed appropriately
+ // based on your moderation rules
+
+ let messagesVC = CometChatMessages()
+
+ CometChat.getUser(UID: "user-123") { user in
+ DispatchQueue.main.async {
+ messagesVC.set(user: user)
+ self.navigationController?.pushViewController(messagesVC, animated: true)
+ }
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+}
+```
+
-| Components | Functionality |
-| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Message List](/ui-kit/android/message-list) | [Message List](/ui-kit/android/message-list) provides the "Report Message" option in the message actions menu, allowing users to initiate the reporting process for inappropriate messages. |
+```swift
+import UIKit
+import CometChatUIKitSwift
+import CometChatSDK
+
+class ReportMessageViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ // Report message is available in message actions
+ // Users can long-press a message and select "Report"
+
+ let messagesVC = CometChatMessages()
+
+ CometChat.getUser(UID: "user-123") { user in
+ DispatchQueue.main.async {
+ messagesVC.set(user: user)
+ self.navigationController?.pushViewController(messagesVC, animated: true)
+ }
+ } onError: { error in
+ print("Error: \(error?.errorDescription ?? "")")
+ }
+ }
+}
+```
+
+
-### Polls
+| Feature | Details |
+|---------|---------|
+| Appears in | [Message Composer](/ui-kit/ios/message-composer) attachment menu |
+| Setup guide | [Sticker Extension](/fundamentals/stickers) |
+| Code required | None - automatic after dashboard activation |
-The Polls extension enhances group discussions by allowing users to create polls. Users can ask questions with a predefined list of answers, enabling a quick, organized way to gather group opinions. For a comprehensive understanding and guide on implementing and using the Polls Extension, refer to our specific guide on the [Polls Extension](/fundamentals/polls).
+### Polls
-Once you have successfully activated the [Polls Extension](/fundamentals/polls) from your CometChat Dashboard, the feature will automatically be incorporated into the Action Sheet of the [Message Composer](/ui-kit/ios/message-composer) component of UI Kits.
+Create polls to gather opinions in group chats quickly.
-### Collaborative Whiteboard
+| Feature | Details |
+|---------|---------|
+| Appears in | [Message Composer](/ui-kit/ios/message-composer) action sheet |
+| Setup guide | [Polls Extension](/fundamentals/polls) |
+| Code required | None - automatic after dashboard activation |
-The Collaborative Whiteboard extension facilitates real-time collaboration. Users can draw, brainstorm, and share ideas on a shared digital whiteboard. For a comprehensive understanding and guide on implementing and using the Collaborative Whiteboard Extension, refer to our specific guide on the [Collaborative Whiteboard Extension](/fundamentals/collaborative-whiteboard).
+### Collaborative Whiteboard
-Once you have successfully activated the [Collaborative Whiteboard Extension](/fundamentals/collaborative-whiteboard) from your CometChat Dashboard, the feature will automatically be incorporated into the Action Sheet of the [Message Composer](/ui-kit/ios/message-composer) component of UI Kits.
+Real-time whiteboard for drawing, brainstorming, and sharing ideas together.
-### Collaborative Document
+| Feature | Details |
+|---------|---------|
+| Appears in | [Message Composer](/ui-kit/ios/message-composer) action sheet |
+| Setup guide | [Collaborative Whiteboard](/fundamentals/collaborative-whiteboard) |
+| Code required | None - automatic after dashboard activation |
-With the Collaborative Document extension, users can work together on a shared document. This feature is essential for remote teams where document collaboration is a recurring requirement. For a comprehensive understanding and guide on implementing and using the Collaborative Document Extension, refer to our specific guide on the [Collaborative Document Extension](/fundamentals/collaborative-document).
+### Collaborative Document
-Once you have successfully activated the [Collaborative Document Extension](/fundamentals/collaborative-document) from your CometChat Dashboard, the feature will automatically be incorporated into the Action Sheet of the [Message Composer](/ui-kit/ios/message-composer) component of UI Kits.
+Work together on shared documents in real-time with other users.
-### Message Reactions
+| Feature | Details |
+|---------|---------|
+| Appears in | [Message Composer](/ui-kit/ios/message-composer) action sheet |
+| Setup guide | [Collaborative Document](/fundamentals/collaborative-document) |
+| Code required | None - automatic after dashboard activation |
-Message Reactions extension lets users express their emotions towards a message by choosing from a range of emojis. It provides a quick way to respond to any shared message. For a comprehensive understanding and guide on implementing and using the Message Reactions Extension, refer to our specific guide on the [Message Reactions Extension](/fundamentals/reactions).
+### Message Reactions
-Once you have successfully activated the [Message Reactions Extension](/fundamentals/reactions) from your CometChat Dashboard, the feature will automatically be incorporated into the Action Sheet of [MessageList Component](/ui-kit/ios/message-list) component of UI Kits.
+Let users react to messages with a range of emojis for quick responses.
-### Message Translation
+| Feature | Details |
+|---------|---------|
+| Appears in | [Message List](/ui-kit/ios/message-list) long-press menu |
+| Setup guide | [Reactions Extension](/fundamentals/reactions) |
+| Code required | None - automatic after dashboard activation |
-The Message Translation extension in CometChat is designed to translate any message into your local. It eliminates language barriers, making the chat more inclusive. For a comprehensive understanding and guide on implementing and using the Message Translation Extension, refer to our specific guide on the [Message Translation Extension](/fundamentals/message-translation).
+### Message Translation
-Once you have successfully activated the [Message Translation Extension](/fundamentals/message-translation) from your CometChat Dashboard, the feature will automatically be incorporated into the Action Sheet of [MessageList Component](/ui-kit/ios/message-list) component of UI Kits.
+Translate messages into any language instantly, eliminating language barriers.
-### Link Preview
+| Feature | Details |
+|---------|---------|
+| Appears in | [Message List](/ui-kit/ios/message-list) message actions |
+| Setup guide | [Message Translation](/fundamentals/message-translation) |
+| Code required | None - automatic after dashboard activation |
-The Link Preview extension provides a summary of the URL shared in the chat. It includes the title, a description, and a thumbnail image from the web page. For a comprehensive understanding and guide on implementing and using the Link Preview Extension, refer to our specific guide on the [Link Preview Extension](/fundamentals/link-preview).
+### Link Preview
-Once you have successfully activated the [Link Preview Extension](/fundamentals/link-preview) from your CometChat Dashboard, the feature will automatically be incorporated into the Message Bubble of [MessageList Component](/ui-kit/ios/message-list) component of UI Kits.
+Show rich previews for URLs shared in chat including title, description, and thumbnail.
-### Profanity Filter
+| Feature | Details |
+|---------|---------|
+| Appears in | [Message List](/ui-kit/ios/message-list) message bubbles |
+| Setup guide | [Link Preview](/fundamentals/link-preview) |
+| Code required | None - automatic after dashboard activation |
-The Profanity Filter extension helps in maintaining the chat decorum by censoring obscene and inappropriate words in the messages. For a comprehensive understanding and guide on implementing and using the Profanity Filter Extension, refer to our specific guide on the [Legacy Extensions](/moderation/legacy-extensions).
+### Profanity Filter
-Once you have successfully activated the Profanity Filter Extension from your CometChat Dashboard, the feature will automatically be incorporated into the Message Bubble of [MessageList Component](/ui-kit/ios/message-list) component of UI Kits.
+Automatically censor inappropriate and obscene words in messages.
-### Data Masking
+| Feature | Details |
+|---------|---------|
+| Appears in | [Message List](/ui-kit/ios/message-list) - filtered automatically |
+| Setup guide | [Legacy Extensions](/moderation/legacy-extensions) |
+| Code required | None - automatic after dashboard activation |
-The Data Masking extension helps secure sensitive data by masking information like credit card numbers and phone numbers in a chat message. For a comprehensive understanding and guide on implementing and using the Data Masking Extension, refer to our specific guide on the [Legacy Extensions](/moderation/legacy-extensions).
+### Data Masking
-Once you have successfully activated the Data Masking Extension from your CometChat Dashboard, the feature will automatically be incorporated into the Message Bubble of [MessageList Component](/ui-kit/ios/message-list) component of UI Kits.
+Automatically mask sensitive data like credit card numbers and phone numbers.
-### Image Moderation
+| Feature | Details |
+|---------|---------|
+| Appears in | [Message List](/ui-kit/ios/message-list) - masked automatically |
+| Setup guide | [Legacy Extensions](/moderation/legacy-extensions) |
+| Code required | None - automatic after dashboard activation |
-The Image Moderation extension uses machine learning to detect and filter out inappropriate or explicit images shared in the chat. For a comprehensive understanding and guide on implementing and using the Image Moderation Extension, refer to our specific guide on the [Legacy Extensions](/moderation/legacy-extensions).
+### Image Moderation
-Once you have successfully activated the Image Moderation Extension from your CometChat Dashboard, the feature will automatically be incorporated into the Message Bubble of [MessageList Component](/ui-kit/ios/message-list) component of UI Kits.
+Detect and filter inappropriate or explicit images using AI/ML.
-### Thumbnail Generation
+| Feature | Details |
+|---------|---------|
+| Appears in | [Message List](/ui-kit/ios/message-list) - filtered automatically |
+| Setup guide | [Legacy Extensions](/moderation/legacy-extensions) |
+| Code required | None - automatic after dashboard activation |
-The Thumbnail Generation extension automatically creates a smaller preview image whenever a larger image is shared, helping to reduce the upload/download time and bandwidth usage. For a comprehensive understanding and guide on implementing and using the Thumbnail Generation Extension, refer to our specific guide on the [Thumbnail Generation Extension](/fundamentals/thumbnail-generation).
+### Thumbnail Generation
-Once you have successfully activated the [Thumbnail Generation Extension](/fundamentals/thumbnail-generation) from your CometChat Dashboard, the feature will automatically be incorporated into the Message Bubble of [MessageList Component](/ui-kit/ios/message-list) component of UI Kits.
+Automatically create smaller preview images for faster loading and reduced bandwidth.
+
-The `CometChatGroupMembers` component is composed of the following BaseComponents:
+
+
-`CometChatGroupMembers`, as a custom **view controller**, offers flexible integration options, allowing it to be launched directly via button clicks or any user-triggered action. Additionally, it seamlessly integrates into tab view controllers. With group members, users gain access to a wide range of parameters and methods for effortless customization of its user interface.
+---
-The following code snippet exemplifies how you can seamlessly integrate the GroupMembers component into your application.
+## Minimal Render
-
+
-
+
-You can set the `GroupMembersStyle` to the `Group Memebers` Component to customize the styling.
+### Key Style Properties
+
+| Property | Type | Default | Description |
+|----------|------|---------|-------------|
+| `backgroundColor` | `UIColor` | `CometChatTheme.backgroundColor01` | Background color |
+| `titleColor` | `UIColor` | `CometChatTheme.textColorPrimary` | Navigation title color |
+| `titleFont` | `UIFont` | `CometChatTypography.Heading4.medium` | Navigation title font |
+| `listItemTitleTextColor` | `UIColor` | `CometChatTheme.textColorPrimary` | Member name color |
+| `listItemTitleFont` | `UIFont` | `CometChatTypography.Heading4.medium` | Member name font |
+| `listItemSubTitleTextColor` | `UIColor` | `CometChatTheme.textColorSecondary` | Subtitle color |
+| `listItemBackground` | `UIColor` | `.clear` | List item background |
+
+### Customization Matrix
+
+| What to change | Where | Property/API | Example |
+|----------------|-------|--------------|---------|
+| Background color | Style | `backgroundColor` | `UIColor.systemBackground` |
+| Title appearance | Style | `titleColor`, `titleFont` | Custom colors and fonts |
+| List item look | Style | `listItemBackground` | `UIColor.white` |
+| Avatar appearance | Style | `avatarStyle` | `AvatarStyle()` with custom radius |
+| Hide search | Property | `hideSearch` | `groupMembers.hideSearch = true` |
+| Hide kick option | Property | `hideKickMemberOption` | `groupMembers.hideKickMemberOption = true` |
+| Custom row | View Slot | `set(listItemView:)` | See Custom View Slots |
-**Global level styling**
+---
-
-
+let avatarStyle = AvatarStyle()
+avatarStyle.cornerRadius = CometChatCornerStyle(cornerRadius: 20)
+avatarStyle.backgroundColor = UIColor.systemBlue.withAlphaComponent(0.1)
-List of properties exposed by GroupMemberStyle
-
-| Property | Description | Code |
-| --------------------------------- | ---------------------------------------------------- | ------------------------------------------------ |
-| retryButtonTextColor | Sets the text color for the retry button. | `.retryButtonTextColor: UIColor` |
-| retryButtonTextFont | Sets the text font for the retry button. | `.retryButtonTextFont: UIFont` |
-| retryButtonBackgroundColor | Sets the background color for the retry button. | `.retryButtonBackgroundColor: UIColor` |
-| retryButtonBorderColor | Sets the border color for the retry button. | `.retryButtonBorderColor: UIColor` |
-| retryButtonBorderWidth | Sets the border width for the retry button. | `.retryButtonBorderWidth: CGFloat` |
-| retryButtonCornerRadius | Sets the corner radius for the retry button. | `.retryButtonCornerRadius: CometChatCornerStyle` |
-| listItemSelectedBackground | Sets the background color for selected list items. | `.listItemSelectedBackground: UIColor` |
-| listItemDeSelectedImageTint | Sets the tint color for deselected list item images. | `.listItemDeSelectedImageTint: UIColor` |
-| listItemSelectionImageTint | Sets the tint color for selected list item images. | `.listItemSelectionImageTint: UIColor` |
-| listItemSelectedImage | Sets the image for selected list items. | `.listItemSelectedImage: UIImage` |
-| listItemDeSelectedImage | Sets the image for deselected list items. | `.listItemDeSelectedImage: UIImage` |
-| backgroundColor | Sets the background color. | `.backgroundColor: UIColor` |
-| borderWidth | Sets the border width. | `.borderWidth: CGFloat` |
-| borderColor | Sets the border color. | `.borderColor: UIColor` |
-| cornerRadius | Sets the corner radius style. | `.cornerRadius: CometChatCornerStyle` |
-| titleFont | Sets the font for the title. | `.titleFont: UIFont?` |
-| largeTitleFont | Sets the font for the large title. | `.largeTitleFont: UIFont?` |
-| titleColor | Sets the color for the title text. | `.titleColor: UIColor?` |
-| largeTitleColor | Sets the color for the large title text. | `.largeTitleColor: UIColor?` |
-| navigationBarTintColor | Sets the tint color for the navigation bar. | `.navigationBarTintColor: UIColor?` |
-| navigationBarItemsTintColor | Sets the tint color for navigation bar items. | `.navigationBarItemsTintColor: UIColor?` |
-| errorTitleTextFont | Sets the font for the error title text. | `.errorTitleTextFont: UIFont` |
-| errorTitleTextColor | Sets the color for the error title text. | `.errorTitleTextColor: UIColor` |
-| errorSubTitleFont | Sets the font for the error subtitle text. | `.errorSubTitleFont: UIFont` |
-| errorSubTitleTextColor | Sets the color for the error subtitle text. | `.errorSubTitleTextColor: UIColor` |
-| emptyTitleTextFont | Sets the font for the empty state title text. | `.emptyTitleTextFont: UIFont` |
-| emptyTitleTextColor | Sets the color for the empty state title text. | `.emptyTitleTextColor: UIColor` |
-| emptySubTitleFont | Sets the font for the empty state subtitle text. | `.emptySubTitleFont: UIFont` |
-| emptySubTitleTextColor | Sets the color for the empty state subtitle text. | `.emptySubTitleTextColor: UIColor` |
-| tableViewSeparator | Sets the color for the table view separator. | `.tableViewSeparator: UIColor` |
-| listItemTitleTextColor | Sets the text color for list item titles. | `.listItemTitleTextColor: UIColor` |
-| listItemTitleFont | Sets the font for list item titles. | `.listItemTitleFont: UIFont` |
-| listItemSubTitleTextColor | Sets the text color for list item subtitles. | `.listItemSubTitleTextColor: UIColor` |
-| listItemSubTitleFont | Sets the font for list item subtitles. | `.listItemSubTitleFont: UIFont` |
-| listItemBackground | Sets the background color for list items. | `.listItemBackground: UIColor` |
-| listItemBorderWidth | Sets the border width for list items. | `.listItemBorderWidth: CGFloat` |
-| listItemBorderColor | Sets the border color for list items. | `.listItemBorderColor: UIColor` |
-| listItemCornerRadius | Sets the corner radius for list items. | `.listItemCornerRadius: CometChatCornerStyle` |
-| messageTypeImageTint | Sets the tint color for message type icons. | `.messageTypeImageTint: UIColor` |
-| passwordGroupImageTintColor | Sets the tint color for password group icons. | `.passwordGroupImageTintColor: UIColor` |
-| passwordGroupImageBackgroundColor | Sets the background color for password group icons. | `.passwordGroupImageBackgroundColor: UIColor` |
-| privateGroupImageTintColor | Sets the tint color for private group icons. | `.privateGroupImageTintColor: UIColor` |
-| privateGroupImageBackgroundColor | Sets the background color for private group icons. | `.privateGroupImageBackgroundColor: UIColor` |
-
-***
-
-### 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.
-
-
-
+### hideErrorView
-In this example, we will create a UIView file `CustomListItemGroupView` and pass it inside the `setListItemView()` method.
+Hides the error state view.
-```swift CustomListItemGroupView
+| | |
+|---|---|
+| Type | `Bool` |
+| Default | `false` |
-import UIKit
-import CometChatSDK
-import CometChatUIKitSwift
+### hideKickMemberOption
-class CustomListItemView: UIView {
-
- private let profileImageView: CometChatAvatar = {
- let imageView = CometChatAvatar()
- imageView.layer.cornerRadius = 12 // Rounded corners
- imageView.translatesAutoresizingMaskIntoConstraints = false
- return imageView
- }()
-
- private let nameLabel: UILabel = {
- let label = UILabel()
- label.textColor = .black
- label.font = UIFont.boldSystemFont(ofSize: 18)
- label.translatesAutoresizingMaskIntoConstraints = false
- return label
- }()
-
- private let roleBadgeButton: UIButton = {
- let button = UIButton(type: .system)
- button.setTitle("Owner", for: .normal)
- button.setTitleColor(.white, for: .normal)
- button.backgroundColor = UIColor.purple
- button.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .medium)
- button.layer.cornerRadius = 12
- button.translatesAutoresizingMaskIntoConstraints = false
- return button
- }()
-
- override init(frame: CGRect) {
- super.init(frame: frame)
- setupView()
- }
-
- required init?(coder: NSCoder) {
- super.init(coder: coder)
- setupView()
- }
-
- private func setupView() {
- addSubview(profileImageView)
- addSubview(nameLabel)
- addSubview(roleBadgeButton)
-
- NSLayoutConstraint.activate([
- // Profile Image Constraints
- profileImageView.leadingAnchor.constraint(equalTo: leadingAnchor),
- profileImageView.centerYAnchor.constraint(equalTo: centerYAnchor),
- profileImageView.widthAnchor.constraint(equalToConstant: 50),
- profileImageView.heightAnchor.constraint(equalToConstant: 50),
-
- // Name Label Constraints
- nameLabel.leadingAnchor.constraint(equalTo: profileImageView.trailingAnchor, constant: 12),
- nameLabel.centerYAnchor.constraint(equalTo: profileImageView.centerYAnchor),
-
- // Role Badge Button Constraints
- roleBadgeButton.leadingAnchor.constraint(greaterThanOrEqualTo: nameLabel.trailingAnchor, constant: 12),
- roleBadgeButton.trailingAnchor.constraint(equalTo: trailingAnchor),
- roleBadgeButton.centerYAnchor.constraint(equalTo: profileImageView.centerYAnchor),
- roleBadgeButton.heightAnchor.constraint(equalToConstant: 24),
- roleBadgeButton.widthAnchor.constraint(equalToConstant: 70)
- ])
- }
-
- // Method to configure the view with data
- func configure(with groupMember: GroupMember) {
- nameLabel.text = groupMember.name ?? ""
- profileImageView.setAvatar(avatarUrl: groupMember.avatar ?? "")
- roleBadgeButton.setTitle("\(groupMember.scope)", for: .normal)
- }
-}
-```
+Hides the kick member option in swipe actions.
-***
+| | |
+|---|---|
+| Type | `Bool` |
+| Default | `false` |
-#### SetLeadingView
+### hideLoadingState
-You can modify the leading view of a group member cell using .set(leadingView:).
+Hides the loading state indicator.
-
-
+### hideScopeChangeOption
-You can create a `CustomLeadingView` as a custom `UIView`. Which we will inflate in `setLeadingView()`
+Hides the role change option in swipe actions.
-
-
+Customizes the appearance of online/offline status indicators.
-You can create a `CustomTitleView` as a custom `UIView`. Which we will inflate in `setTitleView()`
+| | |
+|---|---|
+| Type | `StatusIndicatorStyle` |
+| Default | `StatusIndicatorStyle()` |
-
-
+groupMembers.set(options: { group, member in
+ var options = [CometChatGroupMemberOption]()
+
+ // Add message option
+ let messageOption = CometChatGroupMemberOption(
+ id: "message",
+ title: "Message",
+ icon: UIImage(systemName: "message"),
+ backgroundColor: .systemBlue,
+ onClick: { member, group, section, option, controller in
+ let messages = CometChatMessages()
+ messages.set(user: member)
+ controller.navigationController?.pushViewController(messages, animated: true)
+ }
+ )
+ options.append(messageOption)
+
+ // Add remove option
+ let removeOption = CometChatGroupMemberOption(
+ id: "remove",
+ title: "Remove",
+ icon: UIImage(systemName: "trash"),
+ backgroundColor: .systemRed,
+ onClick: { member, group, section, option, controller in
+ print("Remove member: \(member.name ?? "")")
+ }
+ )
+ options.append(removeOption)
+
+ return options
+})
+```
+
+#### add(options:)
+
+Adds additional swipe actions to the existing default options.
-In this example, we will create a UIView file `Custom_Tail_GroupView` and pass it inside the `.setTailView()` method.
+```swift
+@discardableResult
+public func add(options: ((_ group: Group, _ member: GroupMember?) -> [CometChatGroupMemberOption])?) -> Self
+```
-```swift Custom_Tail_GroupView
+| Parameter | Type | Description |
+|-----------|------|-------------|
+| `options` | `((Group, GroupMember?) -> [CometChatGroupMemberOption])?` | Closure that returns additional swipe action options to append |
+```swift
import UIKit
-import CometChatSDK
import CometChatUIKitSwift
+import CometChatSDK
-class CustomTailGroupView: UIView {
-
- let tailLabel: UILabel = {
- let label = UILabel()
- label.translatesAutoresizingMaskIntoConstraints = false
- label.font = UIFont.systemFont(ofSize: 10, weight: .semibold)
- label.textColor = UIColor(hex: "#6852D6")
- return label
- }()
-
- override init(frame: CGRect) {
- super.init(frame: frame)
- addSubview(tailLabel)
- NSLayoutConstraint.activate([
- tailLabel.centerXAnchor.constraint(equalTo: centerXAnchor),
- tailLabel.centerYAnchor.constraint(equalTo: centerYAnchor),
- self.heightAnchor.constraint(equalToConstant: 22),
- self.layer.cornerRadius = 11
- ])
- self.backgroundColor = UIColor(hex: "#EDEAFA")
- }
-
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
+let groupMembers = CometChatGroupMembers(group: group)
- // Configure the view with a group member
- func configure(with groupMember: GroupMember) {
- tailLabel.text = "\(groupMember.name!.description )"
- }
-}
+groupMembers.add(options: { group, member in
+ var options = [CometChatGroupMemberOption]()
+
+ // Add promote option
+ let promoteOption = CometChatGroupMemberOption(
+ id: "promote",
+ title: "Promote",
+ icon: UIImage(systemName: "arrow.up.circle"),
+ backgroundColor: .systemGreen,
+ onClick: { member, group, section, option, controller in
+ print("Promote member: \(member.name ?? "")")
+ }
+ )
+ options.append(promoteOption)
+
+ return options
+})
```
-***
+### Data Manipulation Methods
-#### SubtitleView
+#### add(groupMember:)
-You can set your custom Subtitle view using the `.setSubtitleView()` method. But keep in mind, by using this you will override the default Subtitle view functionality.
+Adds a new group member to the list.
-
-
+// Add a member programmatically
+let newMember = GroupMember(uid: "user-123", groupMemberScope: .participant)
+newMember.name = "John Doe"
+groupMembers.add(groupMember: newMember)
+```
-In this example, we will create a `Custom_Subtitle_GroupMember_View`a UIView file.
+#### update(groupMember:)
-```swift Custom_Subtitle_GroupMember_View
+Updates an existing group member in the list.
-import UIKit
-import CometChatSDK
-import CometChatUIKitSwift
+```swift
+@discardableResult
+public func update(groupMember: GroupMember) -> Self
+```
-class CustomSubtitleGroupMemberView: UIView {
-
- let memberNameLabel: UILabel = {
- let label = UILabel()
- label.translatesAutoresizingMaskIntoConstraints = false
- label.textColor = .init(red: 0.42, green: 0.01, blue: 0.84, alpha: 1.00)
- label.font = UIFont.systemFont(ofSize: 15, weight: .bold)
- return label
- }()
-
- let joinedAtLabel: UILabel = {
- let label = UILabel()
- label.translatesAutoresizingMaskIntoConstraints = false
- label.textColor = .systemBrown
- label.font = UIFont.systemFont(ofSize: 10, weight: .medium)
- return label
- }()
-
- override init(frame: CGRect) {
- super.init(frame: frame)
- addSubview(memberNameLabel)
- addSubview(joinedAtLabel)
-
- NSLayoutConstraint.activate([
- memberNameLabel.topAnchor.constraint(equalTo: topAnchor),
- memberNameLabel.leadingAnchor.constraint(equalTo: leadingAnchor),
- memberNameLabel.trailingAnchor.constraint(equalTo: trailingAnchor),
-
- joinedAtLabel.topAnchor.constraint(equalTo: memberNameLabel.bottomAnchor, constant: 2),
- joinedAtLabel.leadingAnchor.constraint(equalTo: leadingAnchor),
- joinedAtLabel.trailingAnchor.constraint(equalTo: trailingAnchor),
- joinedAtLabel.bottomAnchor.constraint(equalTo: bottomAnchor)
- ])
- }
+| Parameter | Type | Description |
+|-----------|------|-------------|
+| `groupMember` | `GroupMember` | The group member with updated information |
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
+```swift
+import CometChatUIKitSwift
+import CometChatSDK
- func configure(with groupMember: GroupMember) {
- memberNameLabel.text = "Member: \(groupMember.name ?? "")"
+let groupMembers = CometChatGroupMembers(group: group)
- let date = Date(timeIntervalSince1970: Double(groupMember.joinedAt))
- let dateFormatter = DateFormatter()
- dateFormatter.dateStyle = .medium
- joinedAtLabel.text = "Joined at: \(dateFormatter.string(from: date))"
- }
+// Update a member's information
+if var existingMember = memberToUpdate {
+ existingMember.scope = .admin
+ groupMembers.update(groupMember: existingMember)
}
```
-***
-
-#### Options
+#### remove(groupMember:)
-Enhance your GroupsMembers component by setting Custom Options to incorporate additional functionalities when swiping
+Removes a group member from the list.
-
-
+#### insert(groupMember:at:)
-In this example, we've enhanced the interface of `CometChatGroupMembers` by introducing a tailored feature. By adding a custom option, such as "Delete" with a corresponding trash icon, users can now enjoy a more interactive and user-friendly experience.
+Inserts a group member at a specific index in the list.
-
-
+Returns the number of group members currently in the list.
-In this example, we'll craft a custom button tailored for `CometChatGroupMembers`, enhancing its interface with a personalized `menu` for a more user-friendly experience.
+```swift
+public func size() -> Int
+```
-
+
-You can customize the empty state view using .set(emptyView:). This method accepts a UIView that appears when no group members are available.
+---
+
+## Custom Menu Buttons
+
+Add buttons to the navigation bar:
-
+
-
+
-The `Groups` component is composed of the following BaseComponents:
-
-| Components | Description |
-| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [CometChatListBase](/ui-kit/ios/list-base) | `CometChatListBase` serves as a container component equipped with a title (navigationBar), search functionality (search-bar), background settings, and a container for embedding a list view. |
-| [CometChatListItem](/ui-kit/ios/list-item) | This component renders information extracted from a `Group` object onto a tile, featuring a title, subtitle, leading view, and trailing view. |
-
-***
+
+
-
+
-[Actions](/ui-kit/ios/components-overview#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. ##### set(onItemClick:)
+## Filtering
-`set(OnItemClick:)` is triggered when you click on a ListItem of the groups component. This `set(OnItemClick:)` method proves beneficial when a user intends to customize the on-click behavior in CometChatGroups.
+Use `GroupsRequest.GroupsRequestBuilder` to filter which groups appear in the list. The builder pattern allows chaining multiple filter conditions.
-
-
-
-| **Property** | **Description** | **Code** |
-| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ----------------------------------- |
-| **List Item Selected Image** | Check box image when a list item is selected. | `listItemSelectedImage` |
-| **List Item Deselected Image** | Check box image when a list item is deselected. | `listItemDeSelectedImage` |
-| **Search Icon Tint Color** | Tint color for the search icon, defaults to the secondary icon color from CometChatTheme. | `searchIconTintColor` |
-| **Search Bar Style** | Style of the search bar, defaulting to the standard style. | `searchBarStyle` |
-| **Search Tint Color** | Tint color for the search bar, defaults to the primary color from CometChatTheme. | `searchTintColor` |
-| **Search Bar Tint Color** | Background color of the search bar, defaulting to clear. | `searchBarTintColor` |
-| **Search Bar Placeholder Text Color** | Placeholder text color for the search bar, defaults to the tertiary text color from CometChatTheme. | `searchBarPlaceholderTextColor` |
-| **Search Bar Placeholder Text Font** | Font used for the placeholder text in the search bar, defaults to regular body font. | `searchBarPlaceholderTextFont` |
-| **Search Bar Text Color** | Color of the text entered in the search bar, defaults to the primary text color from CometChatTheme. | `searchBarTextColor` |
-| **Search Bar Text Font** | Font used for the text in the search bar, defaults to regular body font. | `searchBarTextFont` |
-| **Search Bar Background Color** | Background color of the search bar, defaults to a specific background color from CometChatTheme. | `searchBarBackgroundColor` |
-| **Search Bar Cancel Icon Tint Color** | Tint color for the cancel icon in the search bar, defaults to the primary color from CometChatTheme. | `searchBarCancelIconTintColor` |
-| **Search Bar Cross Icon Tint Color** | Tint color for the cross icon in the search bar, defaults to the secondary icon color from CometChatTheme. | `searchBarCrossIconTintColor` |
-| **Background Color** | Background color of the overall view, defaults to a specific background color from CometChatTheme. | `backgroundColor` |
-| **Border Width** | Width of the border around the view, defaults to 0 (no border). | `borderWidth` |
-| **Border Color** | Color of the border around the view, defaults to clear. | `borderColor` |
-| **Corner Radius** | Corner radius settings for the view, defaults to no corner radius. | `cornerRadius` |
-| **Title Color** | Color for the title text, defaults to the primary text color from CometChatTheme. | `titleColor` |
-| **Title Font** | Font used for the title text, defaults to nil (not set). | `titleFont` |
-| **Large Title Color** | Color for the large title text, defaults to the primary text color from CometChatTheme. | `largeTitleColor` |
-| **Large Title Font** | Font used for the large title text, defaults to nil (not set). | `largeTitleFont` |
-| **Navigation Bar Tint Color** | Background color of the navigation bar, defaults to a specific background color from CometChatTheme. | `navigationBarTintColor` |
-| **Navigation Bar Items Tint Color** | Tint color for items in the navigation bar, defaults to the highlight color from CometChatTheme. | `navigationBarItemsTintColor` |
-| **Error Title Text Font** | Font used for the error title text, defaults to a bold heading 3 font from CometChatTypography. | `errorTitleTextFont` |
-| **Error Title Text Color** | Color of the error title text, defaults to the primary text color from CometChatTheme. | `errorTitleTextColor` |
-| **Error Subtitle Font** | Font used for the error subtitle text, defaults to regular body font. | `errorSubTitleFont` |
-| **Error Subtitle Text Color** | Color of the error subtitle text, defaults to the secondary text color from CometChatTheme. | `errorSubTitleTextColor` |
-| **Retry Button Text Color** | Color for the retry button text, defaults to button text color from CometChatTheme. | `retryButtonTextColor` |
-| **Retry Button Text Font** | Font used for the retry button text, defaults to medium button font from CometChatTypography. | `retryButtonTextFont` |
-| **Retry Button Background Color** | Background color for the retry button, defaults to the primary color from CometChatTheme. | `retryButtonBackgroundColor` |
-| **Retry Button Border Color** | Border color for the retry button, defaults to clear. | `retryButtonBorderColor` |
-| **Retry Button Border Width** | Width of the border around the retry button, defaults to 0 (no border). | `retryButtonBorderWidth` |
-| **Retry Button Corner Radius** | Corner radius settings for the retry button, defaults to a specific corner radius from CometChatSpacing. | `retryButtonCornerRadius` |
-| **Empty State Title Font** | Font used for the empty state title text, defaults to a bold heading 3 font from CometChatTypography. | `emptyTitleTextFont` |
-| **Empty State Title Color** | Color of the empty state title text, defaults to the primary text color from CometChatTheme. | `emptyTitleTextColor` |
-| **Empty State Subtitle Font** | Font used for the empty state subtitle text, defaults to regular body font. | `emptySubTitleFont` |
-| **Empty State Subtitle Color** | Color of the empty state subtitle text, defaults to the secondary text color from CometChatTheme. | `emptySubTitleTextColor` |
-| **Table View Separator** | Color of the table view separator, defaults to clear. | `tableViewSeparator` |
-| **List Item Title Text Color** | Color of the title text in list items, defaults to the primary text color from CometChatTheme. | `listItemTitleTextColor` |
-| **List Item Title Font** | Font used for the title text in list items, defaults to medium heading 4 font from CometChatTypography. | `listItemTitleFont` |
-| **List Item Subtitle Text Color** | Color of the subtitle text in list items, defaults to the secondary text color from CometChatTheme. | `listItemSubTitleTextColor` |
-| **List Item Subtitle Font** | Font used for the subtitle text in list items, defaults to regular body font. | `listItemSubTitleFont` |
-| **List Item Background** | Background color for list items, defaults to clear. | `listItemBackground` |
-| **List Item Selected Background** | Background color for list items if selected, defaults to clear. | `listItemSelectedBackground` |
-| **List Item Border Width** | Width of the border around list items, defaults to 0 (no border). | `listItemBorderWidth` |
-| **List Item Border Color** | Color of the border around list items, defaults to the light border color from CometChatTheme. | `listItemBorderColor` |
-| **List Item Corner Radius** | Corner radius settings for list items, defaults to no corner radius. | `listItemCornerRadius` |
-| **List Item Selection Image Tint** | Tint color for the selection image in list items, defaults to the highlight color from CometChatTheme. | `listItemSelectionImageTint` |
-| **List Item Deselection Image Tint** | Tint color for the deselected image in list items. | `listItemDeSelectedImageTint` |
-| **Password Group Image Tint Color** | Tint color for the password group image, defaults to the background color from CometChatTheme. | `passwordGroupImageTintColor` |
-| **Password Group Image Background Color** | Background color for the password group image, defaults to the warning color from CometChatTheme. | `passwordGroupImageBackgroundColor` |
-| **Private Group Image Tint Color** | Tint color for the private group image, defaults to the background color from CometChatTheme. | `privateGroupImageTintColor` |
-| **Private Group Image Background Color** | Background color for the private group image, defaults to the success color from CometChatTheme. | `privateGroupImageBackgroundColor` |
-| **Private Group Icon** | Image for a private group icon. | `privateGroupIcon` |
-| **Protected Group Icon** | Image for a protected group icon. | `protectedGroupIcon` |
-
-***
-
-### 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
-
-| Method | Description | Code |
-| ---------------------------- | ---------------------------------------------- | ------------------------------------------------- |
-| set(groupsRequestBuilder:) | Sets the request builder for fetching groups. | `set(groupsRequestBuilder: requestBuilder)` |
-| set(searchRequestBuilder:) | Sets the request builder for searching groups. | `set(searchRequestBuilder: searchRequestBuilder)` |
-| set(searchKeyword:) | Sets the search keyword to filter groups. | `set(searchKeyword: "group_name")` |
-| hideErrorView | Hides the error state view. | `hideErrorView = true` |
-| hideNavigationBar | Hides or shows the navigation bar. | `hideNavigationBar = true` |
-| hideSearch | Hides the search bar. | `hideSearch = true` |
-| hideBackButton | Hides the back button. | `hideBackButton = true` |
-| hideLoadingState | Hides the loading state indicator. | `hideLoadingState = true` |
-| hideReceipts | Hides message read/delivery receipts. | `hideReceipts = true` |
-| hideDeleteConversationOption | Hides the option to delete a conversation. | `hideDeleteConversationOption = true` |
-| hideUserStatus | Hides the online/offline status of users. | `hideUserStatus = true` |
-| hideGroupType | Hides the group type (private/public). | `hideGroupType = true` |
-
-***
-
-### 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.
-
-***
-
-#### SetOptions
-
-You can define custom options for each group using .set(options:). This method allows you to return an array of CometChatGroupOption based on the group object.
-
-
+
-You can create a `CustomListItemView` as a custom `UIView`. Which we will inflate in `setListItemView()`
+You can create a `CustomGroupCell` as a custom `UIView`:
-```swift swift
+```swift
import UIKit
import CometChatSDK
-import CometChatUIKitSwift
-class GroupCellView: UIView {
-
- // MARK: - Properties
+class CustomGroupCell: UIView {
private let avatarImageView: UIImageView = {
let imageView = UIImageView()
imageView.translatesAutoresizingMaskIntoConstraints = false
- imageView.contentMode = .scaleAspectFit
- imageView.layer.cornerRadius = 20 // Circular avatar
+ imageView.contentMode = .scaleAspectFill
+ imageView.layer.cornerRadius = 20
imageView.clipsToBounds = true
+ imageView.backgroundColor = .systemGray5
return imageView
}()
private let titleLabel: UILabel = {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
- label.font = UIFont.systemFont(ofSize: 16, weight: .bold)
- label.textColor = .black
- label.numberOfLines = 1
+ label.font = .systemFont(ofSize: 16, weight: .semibold)
+ label.textColor = .label
return label
}()
- private let subtitleLabel: UILabel = {
+ private let membersLabel: UILabel = {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
- label.font = UIFont.systemFont(ofSize: 14, weight: .regular)
- label.textColor = .darkGray
- label.numberOfLines = 1
+ label.font = .systemFont(ofSize: 14)
+ label.textColor = .secondaryLabel
return label
}()
@@ -615,17 +507,13 @@ class GroupCellView: UIView {
let button = UIButton(type: .system)
button.translatesAutoresizingMaskIntoConstraints = false
button.setTitle("JOIN", for: .normal)
- button.setTitleColor(.systemBlue, for: .normal)
- button.titleLabel?.font = UIFont.systemFont(ofSize: 14, weight: .bold)
+ button.titleLabel?.font = .systemFont(ofSize: 12, weight: .bold)
button.layer.cornerRadius = 12
button.layer.borderWidth = 1
button.layer.borderColor = UIColor.systemBlue.cgColor
- button.clipsToBounds = true
return button
}()
- // MARK: - Initializers
-
override init(frame: CGRect) {
super.init(frame: frame)
setupView()
@@ -636,40 +524,26 @@ class GroupCellView: UIView {
setupView()
}
- // MARK: - Setup
-
private func setupView() {
- // Add subviews
addSubview(avatarImageView)
addSubview(titleLabel)
- addSubview(subtitleLabel)
+ addSubview(membersLabel)
addSubview(joinButton)
- // Constraints for avatarImageView
NSLayoutConstraint.activate([
avatarImageView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 16),
avatarImageView.centerYAnchor.constraint(equalTo: centerYAnchor),
avatarImageView.widthAnchor.constraint(equalToConstant: 40),
- avatarImageView.heightAnchor.constraint(equalToConstant: 40)
- ])
-
- // Constraints for titleLabel
- NSLayoutConstraint.activate([
+ avatarImageView.heightAnchor.constraint(equalToConstant: 40),
+
titleLabel.leadingAnchor.constraint(equalTo: avatarImageView.trailingAnchor, constant: 12),
- titleLabel.topAnchor.constraint(equalTo: topAnchor, constant: 8),
- titleLabel.trailingAnchor.constraint(lessThanOrEqualTo: joinButton.leadingAnchor, constant: -8)
- ])
-
- // Constraints for subtitleLabel
- NSLayoutConstraint.activate([
- subtitleLabel.leadingAnchor.constraint(equalTo: avatarImageView.trailingAnchor, constant: 12),
- subtitleLabel.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 4),
- subtitleLabel.trailingAnchor.constraint(lessThanOrEqualTo: joinButton.leadingAnchor, constant: -8),
- subtitleLabel.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -8)
- ])
-
- // Constraints for joinButton
- NSLayoutConstraint.activate([
+ titleLabel.topAnchor.constraint(equalTo: topAnchor, constant: 12),
+ titleLabel.trailingAnchor.constraint(lessThanOrEqualTo: joinButton.leadingAnchor, constant: -8),
+
+ membersLabel.leadingAnchor.constraint(equalTo: avatarImageView.trailingAnchor, constant: 12),
+ membersLabel.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 4),
+ membersLabel.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -12),
+
joinButton.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -16),
joinButton.centerYAnchor.constraint(equalTo: centerYAnchor),
joinButton.widthAnchor.constraint(equalToConstant: 60),
@@ -677,48 +551,51 @@ class GroupCellView: UIView {
])
}
- // MARK: - Configuration
-
- func configure(avatar: UIImage?, title: String, subtitle: String, isJoined: Bool) {
- avatarImageView.image = avatar
- titleLabel.text = title
- subtitleLabel.text = subtitle
+ func configure(with group: Group) {
+ titleLabel.text = group.name
+ membersLabel.text = "\(group.membersCount) members"
+
+ if let iconURL = group.icon, let url = URL(string: iconURL) {
+ URLSession.shared.dataTask(with: url) { [weak self] data, _, _ in
+ if let data = data, let image = UIImage(data: data) {
+ DispatchQueue.main.async {
+ self?.avatarImageView.image = image
+ }
+ }
+ }.resume()
+ }
+
+ let isJoined = group.hasJoined
joinButton.setTitle(isJoined ? "JOINED" : "JOIN", for: .normal)
- joinButton.setTitleColor(isJoined ? .gray : .systemBlue, for: .normal)
- joinButton.layer.borderColor = isJoined ? UIColor.gray.cgColor : UIColor.systemBlue.cgColor
+ joinButton.setTitleColor(isJoined ? .systemGray : .systemBlue, for: .normal)
+ joinButton.layer.borderColor = isJoined ? UIColor.systemGray.cgColor : UIColor.systemBlue.cgColor
}
}
```
-***
-
-#### SetLeadingView
+### leadingView
-You can modify the leading view of a group cell using .set(leadingView:).
+Customize the leading view (avatar area) of a group cell.
-
+
-You can create a `CustomLeadingView` as a custom `UIView`. Which we will inflate in `setLeadingView()`
+You can create a `CustomLeadingView` as a custom `UIView`:
-
+
-You can create a `CustomTitleView` as a custom `UIView`. Which we will inflate in `setTitleView()`
+You can create a `CustomTitleView` as a custom `UIView`:
-
+
-You can modify the trailing view of a group cell using .set(trailView:).
+You can create a `CustomSubtitleView` as a custom `UIView`:
-
+
-You can create a `CustomTrailView` as a custom `UIView`. Which we will inflate in `setTrailView()`
+You can create a `CustomTrailView` as a custom `UIView`:
-
-
+## Options
+
+### set(options:)
-You can seamlessly integrate this `CustomSubtitleView` UIView file into the `.set(subtitleView:)` method within CometChatGroups.
+Define custom swipe options for each group. This method allows you to return an array of `CometChatGroupOption` based on the group object. These options appear when the user swipes on a group cell.
-
@@ -29,166 +12,530 @@ The AI Agent chat interface provides a familiar messaging experience enhanced wi
## Prerequisites
-- **CometChat UIKit for iOS** installed via CocoaPods or Swift Package Manager
-- CometChat initialized with `App ID`, `Region`, and `Auth Key`
-- Message chat enabled in your CometChat app
-- Navigation set up between message and user/group screens
-- Internet permissions
+Before implementing AI agents, ensure you have:
-## Components
+- Completed [Getting Started](/ui-kit/ios/getting-started) setup
+- CometChat UIKit v5+ installed
+- AI features enabled in your [CometChat Dashboard](https://app.cometchat.com)
+- User logged in with `CometChatUIKit.login()`
-| Component/Class | Role |
-|------------------------------ |------------------------------------------------------|
-| `CometChatMessageHeader` | Manages message interactions and state |
-| `CometChatMessageList` | Displays a list of messages |
-| `CometChatMessageComposer` | Composes and sends new messages |
-| `CometChatAIAssistantChatHistory` | Displays previous AI conversation history |
+## Overview
----
+The AI Agent integration provides:
-## Integration Steps
+- **Intelligent Responses** - Context-aware AI conversations
+- **Chat History** - Browse and resume previous AI sessions
+- **Streaming Responses** - Real-time message streaming
+- **Custom Styling** - Match your app's design
+- **Suggested Messages** - Quick-start prompts for users
-### Step 1 - Screen Setup
+## Basic Implementation
-Create a screen for AI Assistant chat using `CometChatMessageHeader`, `CometChatMessageList`, and `CometChatMessageComposer`.
+Create a simple AI chat screen:
-
+
-***
+
+
-List of properties exposed by IncomingCallStyle
-
-| Property | Description | Code |
-| ----------------------------- | --------------------------------------- | ------------------------------------------------- |
-| `overlayBackgroundColor` | Background color for the overlay. | `overlayBackgroundColor: UIColor` |
-| `acceptButtonBackgroundColor` | Background color for the accept button. | `acceptButtonBackgroundColor: UIColor` |
-| `rejectButtonBackgroundColor` | Background color for the reject button. | `rejectButtonBackgroundColor: UIColor` |
-| `acceptButtonTintColor` | Tint color for the accept button. | `acceptButtonTintColor: UIColor` |
-| `rejectButtonTintColor` | Tint color for the reject button. | `rejectButtonTintColor: UIColor` |
-| `acceptButtonImage` | Icon image for the accept button. | `acceptButtonImage: UIImage` |
-| `rejectButtonImage` | Icon image for the reject button. | `rejectButtonImage: UIImage` |
-| `acceptButtonCornerRadius` | Sets corner radius for accept button | `acceptButtonCornerRadius: CometChatCornerStyle?` |
-| `rejectButtonCornerRadius` | Sets corner radius for reject button | `rejectButtonCornerRadius: CometChatCornerStyle?` |
-| `acceptButtonBorderWidth` | Sets border width for accept button | `acceptButtonBorderWidth: CGFloat?` |
-| `rejectButtonBorderWidth` | Sets border width for reject button | `rejectButtonBorderWidth: CGFloat?` |
-| `acceptButtonBorderColor` | Sets border color for accept button | `acceptButtonBorderColor: UIColor?` |
-| `rejectButtonBorderColor` | Sets border color for reject button | `rejectButtonBorderColor: UIColor?` |
-| `backgroundColor` | Background color for the call view. | `backgroundColor: UIColor` |
-| `cornerRadius` | Corner radius for the view. | `cornerRadius: nil` |
-| `borderColor` | Border color for the view. | `borderColor: UIColor` |
-| `borderWidth` | Border width for the view. | `borderWidth: CGFloat` |
-| `callLabelColor` | Text color for the call label. | `callLabelColor: UIColor` |
-| `callLabelFont` | Font for the call label. | `callLabelFont: UIFont` |
-| `nameLabelColor` | Text color for the name label. | `nameLabelColor: UIColor` |
-| `nameLabelFont` | Font for the name label. | `nameLabelFont: UIFont` |
-
-***
+List of properties exposed by IncomingCallStyle:
+
+| Property | Description | Code |
+|----------|-------------|------|
+| `overlayBackgroundColor` | Background color for the overlay | `overlayBackgroundColor: UIColor` |
+| `acceptButtonBackgroundColor` | Background color for the accept button | `acceptButtonBackgroundColor: UIColor` |
+| `rejectButtonBackgroundColor` | Background color for the reject button | `rejectButtonBackgroundColor: UIColor` |
+| `acceptButtonTintColor` | Tint color for the accept button | `acceptButtonTintColor: UIColor` |
+| `rejectButtonTintColor` | Tint color for the reject button | `rejectButtonTintColor: UIColor` |
+| `acceptButtonImage` | Icon image for the accept button | `acceptButtonImage: UIImage` |
+| `rejectButtonImage` | Icon image for the reject button | `rejectButtonImage: UIImage` |
+| `acceptButtonCornerRadius` | Sets corner radius for accept button | `acceptButtonCornerRadius: CometChatCornerStyle?` |
+| `rejectButtonCornerRadius` | Sets corner radius for reject button | `rejectButtonCornerRadius: CometChatCornerStyle?` |
+| `acceptButtonBorderWidth` | Sets border width for accept button | `acceptButtonBorderWidth: CGFloat?` |
+| `rejectButtonBorderWidth` | Sets border width for reject button | `rejectButtonBorderWidth: CGFloat?` |
+| `acceptButtonBorderColor` | Sets border color for accept button | `acceptButtonBorderColor: UIColor?` |
+| `rejectButtonBorderColor` | Sets border color for reject button | `rejectButtonBorderColor: UIColor?` |
+| `backgroundColor` | Background color for the call view | `backgroundColor: UIColor` |
+| `cornerRadius` | Corner radius for the view | `cornerRadius: nil` |
+| `borderColor` | Border color for the view | `borderColor: UIColor` |
+| `borderWidth` | Border width for the view | `borderWidth: CGFloat` |
+| `callLabelColor` | Text color for the call label | `callLabelColor: UIColor` |
+| `callLabelFont` | Font for the call label | `callLabelFont: UIFont` |
+| `nameLabelColor` | Text color for the name label | `nameLabelColor: UIColor` |
+| `nameLabelFont` | Font for the name label | `nameLabelFont: UIFont` |
+
+---
### Functionality
These are a set of small functional customizations that allow you to fine-tune the overall experience of the component.
-| Property | Description | Code |
-| ---------------------- | --------------------------------------- | ------------------------------- |
-| disableSoundForCalls | Disables sound for incoming calls. | `disableSoundForCalls = true` |
-| setCustomSoundForCalls | Sets a custom sound for incoming calls. | `set(customSoundForCalls: URL)` |
+| Property | Description | Code |
+|----------|-------------|------|
+| `disableSoundForCalls` | Disables sound for incoming calls | `disableSoundForCalls = true` |
+| `setCustomSoundForCalls` | Sets a custom sound for incoming calls | `set(customSoundForCalls: URL)` |
### Advanced
@@ -292,20 +326,18 @@ cometChatIncomingCall.set(listItemView: { call in
return customView
})
```
-
+
-You can create a CustomListItemView as a custom `UIView`.
+You can create a CustomListItemView as a custom `UIView`:
-```swift swift
+```swift
import UIKit
class CustomListItemView: UIView {
@@ -405,11 +437,11 @@ class CustomListItemView: UIView {
}
```
-***
+---
#### SetLeadingView
-You can modify the leading view of a Incoming call component using the property below.
+You can modify the leading view of an Incoming call component using the property below.
+
-You can create a CustomLeadingView as a custom `UIView`.
+You can create a CustomLeadingView as a custom `UIView`:
+
-You can create a `CustomTitleView` as a custom `UIView`. Which we will inflate in `setTitleView()`
+You can create a `CustomTitleView` as a custom `UIView` which we will inflate in `setTitleView()`:
@@ -60,22 +66,32 @@ Setting a listener for mention-click events in Message Bubbles enhances interact
@@ -120,21 +143,19 @@ Assigns the list of text formatters. If the provided list is not null, it sets t
@@ -143,26 +164,22 @@ Assigns the list of text formatters. If the provided list is not null, it sets t
@@ -171,12 +188,22 @@ Assigns the list of text formatters. If the provided list is not null, it sets t
+---
+
## Image Bubble
Image bubbles display messages with images.
-The following code snippet shows how customize the Image message bubble:
+The following code snippet shows how to customize the image message bubble:
+---
+
## Video Bubble
Video bubbles display messages with video clips.
-The following code snippet shows how customize the Video message bubble:
+The following code snippet shows how to customize the video message bubble:
+---
+
## Audio Bubble
-Audio bubbles display Audio messages.
+Audio bubbles display audio messages.
-The following code snippet shows how customize the Audio message bubble:
+The following code snippet shows how to customize the audio message bubble:
+---
+
## Poll Bubble
-Poll bubbles display messages with polling.
+Poll bubbles display messages with polling options.
-The following code snippet shows how customize the Poll message bubble:
+The following code snippet shows how to customize the poll message bubble:
+---
+
## Link Preview Bubble
-The Link Preview Bubble is designed to display a preview of links shared in messages. It enriches the messaging experience by showing details such as the page title, description, and an image from the linked content, making links more engaging and informative.
+The Link Preview Bubble displays a preview of links shared in messages. It enriches the messaging experience by showing details such as the page title, description, and an image from the linked content, making links more engaging and informative.
-The following code snippet shows how customize the Link preview message bubble:
+The following code snippet shows how to customize the link preview message bubble:
+---
+
## Action Bubble
Action bubbles provide a customizable interface for displaying a variety of actions, such as group actions, within a chat.
-The following code snippet shows how customize the action message bubble:
+The following code snippet shows how to customize the action message bubble:
+---
+
## Delete Bubble
-Delete bubbles displays messages that have been deleted by the sender. These indicate the message removal within the chat interface.
+Delete bubbles display messages that have been deleted by the sender. These indicate the message removal within the chat interface.
-The following code snippet shows how customize the delete message bubble:
+The following code snippet shows how to customize the delete message bubble:
+---
-## AIAssistantBubble
+## AI Assistant Bubble
The AI Assistant Bubble displays responses or messages sent by the AI assistant within the chat interface. These bubbles are designed to visually distinguish AI-generated messages from user messages, maintaining a clear and intuitive conversation flow.
-You can customize the appearance of the AI Assistant message bubble to match your app’s theme — including background color, text color, font, and border styling.
+You can customize the appearance of the AI Assistant message bubble to match your app's theme — including background color, text color, font, and border styling.
The following code snippet shows how to customize the AI Assistant message bubble:
+
-MessageComposer is comprised of the following [Base Components](/ui-kit/ios/components-overview#base-components):
+
+
-## Usage
+---
-### Integration
+## Minimal Render
-The following code snippet illustrates how you can directly incorporate the MessageComposer component into your file.
+```swift
+import CometChatUIKitSwift
+import CometChatSDK
-```csharp
-// syntax for set(user: User)
let messageComposer = CometChatMessageComposer()
messageComposer.set(user: user)
-messageComposer.set(parentMessageId: 20)
```
-### Actions
+
+
+
-[Actions](/ui-kit/ios/components-overview#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.
+---
+
+## Actions and Events
+
+### Callback Props
-##### 1. onSendButtonClick
+#### onSendButtonClick
-The `set(onSendButtonClick:)` event gets activated when the send message button is clicked. The following code snippet Overrides the action of the send button in CometChatMessageComposer.
+Fires when the send button is clicked. Use this to handle custom send actions.
-
+
+
+You can create a `CustomHeaderView` as a custom `UIView`:
+
+```swift
+import UIKit
+
+class CustomHeaderView: UIView {
+
+ private let iconImageView: UIImageView = {
+ let imageView = UIImageView()
+ imageView.image = UIImage(systemName: "bell.slash.fill")
+ imageView.tintColor = .purple
+ imageView.contentMode = .scaleAspectFit
+ return imageView
+ }()
+
+ private let messageLabel: UILabel = {
+ let label = UILabel()
+ label.text = "User has paused their notifications"
+ label.textColor = .black
+ label.font = UIFont.systemFont(ofSize: 14, weight: .medium)
+ return label
+ }()
+
+ override init(frame: CGRect) {
+ super.init(frame: frame)
+ setupView()
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ private func setupView() {
+ backgroundColor = UIColor.purple.withAlphaComponent(0.1)
+ layer.cornerRadius = 12
+
+ addSubview(iconImageView)
+ addSubview(messageLabel)
-
+
-The following properties are exposed by MessageComposerStyle:
-
-| **Property** | **Description** | **Code** |
-| ----------------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
-| **Placeholder Text Font** | Font for the placeholder text in the input field. | `CometChatMessageComposer.style.placeHolderTextFont = CometChatTypography.Body.regular` |
-| **Placeholder Text Color** | Color for the placeholder text in the input field. | `CometChatMessageComposer.style.placeHolderTextColor = CometChatTheme.textColorTertiary` |
-| **Text Field Color** | Text color for the input field. | `CometChatMessageComposer.style.textFiledColor = CometChatTheme.textColorPrimary` |
-| **Text Field Font** | Font for the input field text. | `CometChatMessageComposer.style.textFiledFont = CometChatTypography.Body.regular` |
-| **Background Color** | Background color with dynamic support for light and dark mode. | `CometChatMessageComposer.style.backgroundColor = UIColor.dynamicColor(lightModeColor: ..., darkModeColor: ...)` |
-| **Corner Radius** | Corner radius for the composer. | `CometChatMessageComposer.style.cornerRadius = CometChatCornerStyle?` |
-| **Border Width** | Border width for the composer. | `CometChatMessageComposer.style.borderWidth = 0` |
-| **Border Color** | Border color for the composer. | `CometChatMessageComposer.style.borderColor = .clear` |
-| **Send Button Image** | Icon for the send button. | `CometChatMessageComposer.style.sendButtonImage = UIImage(named: "custom-send")` |
-| **Send Button Tint Color** | Tint color for the send button image. | `CometChatMessageComposer.style.sendButtonImageTint = CometChatTheme.white` |
-| **Active Send Button Background Color** | Background color for the send button when active. | `CometChatMessageComposer.style.activeSendButtonImageBackgroundColor = CometChatTheme.primaryColor` |
-| **Inactive Send Button Background Color** | Background color for the send button when inactive. | `CometChatMessageComposer.style.inactiveSendButtonImageBackgroundColor = CometChatTheme.neutralColor300` |
-| **Compose Box Background Color** | Background color for the compose box. | `CometChatMessageComposer.style.composeBoxBackgroundColor = CometChatTheme.backgroundColor01` |
-| **Compose Box Border Color** | Border color for the compose box. | `CometChatMessageComposer.style.composeBoxBorderColor = CometChatTheme.borderColorDefault` |
-| **Compose Box Border Width** | Border width for the compose box. | `CometChatMessageComposer.style.composeBoxBorderWidth = 1` |
-| **Compose Box Corner Radius** | Corner radius for the compose box. | `CometChatMessageComposer.style.composerBoxCornerRadius = .init(cornerRadius: CometChatSpacing.Radius.r2)` |
-| **Compose Box Separator Color** | Color for the separator in the compose box. | `CometChatMessageComposer.style.composerSeparatorColor = CometChatTheme.borderColorLight` |
-| **Attachment Image** | Icon for the attachment button. | `CometChatMessageComposer.style.attachmentImage = UIImage(systemName: "plus.circle")` |
-| **Attachment Image Tint** | Tint color for the attachment image. | `CometChatMessageComposer.style.attachmentImageTint = CometChatTheme.iconColorSecondary` |
-| **Voice Recording Image** | Icon for the voice recording button. | `CometChatMessageComposer.style.voiceRecordingImage = UIImage(systemName: "mic")?.withRenderingMode(.alwaysTemplate)` |
-| **Voice Recording Image Tint** | Tint color for the voice recording image. | `CometChatMessageComposer.style.voiceRecordingImageTint = CometChatTheme.iconColorSecondary` |
-| **AI Image** | Icon for the AI button. | `CometChatMessageComposer.style.aiImage = UIImage(named: "ai-image")` |
-| **AI Image Tint** | Tint color for the AI image. | `CometChatMessageComposer.style.aiImageTint = CometChatTheme.iconColorSecondary` |
-| **Sticker Image** | Icon for the sticker button. | `CometChatMessageComposer.style.stickerImage = UIImage(named: "sticker-image")` |
-| **Sticker Image Tint** | Tint color for the sticker image. | `CometChatMessageComposer.style.stickerTint = CometChatTheme.iconColorSecondary` |
-| **Edit Preview Title Font** | Font for the title in the edit preview. | `CometChatMessageComposer.style.editPreviewTitleTextFont = CometChatTypography.Body.regular` |
-| **Edit Preview Message Font** | Font for the message text in the edit preview. | `CometChatMessageComposer.style.editPreviewMessageTextFont = CometChatTypography.Caption1.regular` |
-| **Edit Preview Title Color** | Text color for the title in the edit preview. | `CometChatMessageComposer.style.editPreviewTitleTextColor = CometChatTheme.textColorPrimary` |
-| **Edit Preview Message Color** | Text color for the message in the edit preview. | `CometChatMessageComposer.style.editPreviewMessageTextColor = CometChatTheme.textColorSecondary` |
-| **Edit Preview Background Color** | Background color for the edit preview. | `CometChatMessageComposer.style.editPreviewBackgroundColor = CometChatTheme.backgroundColor03` |
-| **Edit Preview Corner Radius** | Corner radius for the edit preview. | `CometChatMessageComposer.style.editPreviewCornerRadius = .init(cornerRadius: CometChatSpacing.Radius.r1)` |
-| **Edit Preview Border Color** | Border color for the edit preview. | `CometChatMessageComposer.style.editPreviewBorderColor = .clear` |
-| **Edit Preview Border Width** | Border width for the edit preview. | `CometChatMessageComposer.style.editPreviewBorderWidth = 0` |
-| **Edit Preview Close Icon** | Icon for closing the edit preview. | `CometChatMessageComposer.style.editPreviewCloseIcon = UIImage(systemName: "xmark")?.withRenderingMode(.alwaysTemplate)` |
-| **Edit Preview Close Icon Tint** | Tint color for the close icon in the edit preview. | `CometChatMessageComposer.style.editPreviewCloseIconTint = CometChatTheme.iconColorPrimary` |
-| **Info Icon** | Icon for the info button. | `CometChatMessageComposer.style.infoIcon = UIImage(systemName: "info.circle")` |
-| **Info Icon Tint** | Tint color for the info icon. | `CometChatMessageComposer.style.infoIconTint = CometChatTheme.errorColor` |
-| **Info Text Color** | Text color for the info text. | `CometChatMessageComposer.style.infoTextColor = CometChatTheme.errorColor` |
-| **Info Text Font** | Font for the info text. | `CometChatMessageComposer.style.infoTextFont = CometChatTypography.Caption1.regular` |
-| **Info Separator Color** | Color for the separator in the info section. | `CometChatMessageComposer.style.infoSeparatorColor = CometChatTheme.borderColorLight` |
-| **Info Background Color** | Background color for the info section. | `CometChatMessageComposer.style.infoBackgroundColor = CometChatTheme.backgroundColor02` |
-| **Info Corner Radius** | Corner radius for the info section. | `CometChatMessageComposer.style.infoCornerRadius = .init(cornerRadius: CometChatSpacing.Radius.r1)` |
-| **Info Border Color** | Border color for the info section. | `CometChatMessageComposer.style.infoBorderColor = .clear` |
-| **Info Border Width** | Border width for the info section. | `CometChatMessageComposer.style.infoBorderWidth = 0` |
-
-##### 2. MediaRecorder Style
-
-To customize the media recording styling, you can apply the `MediaRecorderStyle` to the `MessageComposer` component. For more details, please refer to [MediaRecorder](/ui-kit/ios/component-styling#media-recorder) styles.
-
-**Global level styling**
-
-
-
+| | |
+|---|---|
+| Type | `AttachmentSheetStyle` |
+| Default | `AttachmentSheetStyle()` |
-The following properties are exposed by Media Recorder Style:
+```swift
+import CometChatUIKitSwift
+
+let messageComposer = CometChatMessageComposer()
-| **Property** | **Description** | **Code** |
-| ---------------------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
-| **backgroundColor** | Sets the background color of the media recorder. | `mediaRecorderStyle.backgroundColor: UIColor = CometChatTheme.backgroundColor01` |
-| **borderWidth** | Defines the width of the border for the media recorder. | `mediaRecorderStyle.borderWidth: CGFloat = 1` |
-| **borderColor** | Specifies the border color of the media recorder. | `mediaRecorderStyle.borderColor: UIColor = CometChatTheme.borderColorLight` |
-| **cornerRadius** | Configures the corner radius of the media recorder. | `mediaRecorderStyle.cornerRadius: CometChatCornerStyle? = nil` |
-| **recordingButtonBackgroundColor** | Sets the background color of the recording button. | `mediaRecorderStyle.recordingButtonBackgroundColor: UIColor = CometChatTheme.iconColorHighlight` |
-| **recordingButtonCornerRadius** | Configures the corner radius of the recording button. | `mediaRecorderStyle.recordingButtonCornerRadius: CometChatCornerStyle? = nil` |
-| **recordingButtonBorderWidth** | Sets the border width of the recording button. | `mediaRecorderStyle.recordingButtonBorderWidth: CGFloat = 0` |
-| **recordingButtonBorderColor** | Sets the border color of the recording button. | `mediaRecorderStyle.recordingButtonBorderColor: UIColor = .clear` |
-| **recordingButtonImageTintColor** | Specifies the tint color of the recording button image. | `mediaRecorderStyle.recordingButtonImageTintColor: UIColor = CometChatTheme.white` |
-| **recordingButtonImage** | The image displayed on the recording button. | `mediaRecorderStyle.recordingButtonImage: UIImage = UIImage(systemName: "mic.fill") ?? UIImage()` |
-| **deleteButtonBackgroundColor** | Sets the background color of the delete button. | `mediaRecorderStyle.deleteButtonBackgroundColor: UIColor = CometChatTheme.backgroundColor01` |
-| **deleteButtonImageTintColor** | Specifies the tint color of the delete button image. | `mediaRecorderStyle.deleteButtonImageTintColor: UIColor = CometChatTheme.iconColorSecondary` |
-| **deleteButtonImage** | The image displayed on the delete button. | `mediaRecorderStyle.deleteButtonImage: UIImage = UIImage(systemName: "trash.fill") ?? UIImage()` |
-| **deleteButtonCornerRadius** | Configures the corner radius of the delete button. | `mediaRecorderStyle.deleteButtonCornerRadius: CometChatCornerStyle? = nil` |
-| **deleteButtonBorderWidth** | Sets the border width of the delete button. | `mediaRecorderStyle.deleteButtonBorderWidth: CGFloat = 1` |
-| **deleteButtonBorderColor** | Specifies the border color of the delete button. | `mediaRecorderStyle.deleteButtonBorderColor: UIColor = CometChatTheme.borderColorLight` |
+let attachmentSheetStyle = AttachmentSheetStyle()
+attachmentSheetStyle.backgroundColor = UIColor.systemBackground
+attachmentSheetStyle.iconTint = UIColor.systemBlue
+attachmentSheetStyle.titleColor = UIColor.label
-##### 3. AI Options Style
+messageComposer.attachmentSheetStyle = attachmentSheetStyle
+```
+
+#### suggestionsStyle
-To customize the media recording styling, you can apply the `AIOptionsStyle` to the `MessageComposer` component. For more details, please refer to [MediaRecorder](/ui-kit/ios/component-styling#media-recorder) styles.
+Customizes the appearance of the suggestions view (for mentions and other suggestions).
-**Global level styling**
+| | |
+|---|---|
+| Type | `SuggestionsStyle` |
+| Default | `SuggestionsStyle()` |
-
-
+| | |
+|---|---|
+| Type | `MentionStyle` |
+| Default | `MentionStyle()` |
-The following properties are exposed by AI Options Style:
-
-| **Property** | **Description** | **Code** |
-| ---------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------ |
-| **errorViewTextFont** | Specifies the font used for the text in the error view. | `aIOptionsStyle.errorViewTextFont: UIFont?` |
-| **errorViewTextColor** | Sets the color of the text in the error view. | `aIOptionsStyle.errorViewTextColor: UIColor?` |
-| **emptyViewTextFont** | Specifies the font used for the text in the empty view. | `aIOptionsStyle.emptyViewTextFont: UIFont?` |
-| **emptyViewTextColor** | Sets the color of the text in the empty view. | `aIOptionsStyle.emptyViewTextColor: UIColor?` |
-| **aiImageTintColor** | Configures the tint color for AI-related images. | `aIOptionsStyle.aiImageTintColor: UIColor = CometChatTheme.iconColorHighlight` |
-| **textColor** | Sets the color of the text. | `aIOptionsStyle.textColor: UIColor = CometChatTheme.textColorPrimary` |
-| **textFont** | Specifies the font for the text. | `aIOptionsStyle.textFont: UIFont = CometChatTypography.Heading4.regular` |
-| **backgroundColor** | Sets the background color. | `aIOptionsStyle.backgroundColor: UIColor = CometChatTheme.backgroundColor01` |
-| **borderWidth** | Sets the width of the border. | `aIOptionsStyle.borderWidth: CGFloat = 0` |
-| **borderColor** | Sets the color of the border. | `aIOptionsStyle.borderColor: UIColor = .clear` |
-| **cornerRadius** | Configures the corner radius of the view. | `aIOptionsStyle.cornerRadius: CometChatCornerStyle? = nil` |
-
-***
-
-### 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 set maximum lines text area will show before scrolling in the composer, edit a message, add header view and footer view to the composer, etc.
-
-Below is a list of customizations along with corresponding code snippets message composer offers
-
-| Property | Description | Code |
-| --------------------------------- | -------------------------------------------------------- | ------------------------------------------ |
-| setInitialComposerText | Sets the initial text in the composer when it loads. | `setInitialComposerText("Hello")` |
-| disableTypingEvents | Disables sending typing indicators when the user types. | `disableTypingEvents = true` |
-| disableMentions | Disables the mention feature in the composer. | `disableMentions = true` |
-| hideImageAttachmentOption | Hides the option to attach images. | `hideImageAttachmentOption = true` |
-| hideVideoAttachmentOption | Hides the option to attach videos. | `hideVideoAttachmentOption = true` |
-| hideAudioAttachmentOption | Hides the option to attach audio files. | `hideAudioAttachmentOption = true` |
-| hideFileAttachmentOption | Hides the option to attach files. | `hideFileAttachmentOption = true` |
-| hidePollsOption | Hides the option to create polls. | `hidePollsOption = true` |
-| hideCollaborativeDocumentOption | Hides the option for collaborative documents. | `hideCollaborativeDocumentOption = true` |
-| hideCollaborativeWhiteboardOption | Hides the option for collaborative whiteboards. | `hideCollaborativeWhiteboardOption = true` |
-| hideAttachmentButton | Hides the attachment button in the composer. | `hideAttachmentButton = true` |
-| hideVoiceRecordingButton | Hides the voice recording button. | `hideVoiceRecordingButton = true` |
-| hideStickersButton | Hides the stickers button. | `hideStickersButton = true` |
-| hideSendButton | Hides the send button. | `hideSendButton = true` |
-| setUser | Sets the user for direct messaging. | `set(user: User)` |
-| setGroup | Sets the group for group messaging. | `set(group: Group)` |
-| setParentMessageId | Sets the parent message ID for replying in a thread. | `set(parentMessageId: 12345)` |
-| setMaxLine | Sets the maximum number of lines for the composer input. | `set(maxLine: 3)` |
-| setCustomSoundForMessages | Sets a custom sound for sending messages. | `set(customSoundForMessages: URL?)` |
-| disableSoundForMessages | Disables sound while sending messages. | `disableSoundForMessages = true` |
-
-***
-
-### 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.
-
-#### AttachmentOptions
-
-By using `set(attachmentOptions:)`, you can set a list of custom `MessageComposerActions` for the MessageComposer Component. This will override the existing list of `CometChatMessageComposerAction`.
-
-
-
+All props are optional. Sorted alphabetically.
-In this example, we are overriding the existing MessageComposerActions List with Capture Photo actions.
-
-
-
+### hideCollaborativeDocumentOption
+
+Hides the collaborative document option in the attachment menu.
+
+| | |
+|---|---|
+| Type | `Bool` |
+| Default | `false` |
-
-
+```swift
+import CometChatUIKitSwift
+
+let messageComposer = CometChatMessageComposer()
+messageComposer.hideImageAttachmentOption = true
+```
+
+### hidePollsOption
+
+Hides the polls option in the attachment menu.
+
+| | |
+|---|---|
+| Type | `Bool` |
+| Default | `false` |
-
+
-The `MessageHeader` is comprised of the following components:
-
-| Components | Description |
-| ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
-| [ListItem Component](/ui-kit/ios/list-item) | This component’s view consists of avatar, status indicator , title, and subtitle. The fields are then mapped with the SDK’s user, group class. |
-| Back Button | BackButton that allows users to navigate back from the current activity or screen to the previous one |
-
-## Usage
-
-### Integration
-
-You can add `MessageHeader` component directly by setting the user.
-
-```ruby Swift
-// syntax for set(user: User)
-messageHeader.set(user: user) // The object which is going to be rendered in the data item
-```
-
-### Actions
-
-[Actions](/ui-kit/ios/components-overview#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.
-
-The `MessageHeader` component does not have any exposed actions.
-
-##### 1. set(onBack:)
-
-This `set(onBack:)` method becomes valuable when a user needs to override the action triggered upon pressing the back button in CometChatMessageHeader.
-
-
+
-The properties exposed by `MessageHeaderStyle` are as follows:
-
-| **Property** | **Description** | **Code** |
-| --------------------------------------- | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
-| **Title Text Color** | Used to set the text color of the header title. | `CometChatMessageHeader.style.titleTextColor = UIColor.black` |
-| **Title Text Font** | Used to set the font style of the header title. | `CometChatMessageHeader.style.titleTextFont = UIFont.boldSystemFont(ofSize: 18)` |
-| **Subtitle Text Color** | Used to set the text color of the subtitle in the header. | `CometChatMessageHeader.style.subtitleTextColor = UIColor.gray` |
-| **Subtitle Text Font** | Used to set the font style of the subtitle in the header. | `CometChatMessageHeader.style.subtitleTextFont = UIFont.systemFont(ofSize: 14)` |
-| **Back Button Image Tint Color** | Used to set the tint color of the back button image in the header. | `CometChatMessageHeader.style.backButtonImageTintColor = UIColor.blue` |
-| **Private Group Badge Tint Color** | Used to set the tint color of the private group badge in the header. | `CometChatMessageHeader.style.privateGroupBadgeImageTintColor = UIColor.green` |
-| **Password-Protected Badge Tint Color** | Used to set the tint color of the password-protected group badge in the header. | `CometChatMessageHeader.style.passwordProtectedGroupBadgeImageTintColor = UIColor.orange` |
-| **Private Group Background Color** | Used to set the background color of the private group badge. | `CometChatMessageHeader.style.privateGroupImageBackgroundColor = UIColor.lightGray` |
-| **Password-Protected Background Color** | Used to set the background color of the password-protected group badge. | `CometChatMessageHeader.style.passwordGroupImageBackgroundColor = UIColor.red` |
-| **Group Image Background Color** | Used to set the background color for group icons in the header. | `CometChatMessageHeader.style.groupImageBackgroundColor = UIColor.clear` |
-| **Avatar Style** | Used to customize the appearance of the avatar in the header. | `CometChatMessageHeader.style.avatarStyle = customAvatarStyle` |
-| **Background Color** | Used to set the background color of the header. | `CometChatMessageHeader.style.backgroundColor = UIColor.white` |
-| **Corner Radius** | Used to set the corner radius of the header. | `CometChatMessageHeader.style.cornerRadius = CometChatCornerStyle(cornerRadius: 8)` |
-| **Border Width** | Used to set the border width of the header. | `CometChatMessageHeader.style.borderWidth = 2` |
-| **Border Color** | Used to set the border color of the header. | `CometChatMessageHeader.style.borderColor = UIColor.gray` |
-| **Back Button Icon** | Used to set a custom icon for the back button. | `CometChatMessageHeader.style.backButtonIcon = UIImage(named: "customBackIcon")` |
-| **Private Group Icon** | Used to set a custom icon for private groups. | `CometChatMessageHeader.style.privateGroupIcon = UIImage(named: "privateIcon")` |
-| **Protected Group Icon** | Used to set a custom icon for password-protected groups. | `CometChatMessageHeader.style.protectedGroupIcon = UIImage(named: "protectedIcon")` |
-| **Background Image** | Used to set a background image for the header. | `CometChatMessageHeader.style.backgroundImage = UIImage(named: "headerBackground")` |
-| **New Chat Icon** | Sets a custom icon for the new chat button for AI agent. | `CometChatAIAssistantChatHistory.newChatIcon = UIImage(named: "iconName")` |
-| **Chat History Icon** | Sets a custom icon for the chat history button for AI agent. | `CometChatAIAssistantChatHistory.chatHistoryIcon = UIImage(named: "iconName")` |
-
-##### 2. Avatar Style
-
-If you want to apply customized styles to the `Avatar` component within the `MessageHeader` Component, you can use the following code snippet. For more information you can refer [Avatar Styles](/ui-kit/ios/component-styling#avatar#methods).
-
-**Global level styling**
-
-
-***
-
-### 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
+## Actions and Events
-| Method | Description | Code |
-| ------------------- | ---------------------------------------------------------------------- | ---------------------------- |
-| set(user:User) | Sets message header for CometChat user. | `.set(user:User)` |
-| set(group:Group) | Sets message header for CometChat group. | `.set(group:Group)` |
-| hideBackButton | Hides the back button of message header. | `hideBackButton = true` |
-| hideUserStatus | Hides or shows the user status of user(online/offline/last active at). | `hideUserStatus = true` |
-| hideVideoCallButton | Hides the video call button. | `hideVideoCallButton = true` |
-| hideVoiceCallButton | Hides the voice call button. | `hideVoiceCallButton = true` |
-| hideChatHistoryButton | Hides the chat history button in the component. | `CometChatAIAssistantChatHistory.hideChatHistoryButton = true` |
-| hideNewChatButton | Hides the new chat button in the component for AI agent. | `CometChatAIAssistantChatHistory.hideNewChatButton = true` |
-| onNewChatButtonClicked | Used to handle actions when the “New Chat” button is clicked. | `CometChatAIAssistantChatHistory.set(onNewChatButtonClicked: { user in })` |
-| onMessageClicked | Used to handle actions when a message is clicked. | `CometChatAIAssistantChatHistory.set(onMessageClicked: { message in })` |
+### Callback Props
-***
+#### onBack
-### Advanced
+Fires when the back button is pressed. Use this for custom navigation handling.
-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.
+```swift
+import CometChatUIKitSwift
-#### Date Time Formatter
+let messageHeader = CometChatMessageHeader()
-The **CometChatMessageHeader** component supports full customization of how date and time are displayed using the [CometChatDateTimeFormatter](/ui-kit/ios/localize#datetimeformatter).
+messageHeader.set(onBack: { [weak self] in
+ self?.navigationController?.popViewController(animated: true)
+})
+```
-This enables developers to localize, format, or personalize the date and time strings shown next to the message header such as “Today”, “Yesterday”, “12:45 PM”, etc.
+#### onError
-1. Component-Level (Global)
+Fires when an error occurs.
-
-
-
-You can create a `CustomListItemView` as a custom `UIView`. Which we will inflate in `setListItemView()`
-
-```swift swift
+```swift
import UIKit
+import CometChatSDK
-class CustomListItemView: UIView {
-
+class CustomHeaderView: UIView {
+
private let backButton: UIButton = {
let button = UIButton(type: .system)
- let image = UIImage(systemName: "chevron.left")?.withRenderingMode(.alwaysTemplate)
- button.setImage(image, for: .normal)
+ button.setImage(UIImage(systemName: "chevron.left"), for: .normal)
button.tintColor = .black
return button
}()
-
- private let profileImageView: UIView = {
- let view = UIView()
- view.backgroundColor = UIColor.systemPurple
- view.layer.cornerRadius = 18
- view.clipsToBounds = true
-
- let label = UILabel()
- label.text = "GA"
- label.font = UIFont.systemFont(ofSize: 16, weight: .bold)
- label.textColor = .white
- label.textAlignment = .center
- label.translatesAutoresizingMaskIntoConstraints = false
-
- view.addSubview(label)
-
- NSLayoutConstraint.activate([
- label.centerXAnchor.constraint(equalTo: view.centerXAnchor),
- label.centerYAnchor.constraint(equalTo: view.centerYAnchor)
- ])
-
- return view
+
+ private let profileImageView: UIImageView = {
+ let imageView = UIImageView()
+ imageView.contentMode = .scaleAspectFill
+ imageView.layer.cornerRadius = 18
+ imageView.clipsToBounds = true
+ imageView.backgroundColor = .lightGray
+ return imageView
}()
-
+
private let nameLabel: UILabel = {
let label = UILabel()
- label.text = "George Alan"
- label.font = UIFont.systemFont(ofSize: 16, weight: .bold)
+ label.font = UIFont.systemFont(ofSize: 16, weight: .semibold)
label.textColor = .black
return label
}()
-
+
private let statusLabel: UILabel = {
let label = UILabel()
- label.text = "Online"
- label.font = UIFont.systemFont(ofSize: 12, weight: .regular)
+ label.font = UIFont.systemFont(ofSize: 12)
label.textColor = .gray
return label
}()
-
+
private let videoCallButton: UIButton = {
let button = UIButton(type: .system)
- let image = UIImage(systemName: "video.fill")?.withRenderingMode(.alwaysTemplate)
- button.setImage(image, for: .normal)
+ button.setImage(UIImage(systemName: "video.fill"), for: .normal)
button.tintColor = .black
return button
}()
-
+
private let callButton: UIButton = {
let button = UIButton(type: .system)
- let image = UIImage(systemName: "phone.fill")?.withRenderingMode(.alwaysTemplate)
- button.setImage(image, for: .normal)
+ button.setImage(UIImage(systemName: "phone.fill"), for: .normal)
button.tintColor = .black
return button
}()
-
+
override init(frame: CGRect) {
super.init(frame: frame)
setupView()
@@ -438,38 +330,41 @@ class CustomListItemView: UIView {
rightButtonsStack.centerYAnchor.constraint(equalTo: centerYAnchor)
])
}
+
+ func configure(user: User?, group: Group?) {
+ nameLabel.text = user?.name ?? group?.name ?? "Chat"
+ if let user = user {
+ statusLabel.text = user.status == .online ? "Online" : "Offline"
+ } else if let group = group {
+ statusLabel.text = "\(group.membersCount) members"
+ }
+ }
}
```
-***
-
-#### SetLeadingView
+### leadingView
-You can modify the leading view of a group cell using .set(leadingView:).
+Customize the leading view (avatar area) of the header.
-
+
-You can create a `CustomLeadingView` as a custom `UIView`. Which we will inflate in `setLeadingView()`
+You can create a `CustomLeadingView` as a custom `UIView`:
-
+
-You can create a `CustomTitleView` as a custom `UIView`. Which we will inflate in `setTitleView()`
+You can create a `CustomTitleView` as a custom `UIView`:
-
+
-You can create a `CustomTrailView` as a custom `UIView`. Which we will inflate in `setTrailView()`
+You can create a `CustomTrailView` as a custom `UIView`:
-
+
-You can seamlessly integrate this `CustomSubtitleView` UIView file into the `.set(subtitleView:)` method within CometChatMessageHeader.
+### Key Style Properties
+
+| Property | Type | Default | Description |
+|----------|------|---------|-------------|
+| `backgroundColor` | `UIColor` | `CometChatTheme.backgroundColor01` | Background color |
+| `borderWidth` | `CGFloat` | `0` | Border width |
+| `borderColor` | `UIColor` | `.clear` | Border color |
+| `cornerRadius` | `CometChatCornerStyle?` | `nil` | Corner radius |
+| `titleTextColor` | `UIColor` | `CometChatTheme.textColorPrimary` | Title text color |
+| `titleTextFont` | `UIFont` | `CometChatTypography.Heading4.medium` | Title font |
+| `subtitleTextColor` | `UIColor` | `CometChatTheme.textColorSecondary` | Subtitle text color |
+| `subtitleTextFont` | `UIFont` | `CometChatTypography.Body.regular` | Subtitle font |
+| `backButtonImageTintColor` | `UIColor` | `CometChatTheme.iconColorPrimary` | Back button tint |
+| `backButtonIcon` | `UIImage?` | System chevron | Back button icon |
+| `privateGroupBadgeImageTintColor` | `UIColor` | `CometChatTheme.iconColorSecondary` | Private group badge tint |
+| `passwordProtectedGroupBadgeImageTintColor` | `UIColor` | `CometChatTheme.iconColorSecondary` | Password group badge tint |
+| `avatarStyle` | `AvatarStyle` | `AvatarStyle()` | Avatar customization |
+| `statusIndicatorStyle` | `StatusIndicatorStyle` | `StatusIndicatorStyle()` | Online/offline status indicator customization |
+| `typingIndicatorStyle` | `TypingIndicatorStyle` | `TypingIndicatorStyle()` | Typing indicator customization |
+
+### Customization Matrix
+
+| What to change | Where | Property/API | Example |
+|----------------|-------|--------------|---------|
+| Background color | Style | `backgroundColor` | `UIColor.systemBackground` |
+| Title appearance | Style | `titleTextColor`, `titleTextFont` | Custom colors and fonts |
+| Subtitle appearance | Style | `subtitleTextColor`, `subtitleTextFont` | Custom colors and fonts |
+| Back button | Style | `backButtonIcon`, `backButtonImageTintColor` | Custom icon and color |
+| Avatar look | Style | `avatarStyle` | `AvatarStyle()` with custom radius |
+| Status indicator | Style | `statusIndicatorStyle` | `StatusIndicatorStyle()` with custom colors |
+| Typing indicator | Style | `typingIndicatorStyle` | `TypingIndicatorStyle()` with custom font |
+| Hide back button | Property | `hideBackButton` | `header.hideBackButton = true` |
+| Hide status | Property | `hideUserStatus` | `header.hideUserStatus = true` |
+| Disable typing | Property | `disableTyping` | `header.disableTyping = true` |
+| Hide AI buttons | Property | `hideNewChatButton`, `hideChatHistoryButton` | `header.hideNewChatButton = true` |
+| Custom subtitle | View Slot | `set(subtitleView:)` | See Custom View Slots |
+| Custom menu options | Method | `set(options:)` | See Menu Customization |
+
+---
+
+## Connection Management
+
+Manually control the WebSocket connection for the message header.
+
+### connect()
+
+Establishes the WebSocket connection for real-time updates. Use this when you need to manually reconnect after disconnecting.
+
+```swift
+@discardableResult
+public func connect() -> Self
+```
+
+```swift
+import CometChatUIKitSwift
+
+let messageHeader = CometChatMessageHeader()
+
+// Manually connect to receive real-time updates
+messageHeader.connect()
+```
+
+### disconnect()
+
+Disconnects the WebSocket connection. Use this when you want to temporarily stop receiving real-time updates, such as when the view is not visible.
+
+```swift
+@discardableResult
+public func disconnect() -> Self
+```
-
+
+
+
+
-***
+---
+
+## Minimal Render
+
+```swift
+import CometChatUIKitSwift
+import CometChatSDK
+
+let messageList = CometChatMessageList()
+messageList.set(user: user)
+```
+
+
+
+
-## Usage
+---
-### Integration
+## Filtering
-The following code snippet illustrates how you can directly incorporate the MessageList component.
+Use `MessagesRequest.MessageRequestBuilder` to filter which messages appear in the list. The builder pattern allows chaining multiple filter conditions.
-
-
+| Slot | Signature | Replaces |
+|------|-----------|----------|
+| `headerView` | `UIView` | Header above message list |
+| `footerView` | `UIView` | Footer below message list |
+| `emptyView` | `UIView` | Empty state display |
+| `errorView` | `UIView` | Error state display |
+| `loadingView` | `UIView` | Loading state display |
+| `newMessageIndicatorView` | `UIView` | New message indicator |
+
+### set(headerView:)
+
+Replaces the default header with a custom view.
+
+| | |
+|---|---|
+| Signature | `(UIView) -> Self` |
+| Replaces | Default header above message list |
-List of properties exposed by MessageListStyle
-
-| **Property** | **Description** | **Code** |
-| ------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
-| **Background Color** | Background color with dynamic support for light and dark mode. | `CometChatMessageList.style.backgroundColor = UIColor.dynamicColor(lightModeColor: ..., darkModeColor: ...)` |
-| **Border Width** | Border width for the component. | `CometChatMessageList.style.borderWidth = 0` |
-| **Border Color** | Border color for the component. | `CometChatMessageList.style.borderColor = .clear` |
-| **Corner Radius** | Corner radius for the component. | `CometChatMessageList.style.cornerRadius = CometChatCornerStyle?` |
-| **Shimmer Gradient Color 1** | First color of the shimmer gradient. | `CometChatMessageList.style.shimmerGradientColor1 = CometChatTheme.backgroundColor04` |
-| **Shimmer Gradient Color 2** | Second color of the shimmer gradient. | `CometChatMessageList.style.shimmerGradientColor2 = CometChatTheme.backgroundColor03` |
-| **Empty State Title Color** | Text color for the title in the empty state. | `CometChatMessageList.style.emptyStateTitleColor = CometChatTheme.textColorPrimary` |
-| **Empty State Title Font** | Font for the title in the empty state. | `CometChatMessageList.style.emptyStateTitleFont = CometChatTypography.Heading3.bold` |
-| **Empty State Subtitle Color** | Text color for the subtitle in the empty state. | `CometChatMessageList.style.emptyStateSubtitleColor = CometChatTheme.textColorSecondary` |
-| **Empty State Subtitle Font** | Font for the subtitle in the empty state. | `CometChatMessageList.style.emptyStateSubtitleFont = CometChatTypography.Body.regular` |
-| **Error State Title Color** | Text color for the title in the error state. | `CometChatMessageList.style.errorStateTitleColor = CometChatTheme.textColorPrimary` |
-| **Error State Title Font** | Font for the title in the error state. | `CometChatMessageList.style.errorStateTitleFont = CometChatTypography.Heading3.bold` |
-| **Error State Subtitle Color** | Text color for the subtitle in the error state. | `CometChatMessageList.style.errorStateSubtitleColor = CometChatTheme.textColorSecondary` |
-| **Error State Subtitle Font** | Font for the subtitle in the error state. | `CometChatMessageList.style.errorStateSubtitleFont = CometChatTypography.Body.regular` |
-| **Threaded Message Image** | Icon image for threaded messages. | `CometChatMessageList.style.threadedMessageImage = UIImage(systemName: "arrow.turn.down.right")` |
-| **Error Image** | Icon image for error state. | `CometChatMessageList.style.errorImage = UIImage(named: "error-icon")` |
-| **Empty Image** | Icon image for empty state. | `CometChatMessageList.style.emptyImage = UIImage(named: "empty-icon")` |
-| **New Message Indicator Image** | Icon image for new message indicator. | `CometChatMessageList.style.newMessageIndicatorImage = UIImage?` |
-| **New Message Indicator Text Color** | Text color for unread messages indicator. | `CometChatMessageList.style.newMessageIndicatorTextColor = UIColor?` |
-| **New Message Indicator Text Font** | Text font for unread messages indicator. | `CometChatMessageList.style.newMessageIndicatorTextFont = UIFont?` |
-| **New Message Indicator Background Color** | Background color for unread messages indicator. | `CometChatMessageList.style.newMessageIndicatorBackgroundColor = UIColor?` |
-
-
-
-***
-
-### 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
-
-| Property | Description | Code |
-| ------------------------------- | ------------------------------------------------------------ | ------------------------------------------- |
-| hideAvatar | Hides the avatar of the sender. | `hideAvatar = true` |
-| hideGroupActionMessages | Hides group action messages (like join/leave notifications). | `hideGroupActionMessages = true` |
-| hideReplyInThreadOption | Hides the reply in thread option. | `hideReplyInThreadOption = true` |
-| hideTranslateMessageOption | Hides the message translation option. | `hideTranslateMessageOption = true` |
-| hideEditMessageOption | Hides the edit message option. | `hideEditMessageOption = true` |
-| hideDeleteMessageOption | Hides the delete message option. | `hideDeleteMessageOption = true` |
-| hideReactionOption | Hides the reaction option on messages. | `hideReactionOption = true` |
-| hideMessagePrivatelyOption | Hides the option to message privately. | `hideMessagePrivatelyOption = true` |
-| hideCopyMessageOption | Hides the option to copy a message. | `hideCopyMessageOption = true` |
-| hideMessageInfoOption | Hides the message info option. | `hideMessageInfoOption = true` |
-| hideHeaderView | Hides the header view of the message list. | `hideHeaderView = true` |
-| hideFooterView | Hides the footer view of the message list. | `hideFooterView = true` |
-| hideDateSeparator | Hides the date separator between messages. | `hideDateSeparator = true` |
-| scrollToBottomOnNewMessages | Scrolls to the bottom when new messages arrive. | `scrollToBottomOnNewMessages = true` |
-| hideReceipts | Hides the message read receipts (ticks). | `hideReceipts = true` |
-| disableSoundForMessages | Disables the sound when a new message arrives. | `disableSoundForMessages = true` |
-| hideEmptyView | Hides the empty state view when no messages are available. | `hideEmptyView = true` |
-| hideErrorView | Hides the error view when an error occurs. | `hideErrorView = true` |
-| hideLoadingView | Hides the loading view when fetching messages. | `hideLoadingView = true` |
-| hideNewMessageIndicator | Hides the "new message" indicator. | `hideNewMessageIndicator = true` |
-| scrollToBottom(isAnimated:) | Scrolls to the bottom of the message list. | `scrollToBottom(isAnimated: true)` |
-| set(messageAlignment:) | Sets the alignment of messages in the list. | `set(messageAlignment: .left)` |
-| set(smartRepliesKeywords:) | Sets keywords for smart replies. | `set(smartRepliesKeywords: ["Hi", "Bye"])` |
-| set(smartRepliesDelayDuration:) | Sets the delay duration for smart replies. | `set(smartRepliesDelayDuration: 2)` |
-| set(user:parentMessage:) | Sets the user and an optional parent message. | `set(user: user, parentMessage: message)` |
-| set(group:parentMessage:) | Sets the group and an optional parent message. | `set(group: group, parentMessage: message)` |
-| set(messagesRequestBuilder:) | Sets the message request builder. | `set(messagesRequestBuilder: builder)` |
-| set(reactionsRequestBuilder:) | Sets the reactions request builder. | `set(reactionsRequestBuilder: builder)` |
-| set(parentMessageId:) | Sets the parent message ID. | `set(parentMessageId: 12345)` |
-| hideModerationView | Hides the moderation view in the AI assistant chat. | `hideModerationView = true` |
-|hideThreadView | Hides the thread view in the AI assistant chat. | `hideThreadView = true` |
-| set(suggestedMessages:) | List of predefined replies shown in the AI assistant. | `suggestedMessages = ["Hello", "Hi"]` |
-| hideSuggestedMessages | Hides the suggested message replies. | `hideSuggestedMessages = true` |
-| set(emptyChatGreetingView:) | Custom view displayed when the AI assistant chat is empty. | `emptyChatGreetingView = { /* custom view */ }` |
-| set(streamingSpeed:) | Sets the speed of streaming for AI assistant messages. | `streamingSpeed = 50` |
-| goToMessage(withId:) | Scrolls the message list to a specific message, making it visible to the user based on the provided message ID | `goToMessage(messageId: Int)` |
-| startFromUnreadMessages | Starts the message list from the first unread message.. | `startFromUnreadMessages = true` |
-| showMarkAsUnreadOption | Sets the visibility of the “Mark as unread” option in the message actions menu. | `showMarkAsUnreadOption = 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.
-
-#### Date Time Formatter
-
-The **CometChatMessageList** component supports full customization of how date and time are displayed using the [CometChatDateTimeFormatter](/ui-kit/ios/localize#datetimeformatter).
-
-This enables developers to localize, format, or personalize the date and time strings shown next to each message such as “Today”, “Yesterday”, “12:45 PM”, etc.
-
-1. Component-Level (Global)
-
-
-
+| | |
+|---|---|
+| Signature | `(UIView) -> Self` |
+| Replaces | Default loading indicator |
+
+```swift
+import UIKit
+import CometChatUIKitSwift
+
+let messageList = CometChatMessageList()
+
+let loadingView = UIActivityIndicatorView(style: .large)
+loadingView.color = UIColor.systemBlue
+loadingView.startAnimating()
+
+messageList.set(loadingView: loadingView)
+```
+
+### set(newMessageIndicatorView:)
-Following is the code of CustomHeaderView - UIView Class
+Replaces the default new message indicator with a custom view.
+
+| | |
+|---|---|
+| Signature | `(UIView) -> Self` |
+| Replaces | Default new message indicator |
```swift
import UIKit
+import CometChatUIKitSwift
-class CustomHeaderView: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
-
- private var collectionData: [CollectionItem] = [
- CollectionItem(title: "Notes", icon: UIImage(systemName: "doc.text.fill")),
- CollectionItem(title: "Pinned Messages", icon: UIImage(systemName: "bookmark.fill")),
- CollectionItem(title: "Saved Links", icon: UIImage(systemName: "link"))
- ]
-
- private lazy var collectionView: UICollectionView = {
- let layout = UICollectionViewFlowLayout()
- layout.scrollDirection = .horizontal
- layout.minimumInteritemSpacing = 10
- layout.sectionInset = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10)
-
- let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
- collectionView.register(CustomHeaderViewCell.self, forCellWithReuseIdentifier: CustomHeaderViewCell.identifier)
- collectionView.backgroundColor = .clear
- collectionView.showsHorizontalScrollIndicator = false
- collectionView.delegate = self
- collectionView.dataSource = self
- collectionView.tag = 1
- return collectionView
- }()
-
-
- override func viewDidLoad() {
- super.viewDidLoad()
- view.backgroundColor = UIColor(white: 0.95, alpha: 1)
- setupUI()
- }
-
- private func setupUI() {
- view.addSubview(collectionView)
-
- collectionView.translatesAutoresizingMaskIntoConstraints = false
-
- NSLayoutConstraint.activate([
- collectionView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 10),
- collectionView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
- collectionView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
- collectionView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: 10)
- ])
- }
-
- // MARK: - UICollectionView DataSource & Delegate
-
- func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
- return collectionData.count
- }
-
- func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
- guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CustomHeaderViewCell.identifier, for: indexPath) as? CustomHeaderViewCell else {
- return UICollectionViewCell()
- }
-
- cell.configure(with: collectionData[indexPath.row])
- return cell
- }
-
- func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
- return CGSize(width: 150, height: 40)
- }
-}
+let messageList = CometChatMessageList()
-struct CollectionItem {
- let title: String
- let icon: UIImage?
-}
+let newMessageIndicatorView = NewUnreadMessageIndicator()
+messageList.set(newMessageIndicatorView: newMessageIndicatorView)
-class CustomHeaderViewCell: UICollectionViewCell {
-
- static let identifier = "CustomCollectionViewCell"
-
- private let iconImageView: UIImageView = {
- let imageView = UIImageView()
- imageView.contentMode = .scaleAspectFit
- imageView.translatesAutoresizingMaskIntoConstraints = false
- return imageView
- }()
+class NewUnreadMessageIndicator: UIView {
- private let titleLabel: UILabel = {
+ private let label: UILabel = {
let label = UILabel()
+ label.text = "New Messages ↓"
+ label.textColor = .white
label.font = UIFont.systemFont(ofSize: 14, weight: .medium)
- label.textColor = UIColor.purple
- label.translatesAutoresizingMaskIntoConstraints = false
+ label.textAlignment = .center
return label
}()
override init(frame: CGRect) {
super.init(frame: frame)
- setupUI()
- }
-
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
-
- private func setupUI() {
- backgroundColor = UIColor(white: 0.95, alpha: 1) // Light purple background
- layer.cornerRadius = 18
- clipsToBounds = true
-
- addSubview(iconImageView)
- addSubview(titleLabel)
+ backgroundColor = UIColor.systemBlue
+ layer.cornerRadius = 16
+ addSubview(label)
+ label.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
- iconImageView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 8),
- iconImageView.centerYAnchor.constraint(equalTo: centerYAnchor),
- iconImageView.widthAnchor.constraint(equalToConstant: 20),
- iconImageView.heightAnchor.constraint(equalToConstant: 20),
-
- titleLabel.leadingAnchor.constraint(equalTo: iconImageView.trailingAnchor, constant: 5),
- titleLabel.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -8),
- titleLabel.centerYAnchor.constraint(equalTo: centerYAnchor)
+ label.centerXAnchor.constraint(equalTo: centerXAnchor),
+ label.centerYAnchor.constraint(equalTo: centerYAnchor)
])
}
- func configure(with model: CollectionItem) {
- iconImageView.image = model.icon
- titleLabel.text = model.title
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
}
}
```
-***
-
-#### SetFooterView
+---
-You can set custom footerView to the Message List component using the following method.
+## Text Formatters
-Example
+Customize how text is displayed in messages using text formatters.
-
-
+```swift
+@discardableResult
+public func set(textFormatters: [CometChatTextFormatter]) -> Self
+```
-Following is the code of CustomFooterView UIView Class
+| Parameter | Type | Description |
+|-----------|------|-------------|
+| `textFormatters` | `[CometChatTextFormatter]` | Array of text formatters to apply |
```swift
-import UIKit
+import CometChatUIKitSwift
-class CustomFooterView: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
-
- private var collectionData: [CollectionItem] = [
- CollectionItem(title: "Ice Breakers", icon: UIImage(systemName: "sun.max.fill")),
- CollectionItem(title: "+1-212-456-7890", icon: UIImage(systemName: "phone.fill")),
- CollectionItem(title: "+ Instagram", icon: UIImage(systemName: "camera.fill"))
- ]
-
- private lazy var collectionView: UICollectionView = {
- let layout = UICollectionViewFlowLayout()
- layout.scrollDirection = .horizontal
- layout.minimumInteritemSpacing = 10
- layout.sectionInset = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10)
-
- let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
- collectionView.register(CustomFooterViewCell.self, forCellWithReuseIdentifier: CustomFooterViewCell.identifier)
- collectionView.backgroundColor = .clear
- collectionView.showsHorizontalScrollIndicator = false
- collectionView.delegate = self
- collectionView.dataSource = self
- collectionView.tag = 1
- return collectionView
- }()
-
-
- override func viewDidLoad() {
- super.viewDidLoad()
- view.backgroundColor = UIColor(white: 0.95, alpha: 1)
- setupUI()
- }
-
- private func setupUI() {
- view.addSubview(collectionView)
-
- collectionView.translatesAutoresizingMaskIntoConstraints = false
-
- NSLayoutConstraint.activate([
- collectionView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 10),
- collectionView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
- collectionView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
- collectionView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: 10)
- ])
- }
-
- // MARK: - UICollectionView DataSource & Delegate
+let messageList = CometChatMessageList()
+
+let hashtagFormatter = HashtagTextFormatter(trackingCharacter: "#")
+let mentionFormatter = MentionTextFormatter(trackingCharacter: "@")
+
+messageList.set(textFormatters: [hashtagFormatter, mentionFormatter])
+```
+
+### setMentionAllLabel(_:_:)
+
+Customizes the label displayed for @all mentions.
+
+```swift
+@discardableResult
+public func setMentionAllLabel(_ title: String, _ subtitle: String) -> Self
+```
+
+| Parameter | Type | Description |
+|-----------|------|-------------|
+| `title` | `String` | The title for the @all mention |
+| `subtitle` | `String` | The subtitle for the @all mention |
+
+```swift
+import CometChatUIKitSwift
+
+let messageList = CometChatMessageList()
+
+// Customize the @all mention label
+messageList.setMentionAllLabel("Everyone", "Notify all members")
+```
+
+You can create a custom text formatter:
+
+```swift
+import Foundation
+import CometChatSDK
+import CometChatUIKitSwift
+
+class MyCustomTextFormatter: CometChatTextFormatter {
- func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
- return collectionData.count
+ override func getRegex() -> String {
+ return "(\\bsure\\b)"
}
-
- func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
- guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CustomFooterViewCell.identifier, for: indexPath) as? CustomFooterViewCell else {
- return UICollectionViewCell()
- }
-
- cell.configure(with: collectionData[indexPath.row])
- return cell
+
+ override func getTrackingCharacter() -> Character {
+ return "#"
}
-
- func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
- return CGSize(width: 150, height: 40)
+
+ override func search(string: String, suggestedItems: ((_: [SuggestionItem]) -> ())? = nil) {
+ // This function would call an API or perform a local search
}
-}
-struct CollectionItem {
- let title: String
- let icon: UIImage?
-}
+ override func onScrollToBottom(suggestionItemList: [SuggestionItem], listItem: ((_: [SuggestionItem]) -> ())?) {
+ // This function would call the next page of an API
+ }
-class CustomFooterViewCell: UICollectionViewCell {
-
- static let identifier = "CustomCollectionViewCell"
-
- private let iconImageView: UIImageView = {
- let imageView = UIImageView()
- imageView.contentMode = .scaleAspectFit
- imageView.translatesAutoresizingMaskIntoConstraints = false
- return imageView
- }()
-
- private let titleLabel: UILabel = {
- let label = UILabel()
- label.font = UIFont.systemFont(ofSize: 14, weight: .medium)
- label.textColor = UIColor.purple
- label.translatesAutoresizingMaskIntoConstraints = false
- return label
- }()
-
- override init(frame: CGRect) {
- super.init(frame: frame)
- setupUI()
+ override func onItemClick(suggestedItem: SuggestionItem, user: User?, group: Group?) {
+ // Handle clicked item
}
-
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
+
+ override func handlePreMessageSend(baseMessage: BaseMessage, suggestionItemList: [SuggestionItem]) {
+ // Modify the message before it's sent
}
-
- private func setupUI() {
- backgroundColor = UIColor(white: 0.95, alpha: 1) // Light purple background
- layer.cornerRadius = 18
- clipsToBounds = true
-
- addSubview(iconImageView)
- addSubview(titleLabel)
-
- NSLayoutConstraint.activate([
- iconImageView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 8),
- iconImageView.centerYAnchor.constraint(equalTo: centerYAnchor),
- iconImageView.widthAnchor.constraint(equalToConstant: 20),
- iconImageView.heightAnchor.constraint(equalToConstant: 20),
-
- titleLabel.leadingAnchor.constraint(equalTo: iconImageView.trailingAnchor, constant: 5),
- titleLabel.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -8),
- titleLabel.centerYAnchor.constraint(equalTo: centerYAnchor)
- ])
+
+ override func prepareMessageString(
+ baseMessage: BaseMessage,
+ regexString: String,
+ alignment: MessageBubbleAlignment = .left,
+ formattingType: FormattingType
+ ) -> NSAttributedString {
+ let attrString = NSMutableAttributedString(string: "SURE")
+ if alignment == .left {
+ // Received message styling
+ attrString.addAttribute(.foregroundColor, value: UIColor.blue, range: NSRange(location: 0, length: attrString.length))
+ } else {
+ // Sent message styling
+ attrString.addAttribute(.foregroundColor, value: UIColor.green, range: NSRange(location: 0, length: attrString.length))
+ }
+ attrString.addAttribute(.font, value: UIFont.boldSystemFont(ofSize: 18), range: NSRange(location: 0, length: attrString.length))
+ return attrString
}
-
- func configure(with model: CollectionItem) {
- iconImageView.image = model.icon
- titleLabel.text = model.title
+
+ override func onTextTapped(baseMessage: BaseMessage, tappedText: String, controller: UIViewController?) {
+ // Handle text tap action
}
}
```
-***
+---
+
+## AI Features
+
+Configure AI-powered features for the message list.
-#### SetDateSeparatorPattern
+### enableSmartReplies
-You can modify the date pattern of the message list date separator to your requirement using `setDateSeparatorPattern()`. This method accepts a function with a return type String. Inside the function, you can create your own pattern and return it as a String.
+Enables AI-powered smart reply suggestions.
-**Example**
+| | |
+|---|---|
+| Type | `Bool` |
+| Default | `false` |
-
+
+
+### Key Style Properties
+
+| Property | Type | Default | Description |
+|----------|------|---------|-------------|
+| `backgroundColor` | `UIColor` | `CometChatTheme.backgroundColor01` | Background color of the list |
+| `borderWidth` | `CGFloat` | `0` | Border width for the component |
+| `borderColor` | `UIColor` | `.clear` | Border color for the component |
+| `cornerRadius` | `CometChatCornerStyle?` | `nil` | Corner radius for the component |
+| `shimmerGradientColor1` | `UIColor` | `CometChatTheme.backgroundColor04` | First shimmer gradient color |
+| `shimmerGradientColor2` | `UIColor` | `CometChatTheme.backgroundColor03` | Second shimmer gradient color |
+| `emptyStateTitleColor` | `UIColor` | `CometChatTheme.textColorPrimary` | Empty state title color |
+| `emptyStateTitleFont` | `UIFont` | `CometChatTypography.Heading3.bold` | Empty state title font |
+| `emptyStateSubtitleColor` | `UIColor` | `CometChatTheme.textColorSecondary` | Empty state subtitle color |
+| `emptyStateSubtitleFont` | `UIFont` | `CometChatTypography.Body.regular` | Empty state subtitle font |
+| `errorStateTitleColor` | `UIColor` | `CometChatTheme.textColorPrimary` | Error state title color |
+| `errorStateTitleFont` | `UIFont` | `CometChatTypography.Heading3.bold` | Error state title font |
+| `newMessageIndicatorTextColor` | `UIColor?` | `nil` | New message indicator text color |
+| `newMessageIndicatorBackgroundColor` | `UIColor?` | `nil` | New message indicator background |
-
@@ -24,216 +28,232 @@ The MessageBubble structure can typically be broken down into the following view
5. **Bottom view**: This view can be used to extend the MessageBubble with additional elements, such as link previews or a 'load more' button for long messages. It's typically placed beneath the Content view.
-6. **Thread view**:This is where the thread reply icon and reply counts are displayed. It's located below the footer view.
+6. **Thread view**: This is where the thread reply icon and reply counts are displayed. It's located below the footer view.
7. **Footer view**: This is where the timestamp of the message and its delivery or read status are displayed. It's located at the bottom of the MessageBubble.
8. **Status Info view**: This is where the timestamp of the message and its delivery or read status are displayed. It's located inside the MessageBubble just below the content view.
-### Properties
-
-MessageTemplate provides you with methods that allow you to alter various properties of the MessageBubble. These properties include aspects such as the `type` and `category` of a message, the appearance and behavior of the header, content, and footer sections of the message bubble,
-
-1. **Type**
+---
- Using `setType()` you can set the type of CometChatMessage, This will map your MessageTemplate to the corresponding CometChatMessage. You can set the MessageTemplates Type using the following code snippet.
+## Properties
- ```csharp
+MessageTemplate provides you with methods that allow you to alter various properties of the MessageBubble. These properties include aspects such as the `type` and `category` of a message, the appearance and behavior of the header, content, and footer sections of the message bubble.
- let type = "custom_template"//replace this with your own custom type
+### 1. Type
- //Creating a custom message template
- let customMessageTemplate =
- CometChatMessageTemplate(category: category, type: type, contentView: { message, alignment, controller in
- return UIView() //replace this with your own UI for message list
+Using `setType()` you can set the type of CometChatMessage. This will map your MessageTemplate to the corresponding CometChatMessage. You can set the MessageTemplate's Type using the following code snippet:
- }, bubbleView: nil, headerView: nil, footerView: nil) { message, alignment, controller in
- return UIView() //replace this with your own UI for message composer
- } options: { message, group, controller in
- return [CometChatMessageOption]() //replace this with your own options
- }
- ```
+```swift
+let type = "custom_template" // Replace with your own custom type
+
+// Creating a custom message template
+let customMessageTemplate = CometChatMessageTemplate(
+ category: category,
+ type: type,
+ contentView: { message, alignment, controller in
+ return UIView() // Replace with your own UI for message list
+ },
+ bubbleView: nil,
+ headerView: nil,
+ footerView: nil
+) { message, alignment, controller in
+ return UIView() // Replace with your own UI for message composer
+} options: { message, group, controller in
+ return [CometChatMessageOption]() // Replace with your own options
+}
+```
-2. **Category**
+### 2. Category
Using `.setCategory()` you can set the category of a MessageTemplate. This will create a MessageTemplate with the specified category and link it with a CometChatMessage of the same category.
Please refer to our guide on [Message Categories](/sdk/ios/message-structure-and-hierarchy) for a deeper understanding of message categories.
-```csharp
-let category = "custom_category"//replace this with your own category
-
-//Creating a custom message template
-//You can also set UI for bubbleView, headerView and footerView instead of nil
-let customMessageTemplate =
- CometChatMessageTemplate(category: category, type: type, contentView: { message, alignment, controller in
- return UIView() //replace this with your own UI for message list
-
- }, bubbleView: nil, headerView: nil, footerView: nil) { message, alignment, controller in
- return UIView() //replace this with your own UI for message composer
- } options: { message, group, controller in
- return [CometChatMessageOption]() //replace this with your own options
- }
+```swift
+let category = "custom_category" // Replace with your own category
+
+// Creating a custom message template
+// You can also set UI for bubbleView, headerView and footerView instead of nil
+let customMessageTemplate = CometChatMessageTemplate(
+ category: category,
+ type: type,
+ contentView: { message, alignment, controller in
+ return UIView() // Replace with your own UI for message list
+ },
+ bubbleView: nil,
+ headerView: nil,
+ footerView: nil
+) { message, alignment, controller in
+ return UIView() // Replace with your own UI for message composer
+} options: { message, group, controller in
+ return [CometChatMessageOption]() // Replace with your own options
+}
```
-3. **Header View**
-
- The .`template.headerView` method allows you to assign a custom header view to the MessageBubble. By default, it is configured to display the sender's name.
+### 3. Header View
- ```swift
- var allTemplates = CometChatUIKit.getDataSource().getAllMessageTemplates()
+The `template.headerView` method allows you to assign a custom header view to the MessageBubble. By default, it is configured to display the sender's name.
- for (index, template) in allTemplates.enumerated() {
- var template = template
- template.headerView = { (baseMessage: BaseMessage?, bubbleAlignment: MessageBubbleAlignment, viewController: UIViewController?) -> (UIView)? in
- return UIView()
+```swift
+var allTemplates = CometChatUIKit.getDataSource().getAllMessageTemplates()
- }
- }
- ```
+for (index, template) in allTemplates.enumerated() {
+ var template = template
+ template.headerView = { (baseMessage: BaseMessage?, bubbleAlignment: MessageBubbleAlignment, viewController: UIViewController?) -> (UIView)? in
+ return UIView()
+ }
+}
+```
-4. **Content View**
+### 4. Content View
- The `template.contentView` method allows you to assign a custom content view to the MessageBubble. By default, it displays the [Text Bubble](/ui-kit/ios/message-bubble-styling#text-bubble), [Image Bubble](/ui-kit/ios/message-bubble-styling-styling#image-bubble), [File Bubble](/ui-kit/ios/message-bubble-styling-styling), [Audio Bubble](/ui-kit/ios/message-bubble-styling-styling#audio-bubble), or [Video Bubble](/ui-kit/ios/message-bubble-styling#video-bubble), depending on the message type.
+The `template.contentView` method allows you to assign a custom content view to the MessageBubble. By default, it displays the [Text Bubble](/ui-kit/ios/message-bubble-styling#text-bubble), [Image Bubble](/ui-kit/ios/message-bubble-styling#image-bubble), [File Bubble](/ui-kit/ios/message-bubble-styling), [Audio Bubble](/ui-kit/ios/message-bubble-styling#audio-bubble), or [Video Bubble](/ui-kit/ios/message-bubble-styling#video-bubble), depending on the message type.
- ```swift
- var allTemplates = CometChatUIKit.getDataSource().getAllMessageTemplates()
+```swift
+var allTemplates = CometChatUIKit.getDataSource().getAllMessageTemplates()
- for (index, template) in allTemplates.enumerated() {
- var template = template
- template.contentView = { (baseMessage: BaseMessage?, bubbleAlignment: MessageBubbleAlignment, viewController: UIViewController?) -> (UIView)? in
- return UIView()
+for (index, template) in allTemplates.enumerated() {
+ var template = template
+ template.contentView = { (baseMessage: BaseMessage?, bubbleAlignment: MessageBubbleAlignment, viewController: UIViewController?) -> (UIView)? in
+ return UIView()
}
- }
- ```
+}
+```
-5. **Footer View**
+### 5. Footer View
- The `template.footerView` method allows you to assign a custom Footer view to the MessageBubble. By default, it displays the receipt and timestamp.
+The `template.footerView` method allows you to assign a custom Footer view to the MessageBubble. By default, it displays the receipt and timestamp.
- ```swift
- var allTemplates = CometChatUIKit.getDataSource().getAllMessageTemplates()
+```swift
+var allTemplates = CometChatUIKit.getDataSource().getAllMessageTemplates()
- for (index, template) in allTemplates.enumerated() {
- var template = template
- template.footerView = { (baseMessage: BaseMessage?, bubbleAlignment: MessageBubbleAlignment, viewController: UIViewController?) -> (UIView)? in
- return UIView()
+for (index, template) in allTemplates.enumerated() {
+ var template = template
+ template.footerView = { (baseMessage: BaseMessage?, bubbleAlignment: MessageBubbleAlignment, viewController: UIViewController?) -> (UIView)? in
+ return UIView()
}
- }
- ```
+}
+```
-6. **Bottom View**
+### 6. Bottom View
- The `template.bottomView` method allows you to assign a custom Bottom view to the MessageBubble.By defuault is has buttons such as link previews or a 'load more' button for long messages.
+The `template.bottomView` method allows you to assign a custom Bottom view to the MessageBubble. By default, it has buttons such as link previews or a 'load more' button for long messages.
- ```swift
- var allTemplates = CometChatUIKit.getDataSource().getAllMessageTemplates()
+```swift
+var allTemplates = CometChatUIKit.getDataSource().getAllMessageTemplates()
- for (index, template) in allTemplates.enumerated() {
- var template = template
- template.bottomView = { (baseMessage: BaseMessage?, bubbleAlignment: MessageBubbleAlignment, viewController: UIViewController?) -> (UIView)? in
- return UIView()
+for (index, template) in allTemplates.enumerated() {
+ var template = template
+ template.bottomView = { (baseMessage: BaseMessage?, bubbleAlignment: MessageBubbleAlignment, viewController: UIViewController?) -> (UIView)? in
+ return UIView()
}
- }
- ```
+}
+```
-7. **Bubble View**
+### 7. Bubble View
- The `template.bubbleView` method allows you to assign a custom Bubble view to the MessageBubble. By default, headerView, contentView, and footerView together form a message bubble.
+The `template.bubbleView` method allows you to assign a custom Bubble view to the MessageBubble. By default, headerView, contentView, and footerView together form a message bubble.
- ```swift
- var allTemplates = CometChatUIKit.getDataSource().getAllMessageTemplates()
+```swift
+var allTemplates = CometChatUIKit.getDataSource().getAllMessageTemplates()
- for (index, template) in allTemplates.enumerated() {
- var template = template
- template.bubbleView = { (baseMessage: BaseMessage?, bubbleAlignment: MessageBubbleAlignment, viewController: UIViewController?) -> (UIView)? in
- return UIView()
+for (index, template) in allTemplates.enumerated() {
+ var template = template
+ template.bubbleView = { (baseMessage: BaseMessage?, bubbleAlignment: MessageBubbleAlignment, viewController: UIViewController?) -> (UIView)? in
+ return UIView()
}
- }
- ```
+}
+```
-8. **Options**
+### 8. Options
- The `template.options` lets you set the list of actions that a user can perform on a message. This includes actions like reacting to, editing, or deleting a message.
+The `template.options` lets you set the list of actions that a user can perform on a message. This includes actions like reacting to, editing, or deleting a message.
- ```csharp
- var allTemplates = CometChatUIKit.getDataSource().getAllMessageTemplates()
- for (index, template) in allTemplates.enumerated() {
- var template = template
- template.options = { message, group, controller in
- let loggedInUser = CometChat.getLoggedInUser()
- let options = CometChatUIKit.getDataSource().getMessageOptions(loggedInUser: loggedInUser!, messageObject: message!, controller: controller, group: group)
+```swift
+var allTemplates = CometChatUIKit.getDataSource().getAllMessageTemplates()
- return options
+for (index, template) in allTemplates.enumerated() {
+ var template = template
+ template.options = { message, group, controller in
+ let loggedInUser = CometChat.getLoggedInUser()
+ let options = CometChatUIKit.getDataSource().getMessageOptions(
+ loggedInUser: loggedInUser!,
+ messageObject: message!,
+ controller: controller,
+ group: group
+ )
+ return options
}
- allTemplates[index] = template
- }
- ```
+ allTemplates[index] = template
+}
+```
-***
+---
## Customization
Let's dive into how you can use the [properties](#properties) of MessageTemplate to customize an existing template or add a new one to the [MessageList](/ui-kit/ios/message-list) component.
-The First step is to fetch the list of existing templates when you want to modify or add to them. This can be done using the getAllMessageTemplates() method from the DataSource of the CometChatUIKit class.
+The first step is to fetch the list of existing templates when you want to modify or add to them. This can be done using the `getAllMessageTemplates()` method from the DataSource of the CometChatUIKit class:
-```javascript
-var messageTemplates : [CometChatMessageTemplate] = CometChatUIKit.getDataSource().getAllMessageTemplates()
+```swift
+var messageTemplates: [CometChatMessageTemplate] = CometChatUIKit.getDataSource().getAllMessageTemplates()
```
+---
+
### Existing Templates
-You will need to first get the MessageTemplates object for the type of message you want to customize. You will be customizing the TextMessage Bubble here. The code snippet to get the Text MessageTemplate is as follows.
+You will need to first get the MessageTemplates object for the type of message you want to customize. In this example, we'll customize the TextMessage Bubble. The code snippet to get the Text MessageTemplate is as follows:
-```swift custom_header_view
+
+
-```swift custom_bottom_view_file
+
-```swift custom_footer_view
+
-```swift custom_bubble_view
+
-```swift Swiftphp
+
-```swift custom_status_view
+
-```swift Swift
+
-***
+
+
-***
+
+
-List of properties exposed by OutgoingCallStyle
+#### OutgoingCallStyle Properties
| Property | Description | Code |
| ------------------------------ | --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
@@ -230,15 +251,15 @@ List of properties exposed by OutgoingCallStyle
| `declineButtonBackgroundColor` | Sets the background color for the decline button in the outgoing call view. | `CometChatOutgoingCall.style.declineButtonBackgroundColor = UIColor()` |
| `declineButtonIconTint` | Sets the tint color for the decline button icon. | `CometChatOutgoingCall.style.declineButtonIconTint = UIColor()` |
| `declineButtonIcon` | Sets the icon for the decline button. | `CometChatOutgoingCall.style.declineButtonIcon = UIImage(systemName: "phone.down.fill")` |
-| `declineButtonCornerRadius` | Sets the corner radius for decline button. | `CometChatOutgoingCall.style.declineButtonCornerRadius: CometChatCornerStyle?` |
-| `declineButtonBorderColor` | Sets the border color for decline button. | `CometChatOutgoingCall.style.declineButtonBorderColor: UIColor?` |
-| `declineButtonBorderWidth` | Sets the border width for decline button. | `CometChatOutgoingCall.style.declineButtonBorderWidth: CGFloat?` |
+| `declineButtonCornerRadius` | Sets the corner radius for the decline button. | `CometChatOutgoingCall.style.declineButtonCornerRadius: CometChatCornerStyle?` |
+| `declineButtonBorderColor` | Sets the border color for the decline button. | `CometChatOutgoingCall.style.declineButtonBorderColor: UIColor?` |
+| `declineButtonBorderWidth` | Sets the border width for the decline button. | `CometChatOutgoingCall.style.declineButtonBorderWidth: CGFloat?` |
-***
+---
### Functionality
-These are a set of small functional customizations that allow you to fine-tune the overall experience of the component.
+These are small functional customizations that allow you to fine-tune the overall experience of the component.
| Property | Description | Code |
| ---------------------- | --------------------------------------- | ------------------------------- |
@@ -247,11 +268,11 @@ These are a set of small functional customizations that allow you to fine-tune t
### 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.
+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 own views, layouts, and UI elements and then incorporate those into the component.
-#### SetAvatarVieww
+#### SetAvatarView
-With this function, you can assign a custom view to the avatar of OutgoingCall Component.
+With this function, you can assign a custom view to the avatar of the OutgoingCall Component.
+
-You can create a CustomCancelView as a custom `UIView`.
+You can create a `CustomCancelView` as a custom `UIView`:
+
-You can create a `CustomTitleView` as a custom `UIView`. Which we will inflate in `setTitleView()`
+You can create a `CustomTitleView` as a custom `UIView`:
+
-You can create a CustomSubtitleView as a custom `UIView`.
+You can create a `CustomSubtitleView` as a custom `UIView`:
-
+---
-***
+## Try It
-## **Download the CometChat Demo App**
+
](https://link.cometchat.com/ios-demo-app)
+Before integrating the CometChat UI Kit, familiarize yourself with the key concepts and features offered by CometChat's platform:
-**Or Scan the QR Code**
+- Review the [Key Concepts](/fundamentals/key-concepts) to understand essential terminology and features
+- Follow the [Getting Started Guide](/ui-kit/ios/getting-started) for detailed steps on initial setup and integration
-
+
-
+
-***
+
+
+
-- code for custom view:
+Custom view implementation:
+
+
+---
diff --git a/ui-kit/ios/sound-manager.mdx b/ui-kit/ios/sound-manager.mdx
index a9fdcd3cc..ea6bc926a 100644
--- a/ui-kit/ios/sound-manager.mdx
+++ b/ui-kit/ios/sound-manager.mdx
@@ -1,42 +1,96 @@
---
title: "Sound Manager"
+sidebarTitle: "Sound Manager"
+description: "Manage and play audio for messages and calls in CometChat UI Kit for iOS"
---
## Overview
-The SoundManager is a helper class responsible for managing and playing various types of audio in the CometChat UI Kit. This includes sound events for incoming and outgoing messages and calls.
+`CometChatSoundManager` is a helper class that manages audio playback in the CometChat UI Kit. It handles sound events for incoming and outgoing messages and calls, supporting both default sounds and custom audio files.
+
+---
## Methods
### Play Sound
-The SoundManager plays pre-defined or custom sounds based on user interactions with the chat interface. If no custom sound file is provided, the default sound is played.
+The `play(sound:customSound:)` method triggers audio playback based on user interactions with the chat interface. If no custom sound file is provided, the default sound for that event type is played.
-Here are the available methods for triggering sound playback:
+```swift
+play(sound: Sound, customSound: URL?)
+```
-* `play(sound: Sound, customSound: URL?)`: This method plays different types of sounds for incoming and outgoing calls and messages.Moreover, it can play a customized sound for a specific URL when triggered.
+| Parameter | Type | Description |
+| ----------- | ------ | ------------------------------------------------------------------------------------------------ |
+| sound | Sound | The type of sound event (e.g., `.incomingMessage`, `.outgoingMessage`, `.incomingCall`, `.outgoingCall`) |
+| customSound | URL? | Optional URL to a custom sound file. If `nil`, the default sound is used. |
### Pause Sound
-The SoundManager can pause different types of sounds for incoming and outgoing calls and messages using the following method:
+The `pause()` method stops any sound currently being played by the SoundManager.
+
+```swift
+pause()
+```
-* `pause()`: This method pauses any sound currently being played.
+---
## Usage
-Here is how to use CometChatSoundManager:
+### Playing Default Sounds
+
+Play the default sound for an incoming message:
-```php
-// Play sound:
+
-## Customization
+---
-Customizing Colors
+## Customization
-Override specific color attributes globally in CometChatTheme. This is equivalent to overriding attributes in Android's themes.xml.
+### Customizing Colors
-Example: Setting Primary Color
+Override specific color attributes globally in `CometChatTheme`. This is equivalent to overriding attributes in Android's `themes.xml`.
+
+---
diff --git a/ui-kit/ios/threaded-messages-header.mdx b/ui-kit/ios/threaded-messages-header.mdx
index ac5a95af2..6f9b50893 100644
--- a/ui-kit/ios/threaded-messages-header.mdx
+++ b/ui-kit/ios/threaded-messages-header.mdx
@@ -1,27 +1,62 @@
---
title: "Threaded Messages Header"
+sidebarTitle: "Threaded Messages Header"
+description: "Display and customize the header for threaded message conversations in CometChat UI Kit for iOS"
---
-## Overview
-
-ThreadedMessages is a [Composite Component](/ui-kit/ios/components-overview#composite-components) that displays all replies made to a particular message in a conversation. By default, the parent message will be displayed at the top, the message composer will be at the bottom and between them a message list will contain all replies.
+The `CometChatThreadedMessageHeader` component displays the header for threaded message conversations showing parent message info. By default, the parent message appears at the top, the message composer is at the bottom, and a message list containing all replies is displayed between them.
+
+
-The Users component is composed of the following BaseComponents:
-
-| Components | Description |
-| -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
-| [ListBase](/ui-kit/ios/list-base) | a reusable container component having title, search box, customisable background and a List View |
-| [ListItem](/ui-kit/ios/list-item) | a component that renders data obtained from a User object on a Tile having a title, subtitle, leading and trailing view |
-
-***
+
+
-1. ##### set(onItemClick:)
+---
-`set(OnItemClick:)` is triggered when you click on a ListItem of the users component. This `set(OnItemClick:)` method proves beneficial when a user intends to customize the on-click behavior in CometChatUsers.
+## Minimal Render
-
+
-***
+---
-2. ##### set(OnItemLongClick:)
+## Filtering
-`set(OnItemLongClick:)` is triggered when you long press on a ListItem of the users component. This `set(OnItemLongClick:)` method proves beneficial when a user intends to additional functionality on long press on list item in CometChatUsers.
+Use `UsersRequest.UsersRequestBuilder` to filter which users appear in the list. The builder pattern allows chaining multiple filter conditions.
-
-
-
-List of properties exposed by MessageListStyle
-
-| **Property** | **Description** | **Code** |
-| ----------------------------------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
-| **List Item Selected Image** | Image shown when a list item is selected. | `CometChatUsers.style.listItemSelectedImage = UIImage()` |
-| **List Item Deselected Image** | Image shown when a list item is deselected. | `CometChatUsers.style.listItemDeSelectedImage = UIImage()` |
-| **Search Icon Tint Color** | Tint color for the search icon in the search bar. | `CometChatUsers.style.searchIconTintColor = UIColor()` |
-| **Search Bar Style** | Style of the search bar (e.g., default, prominent). | `CometChatUsers.style.searchBarStyle = .default` |
-| **Search Tint Color** | Tint color for the search bar elements. | `CometChatUsers.style.searchTintColor = UIColor?` |
-| **Search Bar Tint Color** | Background color for the search bar (excluding text input). | `CometChatUsers.style.searchBarTintColor = UIColor?` |
-| **Placeholder Text Color** | Color of the placeholder text in the search bar. | `CometChatUsers.style.searchBarPlaceholderTextColor = UIColor?` |
-| **Placeholder Text Font** | Font of the placeholder text in the search bar. | `CometChatUsers.style.searchBarPlaceholderTextFont = UIFont?` |
-| **Search Bar Text Color** | Color of the entered text in the search bar. | `CometChatUsers.style.searchBarTextColor = UIColor?` |
-| **Search Bar Text Font** | Font of the entered text in the search bar. | `CometChatUsers.style.searchBarTextFont = UIFont?` |
-| **Search Bar Background Color** | Background color of the search bar’s text input area. | `CometChatUsers.style.searchBarBackgroundColor = UIColor?` |
-| **Cancel Icon Tint Color** | Tint color for the cancel button in the search bar. | `CometChatUsers.style.searchBarCancelIconTintColor = UIColor?` |
-| **Cross Icon Tint Color** | Tint color for the clear (cross) button in the search bar. | `CometChatUsers.style.searchBarCrossIconTintColor = UIColor?` |
-| **Background Color** | Background color for the entire screen or view. | `.backgroundColor = CometChatTheme.backgroundColor01` |
-| **Border Width** | Border width for the search bar or container. | `CometChatUsers.style.borderWidth = 0` |
-| **Border Color** | Color of the border, default is clear. | `CometChatUsers.style.borderColor = .clear` |
-| **Corner Radius** | Corner radius for search bar or other elements. | `CometChatUsers.style.cornerRadius = CometChatCornerStyle.init(cornerRadius: 0)` |
-| **Title Text Color** | Text color for title elements within the list or navigation bar. | `CometChatUsers.style.titleColor = CometChatTheme.textColorPrimary` |
-| **Title Font** | Font for title text. | `CometChatUsers.style.titleFont = CometChatTypography.Heading4.medium` |
-| **Large Title Text Color** | Text color for large titles. | `CometChatUsers.style.largeTitleColor = CometChatTheme.textColorPrimary` |
-| **Large Title Font** | Font for large titles. | `CometChatUsers.style.largeTitleFont = UIFont?` |
-| **Navigation Bar Tint Color** | Tint color for the navigation bar background. | `CometChatUsers.style.navigationBarTintColor = CometChatTheme.backgroundColor01` |
-| **Navigation Bar Items Tint Color** | Tint color for navigation bar items (buttons, icons). | `CometChatUsers.style.navigationBarItemsTintColor = CometChatTheme.iconColorHighlight` |
-| **Error Title Font** | Font for the error title displayed in UI. | `CometChatUsers.style.errorTitleTextFont = CometChatTypography.Heading3.bold` |
-| **Error Title Text Color** | Text color for the error title. | `CometChatUsers.style.errorTitleTextColor = CometChatTheme.textColorPrimary` |
-| **Error Subtitle Font** | Font for the subtitle of error messages. | `CometChatUsers.style.errorSubTitleFont = CometChatTypography.Body.regular` |
-| **Error Subtitle Text Color** | Text color for the subtitle of error messages. | `CometChatUsers.style.errorSubTitleTextColor = CometChatTheme.textColorSecondary` |
-| **Retry Button Text Color** | Text color for the retry button in error states. | `CometChatUsers.style.retryButtonTextColor = CometChatTheme.buttonTextColor` |
-| **Retry Button Text Font** | Font for the retry button text. | `CometChatUsers.style.retryButtonTextFont = CometChatTypography.Button.medium` |
-| **Retry Button Background Color** | Background color for the retry button. | `CometChatUsers.style.retryButtonBackgroundColor = CometChatTheme.primaryColor` |
-| **Retry Button Border Color** | Border color for the retry button. | `CometChatUsers.style.retryButtonBorderColor = .clear` |
-| **Retry Button Border Width** | Border width for the retry button. | `CometChatUsers.style.retryButtonBorderWidth = 0` |
-| **Retry Button Corner Radius** | Corner radius for the retry button. | `CometChatUsers.style.retryButtonCornerRadius = CometChatCornerStyle?` |
-| **Empty State Title Font** | Font for the empty state title (when no users/items are present). | `CometChatUsers.style.emptyTitleTextFont = CometChatTypography.Heading3.bold` |
-| **Empty State Title Color** | Text color for the empty state title. | `CometChatUsers.style.emptyTitleTextColor = CometChatTheme.textColorPrimary` |
-| **Empty Subtitle Font** | Font for the subtitle in the empty state. | `CometChatUsers.style.emptySubTitleFont = CometChatTypography.Body.regular` |
-| **Empty Subtitle Text Color** | Text color for the subtitle in the empty state. | `CometChatUsers.style.emptySubTitleTextColor = CometChatTheme.textColorSecondary` |
-| **Table View Separator Color** | Color for the table view separator. | `CometChatUsers.style.tableViewSeparator = .clear` |
-| **List Item Title Text Color** | Text color for list item titles. | `CometChatUsers.style.listItemTitleTextColor = CometChatTheme.textColorPrimary` |
-| **List Item Title Font** | Font for list item titles. | `CometChatUsers.style.listItemTitleFont = CometChatTypography.Heading4.medium` |
-| **List Item Subtitle Text Color** | Text color for list item subtitles. | `CometChatUsers.style.listItemSubTitleTextColor = CometChatTheme.textColorSecondary` |
-| **List Item Subtitle Font** | Font for list item subtitles. | `CometChatUsers.style.listItemSubTitleFont = CometChatTypography.Body.regular` |
-| **List Item Background** | Background color for individual list items. | `CometChatUsers.style.listItemBackground = .clear` |
-| **List Item Border Width** | Border width for individual list items. | `CometChatUsers.style.listItemBorderWidth = 0` |
-| **List Item Border Color** | Border color for individual list items. | `CometChatUsers.style.listItemBorderColor = CometChatTheme.borderColorLight` |
-| **List Item Corner Radius** | Corner radius for list items. | `CometChatUsers.style.listItemCornerRadius = CometChatCornerStyle.init(cornerRadius: 0)` |
-| **Selection Image Tint Color** | Tint color for selection indicator in list items. | `CometChatUsers.style.listItemSelectionImageTint = CometChatTheme.iconColorHighlight` |
-| **Selected Background Color** | Background color for selected list items. | `CometChatUsers.style.listItemSelectedBackground = .clear` |
-| **Deselected Image Tint Color** | Tint color for the deselected state image. | `CometChatUsers.style.listItemDeSelectedImageTint = CometChatTheme.borderColorDefault` |
-| **Header Title Color** | Text color for section header titles in the list. | `CometChatUsers.style.headerTitleColor = CometChatTheme.textColorHighlight` |
-| **Header Title Font** | Font for section header titles. | `CometChatUsers.style.headerTitleFont = CometChatTypography.Heading4.medium` |
-
-***
-
-### 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
-
-| Method | Description | Code |
-| -------------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------- |
-| set(userRequestBuilder:) | Sets a custom request builder for fetching users. | `.set(userRequestBuilder: UsersRequest.UsersRequestBuilder())` |
-| set(searchRequestBuilder:) | Sets a custom request builder for searching users. | `.set(searchRequestBuilder: UsersRequest.UsersRequestBuilder())` |
-| set(searchKeyword:) | Sets a search keyword for filtering users. | `.set(searchKeyword: "John")` |
-| hideErrorView | Hides the error state view. | `hideErrorView = true` |
-| hideNavigationBar | Hides or shows the navigation bar. | `hideNavigationBar = true` |
-| hideSearch | Hides the search bar. | `hideSearch = true` |
-| hideBackButton | Hides the back button. | `hideBackButton = true` |
-| hideLoadingState | Hides the loading state indicator. | `hideLoadingState = true` |
-| hideUserStatus | Hides the online/offline status of users. | `hideUserStatus = true` |
-| hideSectionHeader | Hides the section header for table view indicating initials of users. | `hideSectionHeader = 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.
-
-***
-
-#### SetOptions
-
-You can define custom options for each user using .set(options:). This method allows you to return an array of CometChatUserOption based on the user object.
-
-
-
-
-You can indeed create a custom listitem UIView file named `Custom_User_ListItem_View` for more complex or unique list items.
+### leadingView
-Afterwards, seamlessly integrate this `Custom_User_ListItem_View` UIView file into the `.setListItemView` method within **CometChatUsers()**.
-
-You can create a `CustomListItemView` as a custom `UIView`. Which we will inflate in `setListItemView()`
-
-```swift swift
+Customize the leading view (avatar area) of a user cell.
+```swift
import UIKit
import CometChatUIKitSwift
+import CometChatSDK
-class CustomListItem: UIView {
- // Initialize UI components
- private var profileImageView: CometChatAvatar = {
- let imageView = CometChatAvatar(image: UIImage())
- imageView.translatesAutoresizingMaskIntoConstraints = false // Important for manual layout
- return imageView
- }()
-
- private var nameLabel: UILabel = {
- let label = UILabel()
- label.translatesAutoresizingMaskIntoConstraints = false // Important for manual layout
- return label
- }()
+let users = CometChatUsers()
- override init(frame: CGRect) {
- super.init(frame: frame)
- setupUI()
- }
-
- required init?(coder aDecoder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
-
- private func setupUI() {
- addSubview(profileImageView)
- addSubview(nameLabel)
-
- NSLayoutConstraint.activate([
- // Profile image constraints
- profileImageView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 8),
- profileImageView.centerYAnchor.constraint(equalTo: centerYAnchor),
- profileImageView.widthAnchor.constraint(equalToConstant: 40),
- profileImageView.heightAnchor.constraint(equalToConstant: 40),
-
- nameLabel.leadingAnchor.constraint(equalTo: profileImageView.trailingAnchor, constant: 8),
- nameLabel.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -8),
- nameLabel.centerYAnchor.constraint(equalTo: centerYAnchor)
- ])
- }
-
- func set(user: User) {
- var avatarURL: String?
- if let group = conversation.conversationWith as? Group {
- nameLabel.text = group.name
- avatarURL = group.icon
- }
-
- if let user = conversation.conversationWith as? User {
- nameLabel.text = user.name
- avatarURL = user.avatar
- }
-
-
-
-
- self.profileImageView.setAvatar(avatarUrl: avatarURL, with: nameLabel.text)
- }
-}
-```
-
-***
-
-#### SetLeadingView
-
-You can modify the leading view of a user cell using .set(leadingView:).
-
-
+
-You can create a `CustomLeadingView` as a custom `UIView`. Which we will inflate in `setLeadingView()`
+You can create a `CustomLeadingView` as a custom `UIView`:
-
+
-You can create a `CustomTitleView` as a custom `UIView`. Which we will inflate in `setTitleView()`
+You can create a `CustomTitleView` as a custom `UIView`:
-
+
-You can modify the trailing view of a user cell using .set(trailView:).
+You can create a `CustomSubtitleView` as a custom `UIView`:
-
+
-You can create a `CustomTrailView` as a custom `UIView`. Which we will inflate in `setTrailView()`
+You can create a `CustomTrailView` as a custom `UIView`:
-
+
-You can seamlessly integrate this `CustomSubtitleView` UIView file into the `.set(subtitleView:)` method within CometChatUsers.
-
-
+
+
+### Key Style Properties
+
+| Property | Type | Default | Description |
+|----------|------|---------|-------------|
+| `backgroundColor` | `UIColor` | `CometChatTheme.backgroundColor01` | Background color |
+| `titleColor` | `UIColor` | `CometChatTheme.textColorPrimary` | Navigation title color |
+| `titleFont` | `UIFont` | `CometChatTypography.Heading4.medium` | Navigation title font |
+| `listItemTitleTextColor` | `UIColor` | `CometChatTheme.textColorPrimary` | User name color |
+| `listItemTitleFont` | `UIFont` | `CometChatTypography.Heading4.medium` | User name font |
+| `listItemSubTitleTextColor` | `UIColor` | `CometChatTheme.textColorSecondary` | Status text color |
+| `listItemSubTitleFont` | `UIFont` | `CometChatTypography.Body.regular` | Status text font |
+| `listItemBackground` | `UIColor` | `.clear` | List item background |
+| `searchBarBackgroundColor` | `UIColor?` | `nil` | Search bar background |
+| `searchBarTextColor` | `UIColor?` | `nil` | Search bar text color |
+| `headerTitleColor` | `UIColor` | `CometChatTheme.textColorHighlight` | Section header color |
+| `headerTitleFont` | `UIFont` | `CometChatTypography.Heading4.medium` | Section header font |
+
+### Customization Matrix
+
+| What to change | Where | Property/API | Example |
+|----------------|-------|--------------|---------|
+| Background color | Style | `backgroundColor` | `UIColor.systemBackground` |
+| Title appearance | Style | `titleColor`, `titleFont` | Custom colors and fonts |
+| List item look | Style | `listItemBackground` | `UIColor.white` |
+| Avatar appearance | Style | `avatarStyle` | `AvatarStyle()` with custom radius |
+| Search bar | Style | `searchBarBackgroundColor` | Custom background |
+| Hide search | Property | `hideSearch` | `users.hideSearch = true` |
+| Hide status | Property | `hideUserStatus` | `users.hideUserStatus = true` |
+| Custom row | View Slot | `set(listItemView:)` | See Custom View Slots |
+
+---
+
+## Props
+
+All props are optional. Sorted alphabetically.
+
+### avatarStyle
+
+Customizes the appearance of avatars in user list items.
+
+| | |
+|---|---|
+| Type | `AvatarStyle` |
+| Default | `AvatarStyle()` |
+
+```swift
+import CometChatUIKitSwift
+
+let users = CometChatUsers()
+
+let avatarStyle = AvatarStyle()
+avatarStyle.backgroundColor = UIColor.systemBlue
+avatarStyle.cornerRadius = CometChatCornerStyle(cornerRadius: 8)
+avatarStyle.borderWidth = 1
+avatarStyle.borderColor = UIColor.systemGray4
+
+users.set(avatarStyle: avatarStyle)
+```
+
+### hideBackButton
+
+Hides the back button in the navigation bar.
+
+| | |
+|---|---|
+| Type | `Bool` |
+| Default | `false` |
+
+### hideErrorView
+
+Hides the error state view.
+
+| | |
+|---|---|
+| Type | `Bool` |
+| Default | `false` |
+
+### hideLoadingState
+
+Hides the loading state indicator.
-
-
+`CometChatAIAssistantChat` is a standalone AI chat panel. It composes an internal message header, message list, and message composer into a self-contained AI conversation experience. It requires a `CometChat.User` representing the AI agent.
-
+
-
+
+
+```tsx lines
+import { useState, useEffect } from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
-export function AIAssistantChatDemo() {
- const [agent, setAgent] = React.useState
+
-
+
-
+ return
+
+
+```css lines
.cometchat-ai-assistant-chat
.cometchat-ai-assistant-chat__suggested-message-pill {
- background: #30a46c;
- color: #ffffff;
- text-align: center;
- font-family: "Times New Roman";
- font-size: 9px;
- font-style: normal;
- font-weight: 400;
- line-height: 120%;
+ background: #30a46c;
+ color: #ffffff;
+ font-size: 9px;
}
.cometchat-ai-assistant-chat
.cometchat-ai-assistant-chat__suggested-message-pill
.cometchat-ai-assistant-chat__suggested-message-icon {
- background: #ffffff;
- width: 9.55px;
- height: 9.55px;
+ background: #ffffff;
+ width: 9.55px;
+ height: 9.55px;
}
+
.cometchat-ai-assistant-chat
.cometchat-ai-assistant-chat__header-auxiliary-view
.cometchat-button
.cometchat-button__icon-default {
- background: #30a46c;
+ background: #30a46c;
}
```
-
-
+| Key | Value |
+| --- | --- |
+| Type | `React.JSX.Element` |
+| Default | `undefined` |
-
-
+### headerSubtitleView
-
-
+---
-
-
+
-## Smart Replies
-
-Smart Replies are AI-generated responses to messages. They can predict what a user might want to say next by analyzing the context of the conversation. This allows for quicker and more convenient responses, especially on mobile devices.
+### Smart Replies
-For a comprehensive understanding and guide on implementing and using the Smart Replies, refer to our specific guide on the [Smart Replies](/fundamentals/ai-user-copilot/smart-replies).
+AI-generated response suggestions based on conversation context. See [Smart Replies](/fundamentals/ai-user-copilot/smart-replies).
-Once you have successfully activated the [Smart Replies](/fundamentals/ai-user-copilot/smart-replies) from your CometChat Dashboard, the feature will automatically be incorporated into the Action sheet of [MessageComposer](/ui-kit/react/message-composer) Component of UI Kits.
+Auto-integrates into the Action Sheet of [MessageComposer](/ui-kit/react/message-composer) when activated.
-## Conversation Summary
+### Conversation Summary
-The Conversation Summary feature provides concise summaries of long conversations, allowing users to catch up quickly on missed chats. This feature uses natural language processing to determine the main points in a conversation.
+AI-generated recap of long conversations. See [Conversation Summary](/fundamentals/ai-user-copilot/conversation-summary).
-For a comprehensive understanding and guide on implementing and using the Conversation Summary, refer to our specific guide on the [Conversation Summary](/fundamentals/ai-user-copilot/conversation-summary).
-
-Once you have successfully activated the [Conversation Summary](/fundamentals/ai-user-copilot/conversation-summary) from your CometChat Dashboard, the feature will automatically be incorporated into the Action sheet of [MessageComposer](/ui-kit/react/message-composer) Component of UI Kits.
+Auto-integrates into the Action Sheet of [MessageComposer](/ui-kit/react/message-composer) when activated.
+
+## Next Steps
+
+
+
-This layout includes:
-
-1. Sidebar (Conversation List) – Users and groups
-2. Message View – Real-time messages for the selected conversation
-3. Message Composer – Input for sending text and media
-
-***
-
-## Prerequisites
-
-- Astro project set up
-- React integration added to Astro
-- CometChat credentials
-
-
-
-
+This guide walks you through adding CometChat to an Astro app using React islands. By the end you'll have a working chat UI.
-***
+
+
-**Recommended for:**
-
-* Desktop-first applications
-* Apps requiring a **rich user experience** with seamless navigation
-* Platforms supporting both **individual and group messaging**
-* **Mobile-friendly** apps needing a **tap-to-open message view**
+
+
-**Recommended for:**
-
-* **Support chat applications** – Direct user-agent communication.
-* **Apps focusing on direct messaging** – No distractions from other conversations.
-* **Community or group chat applications** – A structured way to interact in groups.
-* **Mobile-first applications** – Designed for compact and dedicated messaging experiences.
+
+
-**Recommended for:**
-
-* **Apps requiring structured navigation** – Clearly separate chat, calls, and settings.
-* **Multi-feature chat apps** – Supporting different functionalities in an organized way.
-* **Mobile-first applications** – Ideal for apps needing tab-based UI for easy access to features.
-* **Support & enterprise chat solutions** – Perfect for help desks, business chat platforms, and customer support apps.
+
+
-**Key Components**
-
-1. Chat Header – recipient details and status
-2. Message View – history and live messages
-3. Message Composer – text, media, attachments
-
-***
-
-## Prerequisites
-
-- Astro project with React integration
-- CometChat credentials in `.env`
-
-
+
-Layout structure:
-
-1. Sidebar – conversations, users, groups, or call logs
-2. Messages – header, list, and composer
-3. Tabs – switch between Chats, Calls, Users, and Groups
-
-***
-
-## Prerequisites
-
-- Astro project with React integration
-- CometChat credentials in `.env`
-
-
-
-
-## Usage
+## Where It Fits
-### Integration
+`CometChatCallButtons` renders voice and video call buttons. Pass a `user` for 1-on-1 calls or a `group` for group calls. Typically embedded in `CometChatMessageHeader`'s auxiliary view or used standalone. The component handles call initiation, renders `CometChatOutgoingCall` internally, and manages the full call lifecycle.
-
+
-
-
+function VoiceOnlyCallButtons() {
+ return
+
-
@@ -28,9 +42,7 @@ After adding this dependency, the React UI Kit will automatically detect it and
### Incoming Call
-The [Incoming Call](/ui-kit/react/incoming-call) component of the CometChat UI Kit provides the functionality that lets users receive real-time audio and video calls in the app.
-
-When a call is made to a user, the Incoming Call component triggers and displays a call screen. This call screen typically displays the caller information and provides the user with options to either accept or reject the incoming call.
+The [Incoming Call](/ui-kit/react/incoming-call) component displays a call screen when a call is received, showing caller info with accept/reject options.
@@ -38,9 +50,7 @@ When a call is made to a user, the Incoming Call component triggers and displays
### Outgoing Call
-The [Outgoing Call](/ui-kit/react/outgoing-call) component of the CometChat UI Kit is designed to manage the outgoing call process within your application. When a user initiates an audio or video call to another user or group, this component displays an outgoing call screen, showcasing information about the recipient and the call status.
-
-Importantly, the Outgoing Call component is smartly designed to transition automatically into the ongoing call screen once the receiver accepts the call. This ensures a smooth flow from initiating the call to engaging in a conversation, without any additional steps required from the user.
+The [Outgoing Call](/ui-kit/react/outgoing-call) component displays an outgoing call screen with recipient info and call status. Transitions to the ongoing call screen when the receiver accepts.
@@ -48,8 +58,25 @@ Importantly, the Outgoing Call component is smartly designed to transition autom
### Call Logs
-[Call Logs](/ui-kit/react/call-logs) component provides you with the records call events such as who called who, the time of the call, and the duration of the call. This information can be fetched from the CometChat server and displayed in a structured format for users to view their past call activities.
+The [Call Logs](/ui-kit/react/call-logs) component displays call history — caller, time, and duration.
+
+## Next Steps
+
+
-
-
-The `Call Logs` is comprised of the following components:
-
-| Components | Description |
-| ----------------- | --------------------------------------------------------------------------------------------------------------------------- |
-| CometChatList | A reusable container component having title, search box, customizable background and a list view. |
-| CometChatListItem | A component that renders data obtained from a Group object on a Tile having a title, subtitle, leading and trailing view. |
-| CometChatDate | This component used to show the date and time. You can also customize the appearance of this widget by modifying its logic. |
-
-## Usage
+## Where It Fits
-### Integration
+`CometChatCallLogs` is a standalone list component that renders call history entries. Each entry shows the caller/callee, call type (audio/video), direction (incoming/outgoing/missed), and timestamp. The `onItemClick` callback emits the selected call log, and `onCallButtonClicked` fires when the call-back button is tapped.
-
+
-export default CallLogDemo;
-```
+---
-
-
+Replace the entire call log list item.
-
-
-The customized chat interface is displayed below.
-
-
-
-
-
-Use the following code to achieve the customization shown above.
+Replace the right section (call-back button area).
-
-
-The customized chat interface is displayed below.
-
-
-
-
+### callInitiatedDateTimeFormat
-Use the following code to achieve the customization shown above.
+Customize the call initiated timestamp format using a `CalendarObject`.
-No call history
+
-
+### callInitiatedDateTimeFormat
-The customized chat interface is displayed below.
+Format for displaying the call initiated timestamp.
-
-
-
+| | |
+| --- | --- |
+| Type | `CalendarObject` |
+| Default | Component default (`DD MMM, hh:mm A`) |
-Use the following code to achieve the customization shown above.
+Falls back to [global calendar configuration](/ui-kit/react/localize#customisation) if not set.
-
-
+---
-The customized chat interface is displayed below.
+### leadingView
-
-
-
+Custom renderer for the avatar / left section.
-Use the following code to achieve the customization shown above.
+| | |
+| --- | --- |
+| Type | `(call: any) => JSX.Element` |
+| Default | Built-in avatar |
-
-
+| | |
+| --- | --- |
+| Type | `boolean` |
+| Default | `false` |
-The customized chat interface is displayed below.
+---
-
-
-
+### subtitleView
-Use the following code to achieve the customization shown above.
+Custom renderer for the subtitle text.
-
-
-
-## Usage
+## Where It Fits
-### Integration
+`CometChatConversations` is a sidebar list component. It renders recent conversations and emits the selected `CometChat.Conversation` via `onItemClick`. Wire it to `CometChatMessageHeader`, `CometChatMessageList`, and `CometChatMessageComposer` to build a standard two-panel chat layout.
-
+
+
+---
+
+## Minimal Render
-
+
-### Actions
+Root CSS class: `.cometchat-conversations`
-[Actions](/ui-kit/react/components-overview#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
+## Filtering Conversations
-`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.
+Pass a `CometChat.ConversationsRequestBuilder` to `conversationsRequestBuilder`. Pass the builder instance — not the result of `.build()`.
-
-
+```tsx lines
+import { CometChatConversations } from "@cometchat/chat-uikit-react";
-
-The customized chat interface is displayed below.
+Customized:
-Use the following code to achieve the customization shown above.
-
-Use the following code to achieve the customization shown above.
-
-
-Use the following code to achieve the customization shown above.
-
+
+
-export default class DialogHelper {
- private dialogContainer: HTMLDivElement | null = null;
+Customized:
- createDialog(onClick: () => void, buttonText: string) {
- this.dialogContainer = document.createElement("div");
- document.body.appendChild(this.dialogContainer);
+
+
+
- ReactDOM.render(
- ,
- this.dialogContainer
- );
- }
+
-Use the following code to achieve the customization shown above.
-
+
-```ruby
-new CalendarObject({
- today: `hh:mm A`, // Example: "10:30 AM"
- yesterday: `[yesterday]`, // Example: "yesterday"
- otherDays: `DD/MM/YYYY`, // Example: "25/05/2025"
-});
-```
+Customized:
-The following example demonstrates how to modify the **Last Message** timestamp format using a custom [`CalendarObject`](/ui-kit/react/localize#calendarobject).
+
+
+
-
+Customize the last message timestamp format using a `CalendarObject`.
-Use the following code to achieve the customization shown above.
+```ts lines
+// CalendarObject interface (from source)
+class CalendarObject {
+ today?: string;
+ yesterday?: string;
+ lastWeek?: string;
+ otherDays?: string;
+ relativeTime?: {
+ minute?: string;
+ minutes?: string;
+ hour?: string;
+ hours?: string;
+ };
+}
+```
-No conversations yet
+ +
-
+Overrides survive component updates because the component never sets inline styles on these elements — all styling flows through CSS classes and custom properties.
+
+### Key Selectors
-The customized chat interface is displayed below.
+| Target | Selector |
+| --- | --- |
+| Root | `.cometchat-conversations` |
+| Header title | `.cometchat-conversations .cometchat-list__header-title` |
+| List item | `.cometchat-conversations .cometchat-list-item` |
+| Body title | `.cometchat-conversations .cometchat-list-item__body-title` |
+| Avatar | `.cometchat-conversations .cometchat-avatar` |
+| Avatar text | `.cometchat-conversations .cometchat-avatar__text` |
+| Unread badge | `.cometchat-conversations .cometchat-badge` |
+| Subtitle text | `.cometchat-conversations .cometchat-conversations__subtitle-text` |
+| Status indicator | `.cometchat-conversations .cometchat-status-indicator` |
+| Read receipts | `.cometchat-conversations .cometchat-receipts-read` |
+| Active item | `.cometchat-conversations__list-item-active .cometchat-list-item` |
+| Typing indicator | `.cometchat-conversations__subtitle-typing` |
+| Trailing view | `.cometchat-conversations__trailing-view` |
+
+### Example: Brand-themed conversations
-
+
-Use the following code to achieve the customization shown above.
+```css lines
+.cometchat-conversations .cometchat-list-item__body-title,
+.cometchat-conversations .cometchat-list__header-title,
+.cometchat-conversations .cometchat-avatar__text,
+.cometchat-conversations .cometchat-badge,
+.cometchat-conversations .cometchat-conversations__subtitle-text {
+ font-family: "SF Pro";
+}
-
-
+### loadingView
-The customized chat interface is displayed below.
+Custom component displayed during the loading state.
-
-
-
+| | |
+| --- | --- |
+| Type | `JSX.Element` |
+| Default | Built-in shimmer |
-Use the following code to achieve the customization shown above.
+---
-
@@ -86,7 +96,7 @@ CometChat's User Presence feature allows users to see whether their contacts are
| --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Conversations](/ui-kit/react/conversations) | [Conversations](/ui-kit/react/conversations) is a component that renders conversation list item. Conversations item also shows user presence information. |
| [Message Header](/ui-kit/react/message-header) | [Message Header](/ui-kit/react/message-header) that renders details of user/group. The Message Header also handles user presence information. |
-| [Users](/ui-kit/react/users) | [Users](/ui-kit/react/users) renders list of users available in your app.It also responsible to render users presence information. |
+| [Users](/ui-kit/react/users) | [Users](/ui-kit/react/users) renders the list of available users with presence information. |
| [Group Members](/ui-kit/react/group-members) | [Group Members](/ui-kit/react/group-members) renders list of users available in the group. The Group Members component also handles user presence information. |
## Reactions
@@ -115,45 +125,40 @@ Mentions is a robust feature provided by CometChat that enhances the interactivi
| [Message Composer](/ui-kit/react/message-composer) | [Message Composer](/ui-kit/react/message-composer) is a component that allows users to craft and send various types of messages, including the usage of the mentions feature for direct addressing within the conversation. |
| [Message List](/ui-kit/react/message-list) | [Message List](/ui-kit/react/message-list) is a component that displays a list of sent and received messages. It also supports the rendering of Mentions, enhancing the readability and interactivity of conversations. |
-## Quoted Reply
+## Threaded Conversations
-Quoted Reply is a robust feature provided by CometChat that enables users to quickly reply to specific messages by selecting the "Reply" option from a message's action menu. This enhances context, keeps conversations organized, and improves overall chat experience in both 1-1 and group chats.
+The Threaded Conversations feature enables users to respond directly to a specific message in a chat. This keeps conversations organized and enhances the user experience by maintaining context, especially in group chats.
-
+
-| Components | Functionality |
-| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Message List](/ui-kit/react/message-list) | [Message List](/ui-kit/react/message-list) supports replying to messages via the "Reply" option. Users can select "Reply" on a message to open the composer with the quoted reply pre-filled, maintaining context. |
-| [Message Composer](/ui-kit/react/message-composer) | [Message Composer](/ui-kit/react/message-composer) works seamlessly with Quoted Message by showing the quoted reply above the input field, letting users compose their response in proper context. |
+| Components | Functionality |
+| ----------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
+| [Threaded Message Preview](/ui-kit/react/threaded-message-preview) | [Threaded Message Preview](/ui-kit/react/threaded-message-preview) component displays the parent message along with the number of replies. |
-## Conversation and Advanced Search
+## Quoted Replies
-Conversation and Advanced Search is a powerful feature provided by CometChat that enables users to quickly find conversations, messages, and media across chats in real time. It supports filters, scopes, and custom actions, allowing users to locate content efficiently while keeping the chat experience smooth and intuitive.
+Quoted Replies is a robust feature provided by CometChat that enables users to quickly reply to specific messages by selecting the "Reply" option from a message's action menu. This enhances context, keeps conversations organized, and improves overall chat experience in both 1-1 and group chats.
-
+
| Components | Functionality |
| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Search](/ui-kit/react/search) | [Search](/ui-kit/react/search) allows users to search across conversations and messages in real time. Users can click on a result to open the conversation or jump directly to a specific message. |
-| [Message Header](/ui-kit/react/message-header) | [Message Header](/ui-kit/react/message-header) shows the search button in the chat header, allowing users to search within a conversation. |
-| [Message List](/ui-kit/react/message-list) | [Message List](/ui-kit/react/message-list) shows the selected message when clicked from search results and highlights it in the message list. |
-| [Conversations](/ui-kit/react/conversations) | [Conversations](/ui-kit/react/conversations) displays the search input. |
+| [Message List](/ui-kit/react/message-list) | [Message List](/ui-kit/react/message-list) supports replying to messages via the "Reply" option. Users can select "Reply" on a message to open the composer with the quoted reply pre-filled, maintaining context. |
+| [Message Composer](/ui-kit/react/message-composer) | [Message Composer](/ui-kit/react/message-composer) shows the quoted reply above the input field, providing context for the response. |
-## Threaded Conversations
+## Group Chat
-The Threaded Conversations feature enables users to respond directly to a specific message in a chat. This keeps conversations organized and enhances the user experience by maintaining context, especially in group chats.
+CometChat facilitates Group Chats, allowing users to have conversations with multiple participants simultaneously. This feature is crucial for team collaborations, group discussions, social communities, and more.
-
+
-| Components | Functionality |
-| ----------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Threaded Message Preview](/ui-kit/react/threaded-message-preview) | [Threaded Message Preview](/ui-kit/react/threaded-message-preview) component displays the parent message along with the number of replies. |
+See the [Groups](/ui-kit/react/groups) component page for details.
## Moderation
@@ -169,9 +174,9 @@ Learn more about setting up moderation rules and managing content in the [Modera
| Components | Functionality |
| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Message List](/ui-kit/react/message-list) | [Message List](/ui-kit/react/message-list) automatically handles moderated messages, displaying blocked content appropriately based on your moderation settings. |
+| [Message List](/ui-kit/react/message-list) | [Message List](/ui-kit/react/message-list) automatically handles moderated messages, displaying blocked content based on moderation settings. |
-After implementing moderation rules, users can report messages they find inappropriate or harmful. As a next step, you can enable the **[Report Message](#report-message)** feature to allow users to flag messages for review by moderators.
+The **[Report Message](#report-message)** feature enables users to flag messages for review by moderators.
## Report Message
@@ -189,12 +194,37 @@ Learn more about how flagged messages are handled, reviewed, and moderated in th
| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Message List](/ui-kit/react/message-list) | [Message List](/ui-kit/react/message-list) provides the "Report Message" option in the message actions menu, allowing users to initiate the reporting process for inappropriate messages. |
-## Group Chat
+## Conversation and Advanced Search
-CometChat facilitates Group Chats, allowing users to have conversations with multiple participants simultaneously. This feature is crucial for team collaborations, group discussions, social communities, and more.
+Conversation and Advanced Search is a powerful feature provided by CometChat that enables users to quickly find conversations, messages, and media across chats in real time. It supports filters, scopes, and custom actions, allowing users to locate content efficiently while keeping the chat experience smooth and intuitive.
-
+
-For a comprehensive understanding and guide on implementing and using the Groups feature in CometChat, you should refer to our detailed guide on [Groups](/ui-kit/react/groups).
+| Components | Functionality |
+| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [Search](/ui-kit/react/search) | [Search](/ui-kit/react/search) allows users to search across conversations and messages in real time. Users can click on a result to open the conversation or jump directly to a specific message. |
+| [Message Header](/ui-kit/react/message-header) | [Message Header](/ui-kit/react/message-header) shows the search button in the chat header, allowing users to search within a conversation. |
+| [Message List](/ui-kit/react/message-list) | [Message List](/ui-kit/react/message-list) shows the selected message when clicked from search results and highlights it in the message list. |
+| [Conversations](/ui-kit/react/conversations) | [Conversations](/ui-kit/react/conversations) displays the search input. |
+
+See the [Groups](/ui-kit/react/groups) component page for details.
+---
+
+## Next Steps
+
+
@@ -73,75 +88,49 @@ Below is an example demonstrating how to use a custom formatter class in compone
+
-### Polls
+#### Message Shortcuts
+
+Sends predefined messages using short codes (e.g., `!hb` expands to `Happy birthday!`). See [Message Shortcuts Extension](/fundamentals/message-shortcuts).
+
+#### Pin Message
+
+Pins important messages in a conversation for easy access. See [Pin Message Extension](/fundamentals/pin-message).
+
+#### Rich Media Preview
+
+Generates rich preview panels for URLs using iFramely. See [Rich Media Preview Extension](/fundamentals/rich-media-preview).
+
+#### Save Message
+
+Bookmarks messages for later reference. Saved messages are private to the user. See [Save Message Extension](/fundamentals/save-message).
-The Polls extension enhances group discussions by allowing users to create polls. Users can ask questions with a predefined list of answers, enabling a quick, organized way to gather group opinions. For a comprehensive understanding and guide on implementing and using the Polls Extension, refer to our specific guide on the [Polls Extension](/fundamentals/polls).
+#### Thumbnail Generation
-Once you have successfully activated the [Polls Extension](/fundamentals/polls) from your CometChat Dashboard, the feature will automatically be incorporated into the Action Sheet of the [Message Composer](/ui-kit/react/message-composer) component of UI Kits.
+Creates smaller preview images for shared images, reducing bandwidth. See [Thumbnail Generation Extension](/fundamentals/thumbnail-generation).
+
+Auto-integrates into the Message Bubble of [MessageList](/ui-kit/react/message-list) when activated.
-
+
+
-### Collaborative Document
+#### Polls
-With the Collaborative Document extension, users can work together on a shared document. This feature is essential for remote teams where document collaboration is a recurring requirement. For a comprehensive understanding and guide on implementing and using the Collaborative Document Extension, refer to our specific guide on the [Collaborative Document Extension](/fundamentals/collaborative-document).
+Creates polls in group discussions with predefined answer options. See [Polls Extension](/fundamentals/polls).
-Once you have successfully activated the [Collaborative Document Extension](/fundamentals/collaborative-document) from your CometChat Dashboard, the feature will automatically be incorporated into the Action Sheet of the [Message Composer](/ui-kit/react/message-composer) component of UI Kits.
+Auto-integrates into the Action Sheet of [Message Composer](/ui-kit/react/message-composer) when activated.
-
+
-### Message Translation
+#### Reminders
+
+Sets reminders for messages or creates personal reminders. A bot sends a notification when due. See [Reminders Extension](/fundamentals/reminders).
-The Message Translation extension in CometChat is designed to translate any message into your local locale. It eliminates language barriers, making the chat more inclusive. For a comprehensive understanding and guide on implementing and using the Message Translation Extension, refer to our specific guide on the [Message Translation Extension](/fundamentals/message-translation).
+#### Stickers
-Once you have successfully activated the [Message Translation Extension](/fundamentals/message-translation) from your CometChat Dashboard, the feature will automatically be incorporated into the Action Sheet of [MessageList Component](/ui-kit/react/message-list) component of UI Kits.
+Sends pre-designed stickers in chat. See [Sticker Extension](/fundamentals/stickers).
+
+Auto-integrates into [Message Composer](/ui-kit/react/message-composer) when activated.
-
+
-### Link Preview
+#### Stipop
+
+Integrates Stipop's sticker library. See [Stipop Extension](/fundamentals/stickers-stipop).
+
+#### Tenor
+
+Search and share GIFs from Tenor. See [Tenor Extension](/fundamentals/tenor).
+
+### Collaboration
+
+#### Collaborative Document
-The Link Preview extension provides a summary of the URL shared in the chat. It includes the title, a description, and a thumbnail image from the web page. For a comprehensive understanding and guide on implementing and using the Link Preview Extension, refer to our specific guide on the [Link Preview Extension](/fundamentals/link-preview).
+Shared document editing for real-time collaboration. See [Collaborative Document Extension](/fundamentals/collaborative-document).
-Once you have successfully activated the [Link Preview Extension](/fundamentals/link-preview) from your CometChat Dashboard, the feature will automatically be incorporated into the Message Bubble of [MessageList Component](/ui-kit/react/message-list) component of UI Kits.
+Auto-integrates into the Action Sheet of [Message Composer](/ui-kit/react/message-composer) when activated.
-
+
-### Thumbnail Generation
+#### Collaborative Whiteboard
-The Thumbnail Generation extension automatically creates a smaller preview image whenever a larger image is shared, helping to reduce the upload/download time and bandwidth usage. For a comprehensive understanding and guide on implementing and using the Thumbnail Generation Extension, refer to our specific guide on the [Thumbnail Generation Extension](/fundamentals/thumbnail-generation).
+Real-time shared whiteboard for drawing and brainstorming. See [Collaborative Whiteboard Extension](/fundamentals/collaborative-whiteboard).
-Once you have successfully activated the [Thumbnail Generation Extension](/fundamentals/thumbnail-generation) from your CometChat Dashboard, the feature will automatically be incorporated into the Message Bubble of [MessageList Component](/ui-kit/react/message-list) component of UI Kits.
+Auto-integrates into the Action Sheet of [Message Composer](/ui-kit/react/message-composer) when activated.
-
+
+### Security
+
+#### Disappearing Messages
+
+Messages auto-delete after a specified interval. Works for 1:1 and group messages. See [Disappearing Messages Extension](/fundamentals/disappearing-messages).
+
+### Customer Support
+
+#### Chatwoot
+
+Routes user messages to Chatwoot for customer support. See [Chatwoot Extension](/fundamentals/chatwoot).
+
+#### Intercom
+
+Integrates Intercom for in-app customer support. See [Intercom Extension](/fundamentals/intercom).
+
+### Smart Chat Features
+
+#### Conversation Starter
+
+AI-generated opening messages for new chats. See [Conversation Starter](/fundamentals/ai-user-copilot/conversation-starter) and [AI Features](/ui-kit/react/ai-features).
+
+#### Smart Replies
+
+AI-generated response suggestions based on conversation context. See [Smart Replies](/fundamentals/ai-user-copilot/smart-replies) and [AI Features](/ui-kit/react/ai-features).
+
+#### Conversation Summary
+
+AI-generated recap of long conversations. See [Conversation Summary](/fundamentals/ai-user-copilot/conversation-summary) and [AI Features](/ui-kit/react/ai-features).
+
+---
+
+## Next Steps
+
+
-***
-
-## Usage
-
-### Integration
+---
-The following code snippet illustrates how you can directly incorporate the Group Members component into your Application.
+## Minimal Render
-
+
-##### 4. onError
+Customized:
-This action doesn't change the behavior of the component but rather listens for any errors that occur in the Group Members component.
+
+
+
+
-**Example**
+Customized:
-In the example below, we are applying a filter to the Group Members by setting the limit to two and setting the scope to show only admin and moderator.
+
+
+
+
-export default GroupMembersDemo;
-```
+Customized:
-
+
+
+
+
+
+
-
-
+| | |
+| --- | --- |
+| Type | `CometChat.Group` |
+| Default | — |
-The customized chat interface is displayed below.
+---
-
-
-
+### groupMemberRequestBuilder
-Use the following code to achieve the customization shown above.
+Controls which members load and in what order.
-
-
+| | |
+| --- | --- |
+| Type | `boolean` |
+| Default | `false` |
-Use the following code to achieve the customization shown above.
+---
-
-
+| | |
+| --- | --- |
+| Type | `(groupMember: CometChat.GroupMember) => JSX.Element` |
+| Default | Built-in list item |
-The customized chat interface is displayed below.
+---
-
-
-
+### leadingView
-Use the following code to achieve the customization shown above.
+Custom renderer for the avatar / left section.
-
-
+| | |
+| --- | --- |
+| Type | `((error: CometChat.CometChatException) => void) \| null` |
+| Default | `undefined` |
-Use the following code to achieve the customization shown above.
+---
-
-
+### searchKeyword
-The customized chat interface is displayed below.
+Pre-fills the search and filters the member list.
-
-
-
+| | |
+| --- | --- |
+| Type | `string` |
+| Default | `""` |
-Use the following code to achieve the customization shown above.
+---
-
-
-
-Use the following code to achieve the customization shown above.
-
-
-
+### titleView
-Use the following code to achieve the customization shown above.
+Custom renderer for the name / title text.
-
-
+`CometChatGroups` is a directory list component. It renders available groups and emits the selected `CometChat.Group` via `onItemClick`. Wire it to `CometChatMessageHeader`, `CometChatMessageList`, and `CometChatMessageComposer` to build a group chat layout.
-The Groups component is composed of the following BaseComponents:
+```tsx lines
+import { useState } from "react";
+import {
+ CometChatGroups,
+ CometChatMessageHeader,
+ CometChatMessageList,
+ CometChatMessageComposer,
+} from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
+import "@cometchat/chat-uikit-react/css-variables.css";
-| Components | Description |
-| ----------------- | ------------------------------------------------------------------------------------------------------------------------- |
-| CometChatList | A reusable container component having title, search box, customisable background and a list view. |
-| CometChatListItem | A component that renders data obtained from a Group object on a Tile having a title, subtitle, leading and trailing view. |
+function GroupChatApp() {
+ const [selectedGroup, setSelectedGroup] = useState
+
-### Integration
+---
-The following code snippet illustrates how you can directly incorporate the Groups component into your Application.
+## Minimal Render
-
+
-**Example**
+Customized:
-
+
+
+
-The customized chat interface is displayed below.
+Customized:
-
+
-Use the following code to achieve the customization shown above.
-
+
+
+
+
+
+
+
-Use the following code to achieve the customization shown above.
-
-
+### options
-The customized chat interface is displayed below.
+Replace the context menu / hover actions on each group item.
-
+
-Use the following code to achieve the customization shown above.
-
No groups available
+ +
-
+The component uses CSS custom properties (design tokens) defined in `@cometchat/chat-uikit-react/css-variables.css`. The cascade:
-Use the following code to achieve the customization shown above.
+1. Global tokens (e.g., `--cometchat-primary-color`, `--cometchat-background-color-01`) are set on the `.cometchat` root wrapper.
+2. Component CSS (`.cometchat-groups`) consumes these tokens via `var()` with fallback values.
+3. Overrides target `.cometchat-groups` descendant selectors in a global stylesheet.
-
+
-.cometchat-groups .cometchat-list-item .groups__leading-view .cometchat-avatar__image, .cometchat-groups .cometchat-list-item .groups__leading-view .cometchat-avatar{
- border-radius: 8px;
- height: 48px ;
- width: 48px ;
+```css lines
+.cometchat-groups .cometchat-list__header-title {
+ background-color: #edeafa;
+ color: #6852d6;
+ border-width: 0px 1px 1px 0px;
+ border-style: solid;
+ border-color: #6852d6;
+ font-family: "Times New Roman";
+ font-size: 24px;
+ font-weight: 700;
}
-.groups__leading-view-info{
- display: flex;
- width: 48px;
- height: 15px;
- padding: 1px 3px;
- justify-content: center;
- align-items: center;
- color:#FFF;
- font:600 8px/9.6px Roboto;
- background:#FFAB00;
- position:absolute;
- bottom:-2px;
+.cometchat-groups__list-item .cometchat-avatar {
+ background-color: #aa9ee8;
+ border-radius: 6.67px;
}
-.groups__leading-view-joined .groups__leading-view-info{
- background:#09C26F;
+
+.cometchat-groups .cometchat-list-item__body-title {
+ font-family: "Times New Roman";
+ font-size: 16px;
+ font-weight: 400;
}
-.groups__leading-view{
- position: relative;
+
+.cometchat-groups .cometchat-groups__subtitle {
+ font-family: "Times New Roman";
+ font-size: 14px;
+ font-weight: 400;
}
```
-
-
+---
-Use the following code to achieve the customization shown above.
+---
-
-
+---
-Use the following code to achieve the customization shown above.
+### errorView
-
-
+---
-Use the following code to achieve the customization shown above.
+### hideGroupType
-
-
-
-The `Incoming Call` is comprised of the following base components:
-
-| Components | Description |
-| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
-| cometchat-list-item | This component’s view consists of avatar, status indicator , title, and subtitle. The fields are then mapped with the SDK’s user, group class. |
-| cometchat-button | This component represents a button with optional icon and text. |
-| cometchat-avatar | This component component displays an image or user's avatar with fallback to the first two letters of the username. |
-
-## Usage
+## Where It Fits
-### Integration
+`CometChatIncomingCall` is an overlay component that auto-detects incoming calls and renders a notification with accept/decline buttons. Place it at the app root level so it appears above all other content.
-
+
-export default IncomingCallsDemo;
-```
+---
-
+
-
+
-
+
+
+```tsx lines
+import { CometChat } from "@cometchat/chat-sdk-javascript";
+import { CometChatAvatar, CometChatIncomingCall } from "@cometchat/chat-uikit-react";
-const IncomingCallsDemo = () => {
+function CustomItemViewIncoming() {
return (
+
-Use the following code to achieve the customization shown above.
-
-
-
+---
-Use the following code to achieve the customization shown above.
+### callSettingsBuilder
-
-
+### leadingView
-Use the following code to achieve the customization shown above.
+Custom renderer for the avatar / left section.
-
-
+### subtitleView
-Use the following code to achieve the customization shown above.
+Custom renderer for the subtitle text.
-
-## Usage
-
-### Integration
+---
-The following code snippet illustrates how you can directly incorporate the MessageComposer component into your app.
+## Minimal Render
-
+
- return chatUser ? (
-
+
+
+```tsx lines
+import {
+ CometChatMessageComposer,
+ CometChatButton,
+} from "@cometchat/chat-uikit-react";
+
+function ComposerCustomAuxiliary() {
+ return (
+
+
+
+
+
-
+---
-
-
+Hides the entire attachment button.
-The customized chat interface is displayed below.
+| | |
+| --- | --- |
+| Type | `boolean` |
+| Default | `false` |
-
-
-
+---
-Use the following code to achieve the customization shown above.
+### hideAudioAttachmentOption
-
-
+### hideFileAttachmentOption
-The customized chat interface is displayed below.
+Hides the file attachment option.
-
-
-
+| | |
+| --- | --- |
+| Type | `boolean` |
+| Default | `false` |
-Use the following code to achieve the customization shown above.
+---
-
-
+### hideSendButton
-The customized chat interface is displayed below.
+Hides the send button.
-
-
-
+| | |
+| --- | --- |
+| Type | `boolean` |
+| Default | `false` |
-Use the following code to achieve the customization shown above.
+---
-
-
+### initialComposerText
-The customized chat interface is displayed below.
+Pre-fills the text input when the component mounts.
-
-
-
+| | |
+| --- | --- |
+| Type | `string` |
+| Default | `""` |
-Use the following code to achieve the customization shown above.
+---
-
-
-
-The `MessageHeader` is comprised of the following components:
-
-| Component | Description |
-| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
-| CometChatListItem | This component’s view consists of avatar, status indicator , title, and subtitle. The fields are then mapped with the SDK’s user, group class. |
-| Back Button | BackButton that allows users to navigate back from the current activity or screen to the previous one. |
-
-## Usage
+## Where It Fits
-### Integration
+`CometChatMessageHeader` is a toolbar component that sits above `CometChatMessageList` and `CometChatMessageComposer`. It receives a `user` or `group` prop and displays the conversation's avatar, name, online status, and typing indicator. Call buttons are rendered automatically when the calling extension is enabled.
-
+
-**Example**
+---
-In this example, we are employing the `onBack` action.
+## Minimal Render
-
-
+Fires on internal errors.
-
-Use the following code to achieve the customization shown above.
-
-Use the following code to achieve the customization shown above.
-
-Use the following code to achieve the customization shown above.
-
-
-Use the following code to achieve the customization shown above.
-
-Use the following code to achieve the customization shown above.
-
-
+
-.cometchat-message-header
- .cometchat-list-item__trailing-view
- .cometchat-button__icon {
- background: black;
+```tsx lines
+import {
+ CometChatMessageHeader,
+ CometChatButton,
+} from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
+
+function AuxiliaryButtonHeader({ group }: { group: CometChat.Group }) {
+ return (
+
-
+---
-Use the following code to achieve the customization shown above.
+## Common Patterns
-
+
-// Define a custom date format pattern
-function getDateFormat() {
- const dateFormat = new CalendarObject({
- today: `hh:mm A`, // Example: "10:30 AM"
- yesterday: `[yesterday]`, // Example: "yesterday"
- otherDays: `DD MM YYYY`, // Example: "25 01 2025"
- });
- return dateFormat;
+```css lines
+.cometchat-message-header .cometchat-list-item .cometchat-avatar {
+ background: #f0999b;
+ border-radius: 8px;
}
-// Apply the custom format to the CometChatMessageHeader component
-
-***
-
-## Usage
-
-### Integration
+---
-The following code snippet illustrates how you can directly incorporate the MessageList component into your Application.
+## Minimal Render
-
+
+
-
+---
-
-
+---
-Use the following code to achieve the customization shown above.
+### onThreadRepliesClick
-
-
+---
-Use the following code to achieve the customization shown above.
+### showConversationStarters
-
-
-
-The Message Bubble structure can typically be broken down into the following views:
-
-1. **Leading view**: This is where the sender's avatar is displayed. It's typically on the left of the Message Bubble for messages from others and on the right for messages from the current user.
-
-2. **Header view**: This displays the sender's name and is especially useful in group chats where multiple users are sending messages.
-
-3. **Reply view**: This view can be used to extend the Message Bubble with additional elements. It's typically placed above the Content view.
-
-4. **Content view**: This is the core of the Message Bubble where the message content (text, images, videos, etc.) is displayed.
-
-5. **Bottom view**: This view can be used to extend the Message Bubble with additional elements, such as link previews or a 'load more' button for long messages. It's typically placed beneath the Content view.
-
-6. **Thread view**: This is where the thread reply icon and reply counts are displayed. It's located below the footer view.
-
-7. **Footer view**: This is where the reactions are displayed. It's located at the bottom of the Message Bubble.
-
-8. **Status Info view**: This is where the timestamp of the message and its delivery or read status are displayed. It's located inside the Message Bubble just below the content view.
-
-***
-
-### Properties
-
-MessageTemplate provides you with methods that allow you to alter various properties of the Message Bubble. These properties include aspects such as the `type` and `category` of a message, the appearance and behavior of the header, content, and footer sections of the message bubble,
-
-1. **type**
-
- Using `type` you can set the type of CometChatMessage, This will map your MessageTemplate to the corresponding CometChatMessage. You can set the MessageTemplates Type using the following code snippet.
-
-2. **category**
-
- Using `category` you can set the category of a MessageTemplate. This will create a MessageTemplate with the specified category and link it with a CometChatMessage of the same category.
-
- Please refer to our guide on [Message Categories](/sdk/javascript/message-structure-and-hierarchy) for a deeper understanding of message categories.
-
-3. **headerView**
-
- The `headerView` method allows you to assign a custom header view to the Message Bubble. By default, it is configured to display the sender's name.
-
-4. **contentView**
-
- The `contentView` method allows you to assign a custom content view to the Message Bubble. By default, it displays the Text Bubble, Image Bubble, File Bubble, Audio Bubble, or Video Bubble depending on the message type.
-
-5. **footerView**
-
- The `footerView` method allows you to assign a custom Footer view to the Message Bubble. By default it shows thr reactions for the message bubble.
-
-6. **bottomView**
-
- The `bottomView` method allows you to assign a custom Bottom view to the Message Bubble. By defuault is has buttons such as link previews or a 'load more' button for long messages.
-
-7. **bubbleView**
+## What It Is
- The `bubbleView` method allows you to assign a custom Bubble view to the Message Bubble. By default, headerView, contentView, statusInfoView and footerView together form a message bubble.
+`CometChatMessageTemplate` is a model class, not a rendered component. Each instance maps a message `type` + `category` pair to a set of view functions that control how that message renders inside `CometChatMessageList`. Pass an array of templates to the `templates` prop on `CometChatMessageList`.
-8. **statusInfoView**
+```tsx lines
+import { useState, useEffect } from "react";
+import {
+ CometChatMessageList,
+ CometChatMessageTemplate,
+ CometChatUIKit,
+ CometChatUIKitConstants,
+} from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
- The `statusInfoView` method allows you to assign a custom status info view to the Message Bubble. By default, it displays the receipt and timestamp.
+function CustomTemplateDemo() {
+ const [chatGroup, setChatGroup] = useState
-
@@ -284,8 +168,8 @@ The `contentview` method of MessageTemplate allows you to add a custom view to t
@@ -547,116 +288,48 @@ The `bottomView` method of MessageTemplate allows you to add a custom button vie
+
-
-
-
+
-Default Reply View
- -
-
-
-Custom Reply View
-
+
-
-
-
-
-
-
+| Key | Value |
+| --- | --- |
+| Type | `((message: CometChat.BaseMessage, alignment: MessageBubbleAlignment, textFormatters?: CometChatTextFormatter[]) => Element \| JSX.Element \| null) \| null` |
+| Default | `null` |
-
-This layout is structured into three key sections:
-
-1. **Sidebar (Conversation List)** – Displays active conversations, including users and groups.
-2. **Message View** – Shows chat messages for the selected conversation in real-time.
-3. **Message Composer** – Provides an input field for typing and sending messages, along with support for media, emojis, and reactions.
-
-***
+[
- */}
+
-
+```css title="globals.css" lines
+@import url("@cometchat/chat-uikit-react/css-variables.css");
+```
-**Recommended for:**
+Also ensure your global CSS sets `height: 100%` on the root elements:
-* Desktop-first applications
-* Apps requiring a **rich user experience** with seamless navigation
-* Platforms supporting both **individual and group messaging**
-* **Mobile-friendly** apps needing a **tap-to-open message view**
+```css title="globals.css" lines
+html,
+body {
+ height: 100%;
+}
-[
+
-**Recommended for:**
-
-* **Support chat applications** – Direct user-agent communication.
-* **Apps focusing on direct messaging** – No distractions from other conversations.
-* **Community or group chat applications** – A structured way to interact in groups.
-* **Mobile-first applications** – Designed for compact and dedicated messaging experiences.
-
-[
+
-**Recommended for:**
+[
+
-**Recommended for:**
+[
-### **Key Components**
-
-1. **Chat Header** – Displays recipient details and optional call/video call buttons.
-2. **Message View** – Shows real-time chat history.
-3. **Message Input Box** – Enables users to send messages, media, and reactions.
-
-***
-
-## **Step-by-Step Guide**
-
-### **Step 1: Implement the Chat Header**
-
-* Display **profile picture, name, and online status**.
-* Add **voice and video call buttons** (optional).
-
-```html
-
-This layout consists of:
-
-1. **Sidebar (Conversation List)** – Displays recent conversations with active users and groups.
-2. **Message View** – Shows the selected chat with real-time messages.
-3. **Message Input Box** – Allows users to send messages seamlessly.
-
-***
-
-## **Step-by-Step Guide**
-
-### **Step 1: Create a Tab Component**
-
-To manage navigation, let's build a **`CometChatTabs`** component. This component will render different tabs and allow switching between sections dynamically.
+[
-
-
-The `Outgoing Call` is comprised of the following components:
-
-| Components | Description |
-| ---------------- | ------------------------------------------------------------------------------------------------------------------- |
-| CometChat Button | This component represents a button with optional icon and text. |
-| CometChat Avatar | This component component displays an image or user's avatar with fallback to the first two letters of the username. |
-
-## Usage
+## Where It Fits
-### Integration
+`CometChatOutgoingCall` is an overlay component that displays the outgoing call screen with the recipient's name, avatar, and a cancel button. It plays a ringtone while the call is pending. Typically rendered at the app root level after initiating a call via `CometChat.initiateCall()`.
-
+
-
+
+
-export default OutgoingCallDemo;
+
+
-To fit your app's design requirements, you can customize the appearance of the Outgoing Call component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.
+
-
+---
-
+
-
-
-
-Use the following code to achieve the customization shown above.
-
-
-
-
-Use the following code to achieve the customization shown above.
-
-
-
+Disables the outgoing call ringtone.
-Use the following code to achieve the customization shown above.
+| | |
+| --- | --- |
+| Type | `boolean` |
+| Default | `false` |
-
-***
-
-## **Try Live Demo**
+---
-**Experience the CometChat UI Kit in action:**
+## Try It
-This layout is structured into three key sections:
+[
- */}
+
-**Recommended for:**
-
-* Desktop-first applications
-* Apps requiring a **rich user experience** with seamless navigation
-* Platforms supporting both **individual and group messaging**
-* **Mobile-friendly** apps needing a **tap-to-open message view**
-
[
-**Recommended for:**
-
-* **Support chat applications** – Direct user-agent communication.
-* **Apps focusing on direct messaging** – No distractions from other conversations.
-* **Community or group chat applications** – A structured way to interact in groups.
-* **Mobile-first applications** – Designed for compact and dedicated messaging experiences.
-
[
-**Recommended for:**
-
-* **Apps requiring structured navigation** – Clearly separate chat, calls, and settings.
-* **Multi-feature chat apps** – Supporting different functionalities in an organized way.
-* **Mobile-first applications** – Ideal for apps needing tab-based UI for easy access to features.
-* **Support & enterprise chat solutions** – Perfect for help desks, business chat platforms, and customer support apps.
-
[
-This layout is structured into three key sections:
-
-1. **Sidebar (Conversation List)** – Displays active conversations, including users and groups.
-2. **Message View** – Shows chat messages for the selected conversation in real-time.
-3. **Message Composer** – Provides an input field for typing and sending messages, along with support for media, emojis, and reactions.
-
-***
-
-## **Step-by-Step Guide**
-
-### **Step 1: Create Sidebar**
+---
-Let's create the `Sidebar` component which will render different conversations.
+## What You're Building
-#### **Folder Structure**
+Three sections working together:
-Create a `CometChatSelector` folder inside your `src/app` directory and add the following files:
+1. **Sidebar (conversation list)** — shows all active conversations (users and groups)
+2. **Message view** — displays chat messages for the selected conversation in real time
+3. **Message composer** — text input with support for media, emojis, and reactions
-```swift
-src/app/
-│── CometChatSelector/
-│ ├── CometChatSelector.tsx
-│ ├── CometChatSelector.css
-```
+---
-#### **Download the Icon**
+## Step 1 — Create the Sidebar Component
-These icons are available in the **CometChat UI Kit assets folder**. You can find them at:\
-🔗 [GitHub Assets Folder](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app/src/assets)
+
-
---------
-
-***
-
-## **Prerequisites**
-
-Before installing the **CometChat UI Kit for React**, you must first **create a CometChat application** via the **[CometChat Dashboard](https://app.cometchat.com/)**. The dashboard provides all the essential chat service components, including:
-
-* **User Management**
-* **Group Chat & Messaging**
-* **Voice & Video Calling**
-* **Real-time Notifications**
-
-> To initialize the **UI Kit**, you will need the following credentials from your **CometChat application**:
->
-> 1. **App ID**
-> 2. **Auth Key**
-> 3. **Region**
->
-> Ensure you have these details ready before proceeding with the installation and configuration.
-
-***
-
-## **Register & Set Up CometChat**
-
-Follow these steps to **register on CometChat** and **set up your development environment**.
-
-### **Step 1: Register on CometChat**
-
-To use **CometChat UI Kit**, you first need to register on the **CometChat Dashboard**.
+
-
+Also ensure your global CSS sets `height: 100%` on the root elements:
-**Recommended for:**
+```css title="app.css" lines
+html,
+body {
+ height: 100%;
+}
+```
-* Desktop-first applications
-* Apps requiring a **rich user experience** with seamless navigation
-* Platforms supporting both **individual and group messaging**
-* **Mobile-friendly** apps needing a **tap-to-open message view**
+Without the CSS import, components will render with broken or missing styles. Without the height rules, the chat UI won't fill the viewport.
-[Integrate Conversation List + Message](./react-router-conversation)
+---
-***
+## Step 6 — Choose a Chat Experience
-#### **2️⃣ One-to-One/Group Chat**
+Integrate a conversation view that suits your app's UX. Each option below includes a step-by-step guide.
-**Best for:** Apps that require a **focused, direct messaging experience** without a sidebar.
+### Conversation List + Message View
-**Features:**
+Two-panel layout — conversation list on the left, messages on the right. Think WhatsApp Web or Slack.
-* **Dedicated chat window** – Ideal for one-on-one or group messaging.
-* **No conversation list** – Users directly enter the chat without navigating through a list.
-* **Supports both One-to-One and Group Chats** – Easily configurable with minor code modifications.
-* **Optimized for mobile** – Full-screen chat experience without distractions.
-* **Seamless real-time communication** – Auto-updates messages for a smooth experience.
-* **Ideal for support chat or community-based messaging.**
+- Two-panel layout with conversation list and active chat window
+- Switch between one-to-one and group conversations
+- Tap-to-view on mobile — tapping a conversation opens the message view
+- Real-time updates and message sync across sessions
-
+
-**Recommended for:**
-
-* **Support chat applications** – Direct user-agent communication.
-* **Apps focusing on direct messaging** – No distractions from other conversations.
-* **Community or group chat applications** – A structured way to interact in groups.
-* **Mobile-first applications** – Designed for compact and dedicated messaging experiences.
-
-[Integrate One-to-One/Group Chat](./react-router-one-to-one-chat)
+
+
-**Recommended for:**
-
-* **Apps requiring structured navigation** – Clearly separate chat, calls, and settings.
-* **Multi-feature chat apps** – Supporting different functionalities in an organized way.
-* **Mobile-first applications** – Ideal for apps needing tab-based UI for easy access to features.
-* **Support & enterprise chat solutions** – Perfect for help desks, business chat platforms, and customer support apps.
-
-[Integrate Tab-Based Chat](./react-router-tab-based-chat)
+
+
-**Key Areas to Explore:**
+
-### **Key Components**
-
-1. **Chat Header** – Displays recipient details and optional call/video call buttons.
-2. **Message View** – Shows real-time chat history.
-3. **Message Input Box** – Enables users to send messages, media, and reactions.
-
-***
-
-## **Step-by-Step Guide**
-
-### **Step 1: Implement the Chat Header**
-
-* Display **profile picture, name, and online status**.
-* Add **voice and video call buttons** (optional).
-
-```html
-
-This layout consists of:
-
-1. **Sidebar (Conversation List)** – Displays recent conversations with active users and groups.
-2. **Message View** – Shows the selected chat with real-time messages.
-3. **Message Input Box** – Allows users to send messages seamlessly.
-
-***
-
-## **Step-by-Step Guide**
-
-### **Step 1: Create a Tab Component**
-
-To manage navigation, let's build a **`CometChatTabs`** component. This component will render different tabs and allow switching between sections dynamically.
-
-#### **Folder Structure**
-
-Create a `CometChatTabs` folder inside your `src` directory and add the following files:
+---
-```php
-public/
-├── assets # These are the images you need to save
-│ ├── chats.svg
-│ ├── calls.svg
-│ ├── users.svg
-│ ├── groups.svg
-src/app/
-│── CometChatTabs/
-│ ├── CometChatTabs.tsx
-│ ├── CometChatTabs.css
-```
+## What You're Building
-#### **Download the Icons**
+Three sections working together:
-These icons are available in the **CometChat UI Kit assets folder**. You can find them at:\
-🔗 [GitHub Assets Folder](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app/src/assets)
+1. **Tab bar** — switches between Chats, Calls, Users, and Groups
+2. **Sidebar** — renders the list for the active tab
+3. **Message view** — header + messages + composer for the selected item
-***
+---
-#### **Implementation**
+## Step 1 — Create the Tab Component
+
+
-This layout consists of:
-
-1. **Sidebar (Conversation List)** – Displays recent conversations with active users and groups.
-2. **Message View** – Shows the selected chat with real-time messages.
-3. **Message Input Box** – Allows users to send messages seamlessly.
-
-***
+[
+
+
+---
-
-
-
-
-
+### messageItemView
-The customized message search interface is displayed below.
+Replace the entire message list item in search results.
-Use the following code to achieve the customization shown above.
-
-
+### messageLeadingView
-The customized message leading view interface is displayed below.
+Replace the message avatar / left section.
-Use the following code to achieve the customization shown above.
-
-
-
-The customized message title view interface is displayed below.
+Replace the message title text.
-Use the following code to achieve the customization shown above.
-
-
-
-The customized message subtitle view interface is displayed below.
+Replace the message subtitle text.
-Use the following code to achieve the customization shown above.
-
-
+### messageTrailingView
-The customized message trailing view interface is displayed below.
+Replace the message right section.
-Use the following code to achieve the customization shown above.
-
-## Usage
+---
-Here are the steps to create a `ShortCutFormatter` for CometChat using the CometChatTextFormatter:
+## Steps
-1. Firstly, you need to import `CometChatTextFormatter` from the CometChat UI Kit react library.
+### 1. Import the base class
-```javascript
+```javascript lines
import { CometChatTextFormatter } from "@cometchat/chat-uikit-react";
```
-2. Now, extend the `CometChatTextFormatter` class to create your custom text formatter class. In this case, let's create a `HashTagTextFormatter`.
+### 2. Extend it
-```java
+```javascript lines
class ShortCutFormatter extends CometChatTextFormatter {
...
}
```
-3. Set up the `trackCharacter` and define any necessary private fields.
+### 3. Set the track character
-```javascript
+```javascript lines
this.setTrackingCharacter("!");
```
-4. Implement the `onKeyDown` method to handle key events and trigger actions based on defined shortcuts.
+### 4. Handle key events
+
+Detect shortcuts on `keyDown` and trigger expansion logic.
-```javascript
+```javascript lines
onKeyDown(event: KeyboardEvent) {
// Your implementation
}
```
-5. Implement any additional methods required for your custom formatter, such as opening and closing dialogs, handling button clicks, and formatting text.
-
-```typescript
-openDialog(buttonText: string) {
- // Your implementation
-}
-
-closeDialog() {
- // Your implementation
-}
-
-handleButtonClick = () => {
- // Your implementation
-};
-
-getFormattedText(text: string): string {
- return text;
-}
+### 5. Add dialog and formatting methods
-private getTextBeforeCaret(caretPosition: number): string {
- // Your implementation
-}
+```typescript lines
+openDialog(buttonText: string) { ... }
+closeDialog() { ... }
+handleButtonClick = () => { ... };
+getFormattedText(text: string): string { return text; }
+private getTextBeforeCaret(caretPosition: number): string { ... }
```
-## Example
+---
-Below is an example demonstrating how to use a custom formatter class in components such as [CometChatConversations](/ui-kit/react/conversations), [CometChatMessageList](/ui-kit/react/message-list), [CometChatMessageComposer](/ui-kit/react/message-composer).
+## Example
@@ -80,7 +80,10 @@ Below is an example demonstrating how to use a custom formatter class in compone
-
+### Thread header with hidden chrome
-
+
+
+```css lines
+.cometchat-thread-header {
background-color: #edeafa;
}
-.cometchat .cometchat-thread-header__reply-bar-count {
+.cometchat-thread-header__reply-bar-count {
color: #6852d6;
}
-.cometchat .cometchat-thread-header__reply-bar-divider {
- color: #6852d6;
+.cometchat-thread-header__reply-bar-divider {
+ background: #6852d6;
}
```
-
+---
+
## Usage
-`CometChatUrlsFormatter` utilizes regular expressions to identify URLs and applies styles to make them visually distinct as clickable links. Here's an example of how to extend the `CometChatTextFormatter` to create a URL text formatter:
+Extend `CometChatTextFormatter`, set regex patterns for URL detection, and override `onRegexMatch` and `registerEventListeners` to handle formatting and click behavior.
-
+`CometChatUsers` is a contact list component. It renders all available users and emits the selected `CometChat.User` via `onItemClick`. Wire it to `CometChatMessageHeader`, `CometChatMessageList`, and `CometChatMessageComposer` to build a standard two-panel chat layout.
-The Users component is composed of the following BaseComponents:
+```tsx lines
+import { useState } from "react";
+import {
+ CometChatUsers,
+ CometChatMessageHeader,
+ CometChatMessageList,
+ CometChatMessageComposer,
+} from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
+import "@cometchat/chat-uikit-react/css-variables.css";
-| Components | Description |
-| ----------------- | ------------------------------------------------------------------------------------------------------------------------ |
-| CometChatList | A reusable container component having title, search box, customisable background and a list view. |
-| CometChatListItem | A component that renders data obtained from a User object on a Tile having a title, subtitle, leading and trailing view. |
+function ChatApp() {
+ const [selectedUser, setSelectedUser] = useState
+
-### Integration
+---
-The following code snippet illustrates how you can directly incorporate the Users component into your Application.
+## Minimal Render
-
+
-export default UsersDemo;
-```
+Customized:
-
+
-
+
+
+
+
+
+Customized:
+
+
+
+
+
+
+
+
-The customized chat interface is displayed below.
+Customized:
-
+
-Use the following code to achieve the customization shown above.
-
No users found
+ +
-
+## CSS Architecture
-Use the following code to achieve the customization shown above.
+The component uses CSS custom properties (design tokens) defined in `@cometchat/chat-uikit-react/css-variables.css`. The cascade:
-
+
-.users__title-view{
- display: flex;
- align-items: center;
- gap: 4px;
- align-self: stretch;
- }
- .users__title-view-name{
+```css lines
+.cometchat .cometchat-users .cometchat-list__header-title {
+ background-color: #fce9ea;
+ color: #e5484d;
+ font-family: "Times New Roman";
+}
+
+.cometchat .cometchat-users .cometchat-list-item__body-title {
overflow: hidden;
color: #141414;
text-overflow: ellipsis;
- font:500 16px Roboto
- }
- .users__title-view-type{
- color: #FFF;
- font: 600 8px Roboto;
- display: flex;
- height: 15px;
- padding: 1px 3px;
- justify-content: center;
- align-items: center;
- gap: 3px;
- border-radius: 7px;
- background: #09C26F;
- }
- .users__title-view-type img{
- border-radius: 4px;
- height: 12px;
- width: 12px;
- }
- //different roles customisation
- .users__title-view-teacher .users__title-view-type{
- }
+ font-family: "Times New Roman";
+}
+
+.cometchat-list-item__leading-view {
+ background: #f0999b;
+ border-radius: 9.6px;
+}
```
-
-
+---
-The customized chat interface is displayed below.
+---
-
-
-
+## Props
-Use the following code to achieve the customization shown above.
+All props are optional unless noted.
-
-
+| | |
+| --- | --- |
+| Type | `JSX.Element` |
+| Default | Built-in header with title and search |
-Use the following code to achieve the customization shown above.
+---
-
-
+Hides the online/offline status indicator.
-Use the following code to achieve the customization shown above.
+| | |
+| --- | --- |
+| Type | `boolean` |
+| Default | `false` |
-
-
+Custom component displayed during the loading state.
-Use the following code to achieve the customization shown above.
+| | |
+| --- | --- |
+| Type | `JSX.Element` |
+| Default | Built-in shimmer |
-
-
+---
-The customized chat interface is displayed below.
+### onSelect
-
-
-
+Callback fired when a user is selected/deselected. Requires `selectionMode` to be set.
-Use the following code to achieve the customization shown above.
+| | |
+| --- | --- |
+| Type | `(user: CometChat.User, selected: boolean) => void` |
+| Default | `undefined` |
-