diff --git a/.gitignore b/.gitignore
index 96adadbc8..19273fa01 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
.DS_Store
.kiro/
+/codebase
diff --git a/.mintignore b/.mintignore
new file mode 100644
index 000000000..a2bfd86bc
--- /dev/null
+++ b/.mintignore
@@ -0,0 +1,2 @@
+.kiro/
+/codebase
\ No newline at end of file
diff --git a/docs.json b/docs.json
index 9b489faf5..5ff55b78a 100644
--- a/docs.json
+++ b/docs.json
@@ -549,6 +549,7 @@
"ui-kit/react/property-changes"
]
},
+ "ui-kit/react/troubleshooting",
"ui-kit/react/link/sample",
"ui-kit/react/link/changelog",
"ui-kit/react/link/figma"
diff --git a/fundamentals/extensions-overview.mdx b/fundamentals/extensions-overview.mdx
index d6e58d1dd..3aa338a73 100644
--- a/fundamentals/extensions-overview.mdx
+++ b/fundamentals/extensions-overview.mdx
@@ -11,32 +11,32 @@ Extensions pickup where our core leaves. They help extend the functionality of C
Extensions that help improve the user messaging experience. *Recommended for most apps.*
-[Pin message](/fundamentals/pin-message)\
[Bitly](/fundamentals/bitly)\
-[Avatars](/fundamentals/avatars)\
-[Message shortcuts](/fundamentals/message-shortcuts)\
[Link Preview](/fundamentals/link-preview)\
+[Message shortcuts](/fundamentals/message-shortcuts)\
+[Pin message](/fundamentals/pin-message)\
[Rich Media Preview](/fundamentals/rich-media-preview)\
[Save message](/fundamentals/save-message)\
[Thumbnail Generation](/fundamentals/thumbnail-generation)\
[TinyURL](/fundamentals/tinyurl)\
-[Voice Transcription](/fundamentals/voice-transcription)
+[Voice Transcription](/fundamentals/voice-transcription)\
+[Avatars](/fundamentals/avatars)
### User Engagement
Extensions that help increase user engagement. *Recommended for advanced apps.*
-[Email replies](/fundamentals/email-replies)\
-[Polls](/fundamentals/polls)\
[Giphy](/fundamentals/giphy)\
-[Mentions](/fundamentals/mentions)\
[Message Translation](/fundamentals/message-translation)\
-[Reactions](/fundamentals/reactions)\
-[Smart Reply](/fundamentals/smart-replies)\
+[Polls](/fundamentals/polls)\
+[Reminders](/fundamentals/reminders)\
[Stickers](/fundamentals/stickers)\
[Stipop](/fundamentals/stickers-stipop)\
[Tenor](/fundamentals/tenor)\
-[Reminders](/fundamentals/reminders)\
+[Email replies](/fundamentals/email-replies)\
+[Mentions](/fundamentals/mentions)\
+[Reactions](/fundamentals/reactions)\
+[Smart Reply](/fundamentals/smart-replies)\
[Live Streaming by api.video](/fundamentals/video-broadcasting)
### Collaboration
@@ -46,12 +46,19 @@ Extensions that help with collaboration. *Recommended for advanced apps.*
[Collaborative Whiteboard](/fundamentals/collaborative-whiteboard)\
[Collaborative Document](/fundamentals/collaborative-document)
+### Security
+
+*Extensions that help you to build adding extra security to your apps.* *Recommended for live streaming and event apps.*
+
+[Disappearing messages](/fundamentals/disappearing-messages)\
+[End to End Encryption](/fundamentals/end-to-end-encryption)
+
### Customer Support
Extensions that help you add support to your app. *Recommended for advanced apps.*
-[Intercom](/fundamentals/intercom)\
-[Chatwoot](/fundamentals/chatwoot)
+[Chatwoot](/fundamentals/chatwoot)\
+[Intercom](/fundamentals/intercom)
### Notifications
@@ -66,10 +73,3 @@ Extensions that help alert users of new messages. *Recommended for all apps.*
*Extensions that help you to build a safe messaging environment.* *Recommended for live streaming and event apps.*
[Legacy Moderation Extensions](/moderation/legacy-extensions)
-
-### Security
-
-*Extensions that help you to build adding extra security to your apps.* *Recommended for live streaming and event apps.*
-
-[Disappearing messages](/fundamentals/disappearing-messages)\
-[End to End Encryption](/fundamentals/end-to-end-encryption)
diff --git a/sdk/javascript/video-view-customisation.mdx b/sdk/javascript/video-view-customisation.mdx
index 2fd632577..5e3880224 100644
--- a/sdk/javascript/video-view-customisation.mdx
+++ b/sdk/javascript/video-view-customisation.mdx
@@ -1,8 +1,16 @@
---
title: "Video View Customisation"
+description: "Customize the main video container in CometChat calls — aspect ratio, full screen button, name label, and network label positioning."
---
-
+
+**Quick Reference**
+- **Class:** `CometChat.MainVideoContainerSetting`
+- **Apply via:** `CallSettingsBuilder.setMainVideoContainerSetting(videoSettings)`
+- **Customizable elements:** Aspect ratio, full screen button, name label, network label
+- **Position constants:** `POSITION_TOP_LEFT`, `POSITION_TOP_RIGHT`, `POSITION_BOTTOM_LEFT`, `POSITION_BOTTOM_RIGHT`
+- **Requires:** [Default Calling](/sdk/javascript/default-call) or [Direct Calling](/sdk/javascript/direct-call) setup
+
This section will guide you to customise the main video container.
@@ -26,16 +34,62 @@ The `MainVideoContainerSetting` Class is the required in case you want to custom
Example:
-
-```typescript
+
+```javascript
let videoSettings = new CometChat.MainVideoContainerSetting();
-videoSettings.setMainVideoAspectRatio(CometChat.CallSettings.ASPECT_RATIO_CONTAIN);
+videoSettings.setMainVideoAspectRatio(CometChat.CallSettings.ASPECT_RATIO_CONTAIN);
videoSettings.setFullScreenButtonParams(CometChat.CallSettings.POSITION_BOTTOM_RIGHT, true);
videoSettings.setNameLabelParams(CometChat.CallSettings.POSITION_BOTTOM_LEFT, true, "rgba(27, 27, 27, 0.4)");
-videoSettings.setNetworkLabelParams(CometChat.CallSettings.POSITION_BOTTOM_RIGHT, true);
+videoSettings.setNetworkLabelParams(CometChat.CallSettings.POSITION_BOTTOM_RIGHT, true);
```
-
+
+```typescript
+let videoSettings: CometChat.MainVideoContainerSetting = new CometChat.MainVideoContainerSetting();
+videoSettings.setMainVideoAspectRatio(CometChat.CallSettings.ASPECT_RATIO_CONTAIN);
+videoSettings.setFullScreenButtonParams(CometChat.CallSettings.POSITION_BOTTOM_RIGHT, true);
+videoSettings.setNameLabelParams(CometChat.CallSettings.POSITION_BOTTOM_LEFT, true, "rgba(27, 27, 27, 0.4)");
+videoSettings.setNetworkLabelParams(CometChat.CallSettings.POSITION_BOTTOM_RIGHT, true);
+```
+
+
+
+
+
+| Practice | Details |
+| --- | --- |
+| Aspect ratio choice | Use `ASPECT_RATIO_CONTAIN` to show the full video without cropping; use `ASPECT_RATIO_COVER` for a full-bleed look that may crop edges |
+| Label positioning | Avoid placing the name label and network label in the same corner to prevent overlap |
+| Full screen button | Keep the full screen button visible for better UX; only hide it if your app provides its own full screen toggle |
+
+
+
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| Video settings not applied | `setMainVideoContainerSetting()` not called on `CallSettingsBuilder` | Pass the `MainVideoContainerSetting` object to `CallSettingsBuilder.setMainVideoContainerSetting()` before calling `startCall()` |
+| Labels overlapping | Multiple labels positioned in the same corner | Assign different position constants to each label |
+| Full screen button missing | Visibility set to `false` | Set the second parameter of `setFullScreenButtonParams()` to `true` |
+
+
+
+
+## Next Steps
+
+
+
+ Implement default audio/video calling.
+
+
+ Implement direct calling without call events.
+
+
+ Add virtual background and blur effects.
+
+
+ Record calls for playback.
+
+
diff --git a/sdk/javascript/virtual-background.mdx b/sdk/javascript/virtual-background.mdx
index 63edd0a83..0879041c1 100644
--- a/sdk/javascript/virtual-background.mdx
+++ b/sdk/javascript/virtual-background.mdx
@@ -1,8 +1,16 @@
---
title: "Virtual Background"
+description: "Implement virtual background features in CometChat video calls — background blur, custom images, and enforced backgrounds using the JavaScript SDK."
---
-
+
+**Quick Reference**
+- **Settings class:** `CometChat.VirtualBackground`
+- **Apply via:** `CallSettingsBuilder.setVirtualBackground(virtualBackground)`
+- **Toggle UI:** `CallSettingsBuilder.showVirtualBackgroundSetting(true|false)`
+- **Runtime control:** `CometChat.CallController.getInstance()` → `setBackgroundBlur()`, `setBackgroundImage()`, `openVirtualBackground()`
+- **Requires:** [Default Calling](/sdk/javascript/default-call) or [Direct Calling](/sdk/javascript/direct-call) setup
+
This section will guide you to implement virtual background feature in video calls.
@@ -35,21 +43,17 @@ You can use the `openVirtualBackground()` method to open the virtual background
-```js
+```javascript
let callController = CometChat.CallController.getInstance();
callController.openVirtualBackground();
```
-
-
```typescript
let callController: CometChat.CallController = CometChat.CallController.getInstance();
callController.openVirtualBackground();
```
-
-
### Set Background Blur
@@ -58,23 +62,19 @@ You can use the `setBackgroundBlur()` method to apply background blur on the vid
-```js
+```javascript
let callController = CometChat.CallController.getInstance();
let blurLevel = 1;
callController.setBackgroundBlur(blurLevel);
```
-
-
```typescript
let callController: CometChat.CallController = CometChat.CallController.getInstance();
let blurLevel: number = 1;
callController.setBackgroundBlur(blurLevel);
```
-
-
### Set Background Image
@@ -83,23 +83,19 @@ You can use the `setBackgroundImage()`method to set the background image. This m
-```js
+```javascript
let callController = CometChat.CallController.getInstance();
let imageURL = "URL_OF_BACKGROUND_IMAGE";
callController.setBackgroundImage(imageURL);
```
-
-
```typescript
let callController: CometChat.CallController = CometChat.CallController.getInstance();
let imageURL: string = "URL_OF_BACKGROUND_IMAGE";
callController.setBackgroundImage(imageURL);
```
-
-
## Virtual Background Settings
@@ -114,3 +110,44 @@ The `VirtualBackground` Class is the required in case you want to change how the
| `setImages(images: Array)` | This method allows developer to add their custom background image which the end user can choose. |
| `enforceBackgroundBlur(enforceBackgroundBlur: number)` | This method starts the call with background blurred. To blur the background you need to pass an integer value between 1-99 which decides the blur level. **Default = 0** |
| `enforceBackgroundImage(enforceBackgroundImage: string)` | This methods starts the call with the provided background image. |
+
+
+
+
+| Practice | Details |
+| --- | --- |
+| Blur level range | Use values between 1-99 for `enforceBackgroundBlur()`. Higher values produce stronger blur. A value of 0 disables blur |
+| Image hosting | Host background images on a CDN for fast loading. Large images may cause lag when applied |
+| Enforce vs allow | Use `enforceBackgroundBlur()` or `enforceBackgroundImage()` when you want a mandatory background (e.g., for privacy). Use `allowBackgroundBlur()` and `allowUserImages()` to let users choose |
+| Custom buttons | Use `CallController` methods (`setBackgroundBlur`, `setBackgroundImage`, `openVirtualBackground`) when building a custom UI instead of the default CometChat menu |
+
+
+
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| Virtual background option not visible | `showVirtualBackgroundSetting(false)` was set | Set `showVirtualBackgroundSetting(true)` in `CallSettingsBuilder` |
+| Background blur not applied on call start | `enforceBackgroundBlur()` not set or set to 0 | Pass a value between 1-99 to `enforceBackgroundBlur()` |
+| Custom images not appearing | `setImages()` not called or empty array passed | Pass a non-empty array of valid image URLs to `setImages()` |
+| `CallController.getInstance()` returns null | Called before the call has started | Only use `CallController` methods after `startCall()` has been invoked |
+| User can't upload their own images | `allowUserImages(false)` was set | Set `allowUserImages(true)` in the `VirtualBackground` configuration |
+
+
+
+
+## Next Steps
+
+
+
+ Customize the main video container layout.
+
+
+ Record calls for playback.
+
+
+ Enable screen sharing and presenter mode.
+
+
+ Customize the calling UI appearance.
+
+
diff --git a/ui-kit/react/ai-assistant-chat.mdx b/ui-kit/react/ai-assistant-chat.mdx
index 2cf33676c..16ab849ec 100644
--- a/ui-kit/react/ai-assistant-chat.mdx
+++ b/ui-kit/react/ai-assistant-chat.mdx
@@ -1,18 +1,35 @@
---
title: "AI Assistant Chat"
+description: "Build an AI agent chat experience with streaming responses, quick suggestions, chat history, and custom tools using the CometChatAIAssistantChat component."
---
-## Overview
-
-`CometChatAIAssistantChat` is a composite component that assembles the message header, message list, and message composer to provide an AI agent chat experience. It supports streaming responses, quick starter suggestions, "New Chat" to reset context, and a chat history sidebar.
-
+
+
+| Field | Value |
+| --- | --- |
+| Purpose | Composite AI agent chat with streaming responses, quick suggestions, new-chat reset, and chat history sidebar |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";` |
+| Used in experiences | Dedicated AI assistant panel, embedded AI chat widget |
+| Copy-paste base | See [Base Code](#base-code--stylesheet) below |
+| Primary output | Send button click (from `onSendButtonClick`), back/close navigation |
+| Primary hook points | `onBackButtonClicked`, `onCloseButtonClicked`, `onSendButtonClick`, `onError`, view slots (`headerItemView`, `headerTitleView`, `headerSubtitleView`, `emptyChatImageView`, `emptyChatGreetingView`, `emptyChatIntroMessageView`, `aiAssistantTools`, `templates`) |
+| CSS root class | `.cometchat-ai-assistant-chat` |
+| Real-time events | None emitted directly |
+
+
+
+## Base Code and Stylesheet
+
+Renders an AI agent chat experience. Requires a `CometChat.User` representing the AI agent.
+
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
@@ -21,94 +38,87 @@ export function AIAssistantChatDemo() {
const [agent, setAgent] = React.useState();
React.useEffect(() => {
- // Replace with your assistant UID
CometChat.getUser("assistant_uid").then((u) => setAgent(u));
}, []);
if (!agent) return null;
- return(
- <>
-
- >
- );
+ return ;
}
-
```
-
+
-
-```tsx
-import { AIAssistantChatDemo } from "./AIAssistantChatDemo";
+Root CSS class for style overrides:
-export default function App() {
- return (
-
-
-
- );
+```css lines
+.cometchat-ai-assistant-chat {
+ /* overrides here */
}
```
-
-
+## Functionality
-
- A `CometChat.User` (the AI agent) is required to start the assistant chat.
-
+Props that control component behavior, grouped by surface area.
----
+### Data
-## Actions
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `user` | `CometChat.User` | — | Required. The AI agent user object. | Must be fetched via `CometChat.getUser()` before passing |
+| `streamingSpeed` | `number` | `30` | Characters-per-second speed for streaming replies | — |
+| `suggestedMessages` | `string[]` | `[]` | Quick prompt suggestions for the empty state | — |
+| `loadLastAgentConversation` | `boolean` | `false` | Loads the most recent existing agent conversation on mount | — |
+| `parentMessageId` | `number` | `undefined` | Loads a specific agent conversation. Takes priority over `loadLastAgentConversation` | — |
-[Actions](/ui-kit/react/components-overview#actions) control how a component behaves. You can hook into the following callbacks:
+### UI Visibility Toggles
-##### 1. onBackButtonClicked
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `hideSuggestedMessages` | `boolean` | `false` | Hides the suggestions section | — |
+| `hideNewChat` | `boolean` | `false` | Hides the New Chat button in header | — |
+| `hideChatHistory` | `boolean` | `false` | Hides the History button/sidebar | — |
+| `showBackButton` | `boolean` | `false` | Shows back button in header | — |
+| `showCloseButton` | `boolean` | `false` | Shows close button in header | — |
-Called when the header back button is clicked (visible when `showBackButton` is true).
+### Custom Views (Render Props)
-
-
-```tsx
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
+| Property | Type | Effect |
+| --- | --- | --- |
+| `emptyView` | `JSX.Element` | Custom empty state for the message list |
+| `loadingView` | `JSX.Element` | Custom loading view |
+| `errorView` | `JSX.Element` | Custom error view |
+| `emptyChatGreetingView` | `JSX.Element` | Custom greeting title (default uses metadata.greetingMessage or user name) |
+| `emptyChatIntroMessageView` | `JSX.Element` | Custom intro subtitle (default uses metadata.introductoryMessage) |
+| `emptyChatImageView` | `JSX.Element` | Custom empty state image |
-export function AIAssistantChatDemo() {
- const [agent, setAgent] = React.useState();
+## Actions
- React.useEffect(() => {
- CometChat.getUser("assistant_uid").then((u) => setAgent(u));
- }, []);
+[Actions](/ui-kit/react/components-overview#actions) split into predefined (built-in triggers) and user-defined (callbacks).
- const handleBack = () => {
- // your custom action
- };
+### Predefined Actions
- if (!agent) return null;
+The component internally manages message sending, streaming responses, new-chat reset, and chat history navigation.
- return (
-
- );
-}
+### User-Defined Actions
-```
+#### onBackButtonClicked
-
+Fires when the header back button is clicked. Requires `showBackButton={true}`.
-
-```jsx
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks the back button |
+| Payload type | `() => void` |
+| What devs typically do next | Navigate back to previous view |
+
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
export function AIAssistantChatDemo() {
- const [agent, setAgent] = React.useState(null);
+ const [agent, setAgent] = React.useState();
React.useEffect(() => {
CometChat.getUser("assistant_uid").then((u) => setAgent(u));
@@ -121,25 +131,26 @@ export function AIAssistantChatDemo() {
if (!agent) return null;
return (
-
);
}
```
-
-
+#### onCloseButtonClicked
-##### 2. onCloseButtonClicked
+Fires when the header close button is clicked. Requires `showCloseButton={true}`.
-Called when the header close button is clicked (visible when `showCloseButton` is true).
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks the close button |
+| Payload type | `() => void` |
+| What devs typically do next | Close the assistant panel |
-
-
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
@@ -158,56 +169,26 @@ export function AIAssistantChatDemo() {
if (!agent) return null;
return (
-
- );
-}
-```
-
-
-
-
-```jsx
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
-
-export function AIAssistantChatDemo() {
- const [agent, setAgent] = React.useState(null);
-
- React.useEffect(() => {
- CometChat.getUser("assistant_uid").then((u) => setAgent(u));
- }, []);
-
- const handleClose = () => {
- // your custom action
- };
-
- if (!agent) return null;
-
- return (
-
);
}
```
-
-
+#### onSendButtonClick
-##### 3. onSendButtonClick
+Fires when the composer send button is clicked.
-Called when the composer send button is clicked.
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks the send button |
+| Payload type | `(message: CometChat.BaseMessage, previewMessageMode?: PreviewMessageMode) => void` |
+| What devs typically do next | Track analytics, custom pre-send logic |
-
-
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
@@ -226,57 +207,29 @@ export function AIAssistantChatDemo() {
if (!agent) return null;
return (
-
- );
-}
-```
-
-
-
-
-```jsx
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
-
-export function AIAssistantChatDemo() {
- const [agent, setAgent] = React.useState(null);
-
- React.useEffect(() => {
- CometChat.getUser("assistant_uid").then((u) => setAgent(u));
- }, []);
-
- const handleSendButton = () => {
- // your custom action
- };
-
- if (!agent) return null;
-
- return (
-
);
}
```
-
-
+#### onError
-##### 4. onError
+Fires when the component encounters an error from the underlying header, list, or composer.
-Listen to errors from the underlying header, list, or composer.
+| Detail | Value |
+| --- | --- |
+| When it fires | Any internal error during rendering or data fetching |
+| Payload type | `(error: CometChat.CometChatException) => void` |
+| What devs typically do next | Log to error tracking service |
-
-
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
+
export function AIAssistantChatDemo() {
const [agent, setAgent] = React.useState();
@@ -291,258 +244,69 @@ export function AIAssistantChatDemo() {
if (!agent) return null;
return (
-
);
}
```
-
-
-
-```jsx
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
-export function AIAssistantChatDemo() {
- const [agent, setAgent] = React.useState(null);
-
- React.useEffect(() => {
- CometChat.getUser("assistant_uid").then((u) => setAgent(u));
- }, []);
-
- const handleError = (error: CometChat.CometChatException) => {
- // your error handling
- };
-
- if (!agent) return null;
-
- return (
-
- )
-}
-```
-
-
-
-
-
----
-
-## Customization
-
-To fit your app’s design requirements, you can customize the appearance of the Assistant Chat component. We provide exposed properties that allow you to modify the experience and behavior according to your specific needs.
-
-### Style
-
-You can set the css of the Assistant Chat Component to customize the styling.
-
-
-
-
-
-
-
-```tsx
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
-
-export function AIAssistantChatDemo = () => {
- const [agent, setAgent] = React.useState();
-
- React.useEffect(() => {
- CometChat.getUser("assistant_uid").then((u) => setAgent(u));
- }, []);
-
- if (!agent) return null;
-
- return (
-
- );
-}
-```
-
-
-
-
-```css
-.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%;
-}
-
-.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;
-}
-.cometchat-ai-assistant-chat
- .cometchat-ai-assistant-chat__header-auxiliary-view
- .cometchat-button
- .cometchat-button__icon-default {
- background: #30a46c;
-}
-```
-
-
-
-
-### Functionality
-
-These props tailor the experience. Most message options (copy/edit/delete/react, receipts, date separators, etc.) are disabled by default for assistant chats.
-
-
-
-```tsx
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
-export function AIAssistantChatDemo = () => {
- const [agent, setAgent] = React.useState();
+## Filters
- React.useEffect(() => {
- CometChat.getUser("assistant_uid").then((u) => setAgent(u));
- }, []);
+The AI Assistant Chat component does not expose `RequestBuilder` or filter props. The component manages AI conversation data fetching internally.
- if (!agent) return null;
+## Events
- // Example: Set streaming speed to 30 characters per second
- // and show close button
- // You can also customize suggestions, empty state, etc.
- return (
-
- )
-}
-```
+### UI Events
-
+The AI Assistant Chat component does not emit global UI events. For interaction handling, use the callback props documented in [Actions](#actions).
-
-```jsx
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
+### SDK Events (Real-Time)
-export function AIAssistantChatDemo = () => {
- const [agent, setAgent] = React.useState(null);
+The component internally manages SDK communication for AI streaming. No manual listener attachment needed.
- React.useEffect(() => {
- CometChat.getUser("assistant_uid").then((u) => setAgent(u));
- }, []);
+## Advanced: Custom View Slots
- if (!agent) return null;
+Customization override points for the AI assistant chat UI.
- // Example: Set streaming speed to 30 characters per second
- // and show close button
- // You can also customize suggestions, empty state, etc.
- return (
-
- );
-}
-```
+### Slot Catalog
-
-
+| Slot | Params | What it replaces | Section |
+| --- | --- | --- | --- |
+| `headerItemView` | `JSX.Element` | Entire header list item | Header |
+| `headerTitleView` | `JSX.Element` | Header title text | Header |
+| `headerSubtitleView` | `JSX.Element` | Header subtitle text | Header |
+| `headerLeadingView` | `JSX.Element` | Header avatar / left section | Header |
+| `headerTrailingView` | `JSX.Element` | Header right section | Header |
+| `headerAuxiliaryButtonView` | `JSX.Element` | Header auxiliary buttons (New Chat, History) | Header |
+| `emptyChatImageView` | `JSX.Element` | Empty state image | Empty state |
+| `emptyChatGreetingView` | `JSX.Element` | Empty state greeting title | Empty state |
+| `emptyChatIntroMessageView` | `JSX.Element` | Empty state intro subtitle | Empty state |
+| `aiAssistantTools` | `CometChatAIAssistantTools` | Tool/function call handlers | AI tools |
+| `templates` | `CometChatMessageTemplate[]` | Message bubble templates | Message list |
----
+### Header Views
-| Property | Description | Example |
-| --------------------------- | ------------------------------------------------------------------------------------------------------------ | --------------------------------------- |
-| `user` | Required `CometChat.User` representing the AI agent. | `user={agent}` |
-| `streamingSpeed` | Characters-per-second speed for streaming replies. Default `30`. | `streamingSpeed={50}` |
-| `suggestedMessages` | Array of quick prompts for the empty state. | `suggestedMessages=["Help", "Summarize"]` |
-| `hideSuggestedMessages` | Hide the suggestions section. | `hideSuggestedMessages={true}` |
-| `hideNewChat` | Hide the New Chat button in header. | `hideNewChat={true}` |
-| `hideChatHistory` | Hide the History button/sidebar. | `hideChatHistory={true}` |
-| `showBackButton` | Show back button in header. | `showBackButton` |
-| `showCloseButton` | Show close button in header. | `showCloseButton` |
-| `onBackButtonClicked` | Back button handler. | `onBackButtonClicked={() => {}}` |
-| `onCloseButtonClicked` | Close button handler. | `onCloseButtonClicked={() => {}}` |
-| `onSendButtonClick` | Send button handler. | `onSendButtonClick={() => {}}` |
-| `onError` | Error handler. | `onError={handleError}` |
-| `emptyView` | Custom empty state for the list. | `emptyView={}` |
-| `loadingView` | Custom loading view. | `loadingView={}` |
-| `errorView` | Custom error view. | `errorView={}` |
-| `emptyChatGreetingView` | Custom empty title (default uses metadata.greetingMessage or user name). | `emptyChatGreetingView={}` |
-| `emptyChatIntroMessageView` | Custom empty subtitle (default uses metadata.introductoryMessage). | `emptyChatIntroMessageView={}` |
-| `emptyChatImageView` | Custom empty image. | `emptyChatImageView={}` |
-| `aiAssistantTools` | Provide tool/function handlers for the assistant. | `aiAssistantTools={tools}` |
-| `loadLastAgentConversation` | Loads the most recent existing agent conversation if one is available. | `loadLastAgentConversation={true}` |
-| `parentMessageId` | The parent message ID to load a specific agent conversation. Takes priority over `loadLastAgentConversation`. | `parentMessageId={12345}` |
-
-### Advanced
-
-#### Header Views
-
-Customize header sections using the following props: `headerItemView`, `headerTitleView`, `headerSubtitleView`, `headerLeadingView`, `headerTrailingView`, and `headerAuxiliaryButtonView`. These customizations are done in the similar way as the [Message Header](/ui-kit/react/message-header#advanced) component.
+Customize header sections using `headerItemView`, `headerTitleView`, `headerSubtitleView`, `headerLeadingView`, `headerTrailingView`, and `headerAuxiliaryButtonView`. These follow the same pattern as the [CometChatMessageHeader](/ui-kit/react/message-header#advanced-custom-view-slots) component.
-The header’s "New Chat" and "History" buttons are built-in. You can override them by providing a custom `headerAuxiliaryButtonView`.
+The header's "New Chat" and "History" buttons are built-in. Override them by providing a custom `headerAuxiliaryButtonView`.
-#### Assistant Tools
+### aiAssistantTools
Pass an instance of `CometChatAIAssistantTools` to enable tool/function calls during assistant replies.
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
import { CometChatAIAssistantTools } from "@cometchat/chat-uikit-react";
-export function AIAssistantChatDemo = () => {
+export function AIAssistantChatDemo() {
const [agent, setAgent] = React.useState();
React.useEffect(() => {
@@ -551,45 +315,9 @@ export function AIAssistantChatDemo = () => {
const tools = new CometChatAIAssistantTools({
getCurrentWeather: ({ location }: { location: string }) => {
- // call your backend or a public API
- console.log("Fetching weather for", location);
- },
- createTicket: ({ title }: { title: string }) => {
- // open your internal ticketing flow
- console.log("Create ticket:", title);
- },
- });
-
- if (!agent) return null;
-
- return (
-
- );
-```
-
-
-
-
-```jsx
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
-import { CometChatAIAssistantTools } from "@cometchat/chat-uikit-react";
-
-export function AIAssistantChatDemo = () => {
- const [agent, setAgent] = React.useState(null);
-
- React.useEffect(() => {
- CometChat.getUser("assistant_uid").then((u) => setAgent(u));
- }, []);
-
- const tools = new CometChatAIAssistantTools({
- getCurrentWeather: ({ location }: { location: string }) => {
- // call your backend or a public API
console.log("Fetching weather for", location);
},
createTicket: ({ title }: { title: string }) => {
- // open your internal ticketing flow
console.log("Create ticket:", title);
},
});
@@ -601,21 +329,18 @@ export function AIAssistantChatDemo = () => {
);
}
```
-
-#### Empty Chat Image View
+### emptyChatImageView
-Provide a custom image for the empty state using `emptyChatImageView`.
+Provide a custom image for the empty state.
-
-
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
@@ -638,38 +363,9 @@ export function AIAssistantChatDemo() {
}
```
-
-
-
-```jsx
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
-
-export function AIAssistantChatDemo() {
- const [agent, setAgent] = React.useState(null);
-
- React.useEffect(() => {
- CometChat.getUser("assistant_uid").then((u) => setAgent(u));
- }, []);
-
- if (!agent) return null;
-
- return (
- }
- />
- )
-}
-```
-
-
-
-
-#### Empty Chat Greeting View
+### emptyChatGreetingView
-Override the empty state greeting message view using the `emptyChatGreetingView` prop.
+Override the empty state greeting message.
@@ -677,7 +373,7 @@ Override the empty state greeting message view using the `emptyChatGreetingView`
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
@@ -704,42 +400,9 @@ export function AIAssistantChatDemo() {
);
}
```
-
-
-
-```jsx
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
-
-export function AIAssistantChatDemo() {
- const [agent, setAgent] = React.useState(null);
-
- React.useEffect(() => {
- CometChat.getUser("assistant_uid").then((u) => setAgent(u));
- }, []);
-
- if (!agent) return null;
-
- return (
-
- Free Plan .
- Upgrade
-
- }
- />
- )
-}
-```
-
-
-
-
-```css
+
+```css lines
.cometchat-ai-assistant-chat__empty-chat-greeting {
display: flex;
padding: 8px 20px;
@@ -762,9 +425,9 @@ export function AIAssistantChatDemo() {
-#### Empty Chat Intro Message View
+### emptyChatIntroMessageView
-You can override the empty chat intro message view using the `emptyChatIntroMessageView` prop.
+Override the empty chat intro message.
@@ -772,7 +435,7 @@ You can override the empty chat intro message view using the `emptyChatIntroMess
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
@@ -791,48 +454,16 @@ export function AIAssistantChatDemo() {
user={agent}
emptyChatIntroMessageView={
- Hey, nice to see you What’s new?
-
- }
- />
- );
-}
-```
-
-
-
-
-```jsx
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
-
-export function AIAssistantChatDemo() {
- const [agent, setAgent] = React.useState(null);
-
- React.useEffect(() => {
- CometChat.getUser("assistant_uid").then((u) => setAgent(u));
- }, []);
-
- if (!agent) return null;
-
- return (
-
- Hey, nice to see you What’s new?
+ Hey, nice to see you What's new?
}
/>
);
}
```
-
-
-
-```css
+
+```css lines
.cometchat-ai-assistant-chat__empty-chat-intro {
display: flex;
padding: 12px;
@@ -855,15 +486,11 @@ export function AIAssistantChatDemo() {
-#### Templates
-
-[CometChatMessageTemplate](/ui-kit/react/message-template) is a pre-defined structure for creating message views that can be used as a starting point or blueprint for creating message views often known as message bubbles. For more information, you can refer to [CometChatMessageTemplate](/ui-kit/react/message-template).
+### templates
-You can set message Templates to AIAssistantChat by using the following code snippet.
+Set custom message templates to control message bubble rendering. Refer to [CometChatMessageTemplate](/ui-kit/react/message-template) for details.
-
-
-```ts
+```ts lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import {
@@ -895,44 +522,61 @@ export function AIAssistantChatDemo() {
}
```
-
+## Theme and Styling
+
+Using CSS, customize the look and feel of the component. The root CSS class is `.cometchat-ai-assistant-chat`.
+
+
+
+
-
-```js
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
-import {
- CometChatAIAssistantChat,
- ChatConfigurator
-} from "@cometchat/chat-uikit-react";
+import { CometChatAIAssistantChat } from "@cometchat/chat-uikit-react";
export function AIAssistantChatDemo() {
- const [chatUser, setChatUser] = React.useState(null);
+ const [agent, setAgent] = React.useState();
- React.useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
- }, []);
+ React.useEffect(() => {
+ CometChat.getUser("assistant_uid").then((u) => setAgent(u));
+ }, []);
- const getTemplates = () => {
- let templates = ChatConfigurator.getDataSource().getAllMessageTemplates();
- templates.map((data) => {
- data.footerView = (message) => {}; //custom view here
- });
- return templates;
- };
+ if (!agent) return null;
- return chatUser ? (
-
-
-
- ) : null;
+ 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%;
+}
-
+.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;
+}
-***
+.cometchat-ai-assistant-chat
+ .cometchat-ai-assistant-chat__header-auxiliary-view
+ .cometchat-button
+ .cometchat-button__icon-default {
+ background: #30a46c;
+}
+```
diff --git a/ui-kit/react/ai-features.mdx b/ui-kit/react/ai-features.mdx
index c0f24be3b..d8486f526 100644
--- a/ui-kit/react/ai-features.mdx
+++ b/ui-kit/react/ai-features.mdx
@@ -1,20 +1,27 @@
---
-title: "AI User Copilot"
+title: "Smart Chat Features"
+description: "Learn about the AI-powered features in CometChat's React UI Kit, including Conversation Starter, Smart Replies, and Conversation Summary."
---
+
+- **Package:** `@cometchat/chat-uikit-react`
+- **Required setup:** `CometChatUIKit.init(UIKitSettings)` then `CometChatUIKit.login("UID")` + AI features enabled in [CometChat Dashboard](/fundamentals/ai-user-copilot/overview)
+- **AI features:** Conversation Starter, Smart Replies, Conversation Summary
+- **Key components:** `CometChatMessageList` → [Message List](/ui-kit/react/message-list) (Conversation Starter), `CometChatMessageComposer` → [Message Composer](/ui-kit/react/message-composer) (Smart Replies, Summary), `CometChatAIAssistantChat` → [AI Assistant Chat](/ui-kit/react/ai-assistant-chat)
+- **Activation:** Enable each AI feature from the CometChat Dashboard — UI Kit auto-integrates them, no additional code required
+
+
## Overview
CometChat's AI capabilities greatly enhance user interaction and engagement in your application. Let's understand how the React UI Kit achieves these features.
-
-
-
+## Smart Chat Features
-## 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.
-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/react/message-list) Component of UI Kits.
@@ -22,7 +29,7 @@ Once you have successfully activated the [Conversation Starter](/fundamentals/ai
-## Smart Replies
+### 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.
@@ -34,7 +41,7 @@ Once you have successfully activated the [Smart Replies](/fundamentals/ai-user-c
-## 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.
@@ -45,3 +52,23 @@ Once you have successfully activated the [Conversation Summary](/fundamentals/ai
+
+
+---
+
+## Next Steps
+
+
+
+ Add an AI-powered assistant to your chat
+
+
+ Customize the message list where AI features appear
+
+
+ Customize the composer with Smart Replies and Summary
+
+
+ Explore core chat features like messaging and reactions
+
+
diff --git a/ui-kit/react/astro-conversation.mdx b/ui-kit/react/astro-conversation.mdx
index 605b47376..2b663620c 100644
--- a/ui-kit/react/astro-conversation.mdx
+++ b/ui-kit/react/astro-conversation.mdx
@@ -1,282 +1,270 @@
---
-title: "Building a Conversation List + Message View in Astro"
+title: "Conversation List + Message View"
sidebarTitle: "Conversation List + Message View"
+description: "Build a two-panel conversation list + message view layout in Astro with CometChat React UI Kit."
---
-The Conversation List + Message View layout provides a familiar two‑panel experience, similar to WhatsApp Web or Slack. Users browse conversations on the left and chat in real time on the right.
+
-***
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Framework | Astro (with `@astrojs/react` islands) |
+| Components | `CometChatConversations`, `CometChatMessageHeader`, `CometChatMessageList`, `CometChatMessageComposer` |
+| Layout | Two-panel — conversation list (left) + message view (right) |
+| Prerequisite | Complete [Astro Integration](/ui-kit/react/astro-integration) Steps 1–5 first |
+| SSR | `client:only="react"` directive — CometChat requires browser APIs |
+| Pattern | WhatsApp Web, Slack, Microsoft Teams |
-## User Interface Overview
+
+
+This guide builds a two-panel chat layout — conversation list on the left, messages on the right. Users tap a conversation to open it.
+
+This assumes you've already completed [Astro Integration](/ui-kit/react/astro-integration) (project created, React added, UI Kit installed).
-
+
-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
-
-
-
-
-
- ```bash
- npm create astro@latest
- cd my-astro-app
- npm install
- ```
-
-
-
-
- If you already have the sample `astro-conversation` project, open it instead.
-
-
-
-
- ```bash
- npx astro add react
- npm i @cometchat/chat-uikit-react react react-dom
- ```
-
- Add your CometChat credentials to `.env` at the project root:
-
- ```bash
- PUBLIC_COMETCHAT_APP_ID=your_app_id
- PUBLIC_COMETCHAT_REGION=your_region
- PUBLIC_COMETCHAT_AUTH_KEY=your_auth_key
- # Optional: default login UID for development
- PUBLIC_COMETCHAT_LOGIN_UID=cometchat-uid-3
- ```
-
-
- Use Auth Tokens in production instead of Auth Keys.
-
-
-
-
- Create `src/lib/cometchat-init.js` and initialize the UI Kit using environment variables.
-
- ```javascript src/lib/cometchat-init.js
- import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
-
- const APP_ID = import.meta.env.PUBLIC_COMETCHAT_APP_ID;
- const REGION = import.meta.env.PUBLIC_COMETCHAT_REGION;
- const AUTH_KEY = import.meta.env.PUBLIC_COMETCHAT_AUTH_KEY;
-
- export async function initCometChat() {
- if (!APP_ID || !REGION || !AUTH_KEY) {
- throw new Error("Missing PUBLIC_COMETCHAT_* env vars.");
- }
-
- const settings = new UIKitSettingsBuilder()
- .setAppId(APP_ID)
- .setRegion(REGION)
- .setAuthKey(AUTH_KEY) // use Auth Tokens in prod
+---
+
+## What You're Building
+
+Three sections working together:
+
+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
+
+---
+
+## Step 1 — Create the React Island
+
+Create a `ChatApp` component inside `src/components/`. This is a React island that handles init, login, and renders the full chat experience.
+
+
+
+
+
+
+
+
+
+
+
+
+
+```tsx title="ChatApp.tsx" lines highlight={15-17, 20}
+import { useEffect, useState } from "react";
+import {
+ CometChatConversations,
+ CometChatMessageComposer,
+ CometChatMessageHeader,
+ CometChatMessageList,
+ CometChatUIKit,
+ UIKitSettingsBuilder,
+} from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
+import "@cometchat/chat-uikit-react/css-variables.css";
+import "./ChatApp.css";
+
+const COMETCHAT_CONSTANTS = {
+ APP_ID: "", // Replace with your App ID
+ REGION: "", // Replace with your Region
+ AUTH_KEY: "", // Replace with your Auth Key (dev only)
+};
+
+const UID = "cometchat-uid-1"; // Replace with your actual UID
+
+export default function ChatApp() {
+ const [user, setUser] = useState(undefined);
+ const [selectedUser, setSelectedUser] = useState(undefined);
+ const [selectedGroup, setSelectedGroup] = useState(undefined);
+
+ useEffect(() => {
+ const UIKitSettings = new UIKitSettingsBuilder()
+ .setAppId(COMETCHAT_CONSTANTS.APP_ID)
+ .setRegion(COMETCHAT_CONSTANTS.REGION)
+ .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
.subscribePresenceForAllUsers()
.build();
- await CometChatUIKit.init(settings);
- }
-
- export async function ensureLogin(uid) {
- const existing = await CometChatUIKit.getLoggedinUser();
-
- // If a different user is logged in, logout first
- if (existing && existing.getUid() !== uid) {
- console.log(`Switching from user ${existing.getUid()} to ${uid}`);
- await CometChatUIKit.logout();
- }
-
- // Login if no user is logged in or we just logged out
- const currentUser = await CometChatUIKit.getLoggedinUser();
- if (!currentUser) {
- await CometChatUIKit.login(uid);
- console.log(`Logged in as user: ${uid}`);
- } else {
- console.log(`Already logged in as user: ${uid}`);
- }
- }
-
- export async function logout() {
- await CometChatUIKit.logout();
- }
- ```
-
-
-
- Create the island used by Astro to render the two‑panel chat. This component mirrors the sample in `astro-conversation`.
-
- ```javascript src/components/ChatApp.jsx
- import { useEffect, useState } from "react";
- import {
- CometChatConversations,
- CometChatMessageHeader,
- CometChatMessageList,
- CometChatMessageComposer,
- } from "@cometchat/chat-uikit-react";
- import "@cometchat/chat-uikit-react/css-variables.css";
- import { initCometChat, ensureLogin } from "../lib/cometchat-init.js";
-
- const LOGIN_UID = "cometchat-uid-3";
-
- export default function ChatApp() {
- const [phase, setPhase] = useState("boot"); // boot | ready | error
- const [errorMsg, setErrorMsg] = useState("");
- const [selectedUser, setSelectedUser] = useState(null);
- const [selectedGroup, setSelectedGroup] = useState(null);
-
- useEffect(() => {
- let cancelled = false;
- (async () => {
- try {
- console.log(`Initializing CometChat and logging in as: ${LOGIN_UID}`);
- await initCometChat();
- await ensureLogin(LOGIN_UID);
-
- if (!cancelled) setPhase("ready");
- } catch (e) {
- console.error("CometChat init/login error:", e);
- if (!cancelled) {
- setErrorMsg(String(e?.message || e));
- setPhase("error");
+ CometChatUIKit.init(UIKitSettings)
+ .then(() => {
+ console.log("Initialization completed successfully");
+ CometChatUIKit.getLoggedinUser().then((loggedInUser) => {
+ if (!loggedInUser) {
+ CometChatUIKit.login(UID)
+ .then((u) => {
+ console.log("Login Successful", { u });
+ setUser(u);
+ })
+ .catch((error) => console.error("Login failed", error));
+ } else {
+ console.log("Already logged-in", { loggedInUser });
+ setUser(loggedInUser);
}
- }
- })();
-
- return () => { cancelled = true; };
- }, []);
-
- const handleConversationClick = (activeItem) => {
- const maybeConv = activeItem?.getConversationWith ? activeItem.getConversationWith() : null;
- const item = maybeConv || activeItem;
-
- if (item?.getUid) { // user
- setSelectedUser(item);
- setSelectedGroup(null);
- } else if (item?.getGuid) { // group
- setSelectedGroup(item);
- setSelectedUser(null);
- } else {
- setSelectedUser(null);
- setSelectedGroup(null);
- }
- };
-
- if (phase === "boot") return
- );
- }
- ```
-
-
-
- Import the island and styles, then hydrate the component on the client.
-
- ```astro src/pages/index.astro
- ---
- import ChatApp from "../components/ChatApp.jsx";
- import "../styles/globals.css";
- import "../styles/cometchat-layout.css";
- ---
-
-
-
-
- CometChat + Astro
-
-
-
-
-
- ```
-
-
- The CSS files `globals.css` and `cometchat-layout.css` are included in the sample. Ensure your layout CSS sets a two‑panel flex container and sizes the sidebar.
-
-
-
-
- ```bash
- npm run dev
- ```
-
-
- Open your app and verify you can select conversations on the left and exchange messages on the right.
-
-
-
-
-***
-
-## Troubleshooting
-
-
-
-Ensure the component is rendered as a React island (`client:only=\"react\"`) so it runs only in the browser.
-
+ ) : (
+
Select a conversation to start chatting
+ )}
+
+ );
+}
+```
+
+
+
+
+```css title="ChatApp.css" lines
+.conversations-with-messages {
+ display: flex;
+ height: 100%;
+ width: 100%;
+}
+
+.conversations-wrapper {
+ height: 100%;
+ width: 480px;
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+}
+
+.conversations-wrapper > .cometchat {
+ overflow: hidden;
+}
+
+.messages-wrapper {
+ width: calc(100% - 480px);
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+}
+
+.empty-conversation {
+ height: 100%;
+ width: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ background: var(--cometchat-background-color-03, #F5F5F5);
+ color: var(--cometchat-text-color-secondary, #727272);
+ font: var(--cometchat-font-body-regular, 400 14px Roboto);
+}
+
+.cometchat .cometchat-message-composer {
+ border-radius: 0px;
+}
+```
+
+
+
+
+**How it works**:
+- Init and login happen inside `useEffect` — the component only renders chat UI after login resolves.
+- When a conversation is tapped, the `User` or `Group` is extracted from the `Conversation` object.
+- `selectedUser` / `selectedGroup` state drives which chat is displayed — pass either `user` or `group` to the message components, never both.
-
-Verify `.env` contains `PUBLIC_COMETCHAT_APP_ID`, `PUBLIC_COMETCHAT_REGION`, and `PUBLIC_COMETCHAT_AUTH_KEY`, and restart the dev server after changes.
-
+---
-
-The sample uses `ensureLogin(uid)` to switch users by logging out if the active UID differs. Update `PUBLIC_COMETCHAT_LOGIN_UID` for development.
-
-
+## Step 2 — Render the Astro Page
-***
+Import the island and hydrate it client-side using `client:only="react"`.
-## Next Steps
+```astro title="src/pages/index.astro" lines
+---
+import ChatApp from "../components/ChatApp.tsx";
+import "../styles/globals.css";
+---
-- Customize styles in `src/styles/cometchat-layout.css`
-- Add presence or typing indicators
-- Explore themes and component overrides in the UI Kit
+
+
+
+ CometChat + Astro
+
+
+
+
+
+```
-
-To build other experiences (One‑to‑One or Tab‑based), reuse `src/lib/cometchat-init.js` and switch the React island component.
-
+The `client:only="react"` directive ensures the component skips SSR entirely and only renders in the browser — required because CometChat needs `window` and `WebSocket`.
+---
+
+## Step 3 — Run the Project
+
+
+
+```bash lines
+npm run dev
+```
+
+
+```bash lines
+pnpm dev
+```
+
+
+```bash lines
+yarn dev
+```
+
+
+
+You should see the conversation list on the left. Tap any conversation to load messages on the right.
+
+---
+
+## Next Steps
+
+
+ Customize colors, fonts, and styles to match your brand
+
+
+ Browse all prebuilt UI components
+
+ } href="/ui-kit/react/astro-integration">
+ Back to the main setup guide
+
+
+ Chat features included out of the box
+
+
diff --git a/ui-kit/react/astro-integration.mdx b/ui-kit/react/astro-integration.mdx
index 6ae758a65..2baf798fb 100644
--- a/ui-kit/react/astro-integration.mdx
+++ b/ui-kit/react/astro-integration.mdx
@@ -1,343 +1,304 @@
---
-title: "Getting Started With CometChat React UI Kit in Astro"
+title: "Astro Integration"
sidebarTitle: "Integration"
+description: "Add CometChat to an Astro app in 5 steps: create project, install, init, login, render."
---
-The CometChat platform lets you add in‑app chat with minimal effort. In Astro, you can integrate CometChat in two primary ways:
+
-- Using the CometChat JavaScript SDK directly for framework-agnostic control
-- Using the CometChat React UI Kit via the `@astrojs/react` integration to get prebuilt, themeable chat UI
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Peer deps | `react` >=18, `react-dom` >=18, `@astrojs/react` |
+| Init | `CometChatUIKit.init(UIKitSettings)` — must resolve before `login()` |
+| Login | `CometChatUIKit.login("UID")` — must resolve before rendering components |
+| Order | `init()` → `login()` → render. Breaking this order = blank screen |
+| Auth Key | Dev/testing only. Use Auth Token in production |
+| SSR | CometChat requires browser APIs — use `client:only="react"` directive on Astro islands |
+| CSS | `import "@cometchat/chat-uikit-react/css-variables.css"` in your React island |
+| Calling | Optional. Install `@cometchat/calls-sdk-javascript` to enable |
+| Other frameworks | [React.js](/ui-kit/react/react-js-integration) · [Next.js](/ui-kit/react/next-js-integration) · [React Router](/ui-kit/react/react-router-integration) |
-This guide shows you CometChat React UI Kit Integration so you can quickly enable one-to-one and group messaging in your Astro app.
+
-
-
-
-
+This guide walks you through adding CometChat to an Astro app using React islands. By the end you'll have a working chat UI.
-***
+
+CometChat UI Kit requires browser APIs (`window`, `WebSocket`, `document`). In Astro, always load CometChat components using the `client:only="react"` directive so they only render client-side.
+
-***
+---
## Prerequisites
-Before installing the CometChat SDK or UI Kit, create a CometChat application in the [CometChat Dashboard](https://app.cometchat.com/). The dashboard provides core services including:
-
-- User Management
-- Group Chat & Messaging
-- Voice & Video Calling
-- Real-time Notifications
-
-> To initialize CometChat you need the following from your application:
->
-> 1. App ID
-> 2. Auth Key
-> 3. Region
->
-> Keep these ready for the configuration steps below.
-
-***
-
-## Register & Set Up CometChat
+You need three things from the [CometChat Dashboard](https://app.cometchat.com/):
-Follow these steps to register and prepare your environment.
-
-### Step 1: Register on CometChat
-
-Sign up or log in to the CometChat Dashboard.
-
-🔗 **[Sign in to CometChat](https://app.cometchat.com/login)**
-
-### Step 2: Get Your Application Keys
+| Credential | Where to find it |
+| --- | --- |
+| App ID | Dashboard → Your App → Credentials |
+| Auth Key | Dashboard → Your App → Credentials |
+| Region | Dashboard → Your App → Credentials (e.g. `us`, `eu`, `in`) |
-Create a new app and copy your credentials:
+You also need Node.js (v16+) and npm/yarn installed.
-1. Go to your App → Credentials
-2. Note the App ID, Auth Key, and Region
+
+Auth Key is for development only. In production, generate Auth Tokens server-side via the [REST API](https://api-explorer.cometchat.com/) and use [`loginWithAuthToken()`](/ui-kit/react/methods#login-using-auth-token). Never ship Auth Keys in client code.
+
-
- Each CometChat application can power a single client app. Users in the same app can chat across platforms (web and mobile).
-
+---
-### Step 3: Set Up Your Development Environment
+## Step 1 — Create an Astro Project
-Make sure your system meets these requirements:
+
+
+```bash lines
+npm create astro@latest my-app
+cd my-app
+```
+
+
+```bash lines
+pnpm create astro@latest my-app
+cd my-app
+```
+
+
+```bash lines
+yarn create astro my-app
+cd my-app
+```
+
+
-- Node.js installed
-- A code editor like [Visual Studio Code](https://code.visualstudio.com/) or [Cursor](https://www.cursor.com/)
-- npm, pnpm, or Yarn
+---
-***
+## Step 2 — Add React and Install the UI Kit
-## Built With
+First, add the React integration to Astro:
-The Astro integration relies on the following technologies:
+```bash lines
+npx astro add react
+```
-| Technology | Description |
-| --- | --- |
-| [Node.js](https://nodejs.org/) | JavaScript runtime environment |
-| [npm](https://www.npmjs.com/) | Package manager |
-| [Astro](https://astro.build/) | Web framework for content-focused sites |
-| [@astrojs/react](https://docs.astro.build/en/guides/integrations-guide/react/) | Optional: React integration for using CometChat React UI Kit |
+This updates your `astro.config.mjs` automatically. Verify it includes:
-***
+```js title="astro.config.mjs" lines
+import { defineConfig } from "astro/config";
+import react from "@astrojs/react";
-## Getting Started
+export default defineConfig({
+ integrations: [react()],
+});
+```
-### Step 1: Create an Astro Project
+Then install the UI Kit:
-
- ```bash
- npm create astro@latest
- cd
- npm install
- ```
-
-
- ```bash
- pnpm create astro@latest my-astro-app --template basics
- cd
- pnpm install
- ```
-
-
- ```bash
- yarn create astro my-astro-app --template basics
- cd
- yarn
- ```
-
+
+```bash lines
+npm install @cometchat/chat-uikit-react
+```
+
+
+```bash lines
+yarn add @cometchat/chat-uikit-react
+```
+
-
- Prefer SSR or hybrid rendering? Astro supports islands and client hydration. CometChat’s UI and SDK must run on the client.
-
-
-***
+This installs the UI Kit and its dependency `@cometchat/chat-sdk-javascript` automatically.
-### Step 2: Install Dependencies
+If you want voice/video calling, also install:
-Choose one of the following:
+```bash lines
+npm install @cometchat/calls-sdk-javascript
+```
-- JavaScript SDK only (maximum control)
-- React UI Kit (prebuilt UI) with Astro’s React integration
+---
-
-
- ```bash
- npm i @cometchat/chat-uikit-react
- ```
-
-
- ```bash
- npx astro add react
- ```
- After installing, ensure the React integration exists in `astro.config.mjs`:
- ```js
- import { defineConfig } from 'astro/config'
- import react from '@astrojs/react'
-
- export default defineConfig({
- integrations: [react()],
- })
- ```
-
-
+## Step 3 — Initialize CometChat
-
- Create a `.env` file at the project root and add the following environment variables used by the examples:
+In Astro, CometChat init and login happen inside your React island component (since they need browser APIs). Here's the pattern:
- ```bash
- PUBLIC_COMETCHAT_APP_ID=your_app_id
- PUBLIC_COMETCHAT_REGION=your_region
- PUBLIC_COMETCHAT_AUTH_KEY=your_auth_key
- # For one-to-one and tab-based examples
- PUBLIC_COMETCHAT_LOGIN_UID=cometchat-uid-3
- PUBLIC_COMETCHAT_TARGET_UID=cometchat-uid-1
- ```
-
+```tsx lines highlight={7-9}
+import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
-***
+/**
+ * CometChat Constants - Replace with your actual credentials
+ */
+const COMETCHAT_CONSTANTS = {
+ APP_ID: "APP_ID", // Replace with your actual App ID from CometChat
+ REGION: "REGION", // Replace with your App's Region
+ AUTH_KEY: "AUTH_KEY", // Replace with your Auth Key (leave blank if using Auth Token)
+};
+
+const UIKitSettings = new UIKitSettingsBuilder()
+ .setAppId(COMETCHAT_CONSTANTS.APP_ID)
+ .setRegion(COMETCHAT_CONSTANTS.REGION)
+ .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
+ .subscribePresenceForAllUsers()
+ .build();
+
+CometChatUIKit.init(UIKitSettings)
+ .then(() => {
+ console.log("CometChat UI Kit initialized successfully.");
+ })
+ .catch((error) => {
+ console.error("CometChat UI Kit initialization failed:", error);
+ });
+```
-### Step 3: Initialize CometChat (UI Kit)
+
+`init()` must resolve before you call `login()`. If you call `login()` before init completes, it will fail silently.
+
-Use a shared initializer that reads from environment variables and initializes the React UI Kit. This pattern matches the example projects.
+---
-```js
-// src/lib/cometchat-init.js
-import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
+## Step 4 — Login
-const APP_ID = import.meta.env.PUBLIC_COMETCHAT_APP_ID;
-const REGION = import.meta.env.PUBLIC_COMETCHAT_REGION;
-const AUTH_KEY = import.meta.env.PUBLIC_COMETCHAT_AUTH_KEY;
+After init resolves, log the user in. For development, use one of the pre-created test UIDs:
-export async function initCometChat() {
- if (!APP_ID || !REGION || !AUTH_KEY) {
- throw new Error("Missing PUBLIC_COMETCHAT_* env vars.");
- }
+`cometchat-uid-1` · `cometchat-uid-2` · `cometchat-uid-3` · `cometchat-uid-4` · `cometchat-uid-5`
- const settings = new UIKitSettingsBuilder()
- .setAppId(APP_ID)
- .setRegion(REGION)
- .setAuthKey(AUTH_KEY) // use Auth Tokens in prod
- .subscribePresenceForAllUsers()
- .build();
+```ts lines highlight={3}
+import { CometChatUIKit } from "@cometchat/chat-uikit-react";
- await CometChatUIKit.init(settings);
-}
+const UID = "UID"; // Replace with your actual UID
-export async function ensureLogin(uid) {
- const existing = await CometChatUIKit.getLoggedinUser();
- if (existing && existing.getUid() !== uid) {
- await CometChatUIKit.logout();
+CometChatUIKit.getLoggedinUser().then((user) => {
+ if (!user) {
+ CometChatUIKit.login(UID)
+ .then((user) => {
+ console.log("Login Successful:", { user });
+ // Mount your app
+ })
+ .catch(console.log);
+ } else {
+ // Already logged in — mount your app
}
- const current = await CometChatUIKit.getLoggedinUser();
- if (!current) {
- await CometChatUIKit.login(uid);
- }
-}
+});
```
-
- Replace placeholders with your actual CometChat credentials before testing.
-
+Key points:
+- `getLoggedinUser()` checks for an existing session so you don't re-login unnecessarily.
+- `login(uid)` skips the API call if a session already exists and returns the cached user.
+- Components must not render until login resolves — use a state flag to gate rendering.
-***
+
+For production, use [`loginWithAuthToken()`](/ui-kit/react/methods#login-using-auth-token) instead of Auth Key. Generate tokens server-side via the REST API.
+
-### Step 4: User Login
+---
-The example islands handle login automatically using `ensureLogin(uid)` from `src/lib/cometchat-init.js`. Configure `PUBLIC_COMETCHAT_LOGIN_UID` (and `PUBLIC_COMETCHAT_TARGET_UID` for one-to-one) in your `.env`.
+## Step 5 — Add the CSS Import
-
- Security Best Practices
+Import the CometChat CSS inside your React island component:
- - Auth Key is suitable for POCs and early testing.
- - In production, prefer an Auth Token issued by your backend.
-
+```tsx lines
+import "@cometchat/chat-uikit-react/css-variables.css";
+```
-
- Test UIDs you can use immediately: `cometchat-uid-1`, `cometchat-uid-2`, `cometchat-uid-3`, `cometchat-uid-4`, `cometchat-uid-5`.
-
+Also ensure your global CSS sets `height: 100%` on the root elements. Create or update `src/styles/globals.css`:
-***
+```css title="src/styles/globals.css" lines
+html,
+body {
+ margin: 0;
+ padding: 0;
+ height: 100%;
+}
+```
-### **Step 5: Choose a Chat Experience**
+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 a conversation view that suits your application's **UX requirements**. Below are the available options:
+---
-***
+## Step 6 — Choose a Chat Experience
-#### **1️⃣ Conversation List + Message View**
+Integrate a conversation view that suits your app's UX. Each option below includes a step-by-step guide.
-**Best for:** Applications that need a **two-panel layout**, such as web-based chat interfaces (e.g., WhatsApp Web, Slack).
+### Conversation List + Message View
-**Features:**
+Two-panel layout — conversation list on the left, messages on the right. Think WhatsApp Web or Slack.
-* **Two-panel layout** – Displays the conversation list on the left and the active chat window on the right.
-* **One-to-one & group conversations** – Seamless switching between private and group chats.
-* **Multiple conversations** – Effortlessly switch between different chat windows.
-* **Easy navigation** – Intuitive UI for finding and accessing chats quickly.
-* **Tap-to-view on mobile** – In mobile layouts, tapping a conversation opens the **Message View**, optimizing space.
-* **Real-time updates** – Auto-refreshes messages and conversation lists.
-* **Message sync** – Ensures messages stay updated across all sessions and devices.
+- 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:**
-
-* 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**
+
+ Step-by-step guide to build this layout
+
-[Integrate Conversation List + Message](./astro-conversation)
-
-***
-
-#### **2️⃣ One-to-One/Group Chat**
+---
-**Best for:** Apps that require a **focused, direct messaging experience** without a sidebar.
+### One-to-One / Group Chat
-**Features:**
+Single chat window — no sidebar. Good for support chat, embedded widgets, or focused messaging.
-* **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.**
+- Dedicated chat window for one-on-one or group messaging
+- No conversation list — users go directly into the chat
+- Full-screen experience optimized for mobile
+- Ideal for support chat or community messaging
-
+
-**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.
+
+ Step-by-step guide to build this layout
+
-[Integrate One-to-One/Group Chat](./astro-one-to-one-chat)
-
-***
-
-#### **3️⃣ Tab-Based Chat Experience**
+---
-**Best for:** Apps that need a **structured, multi-feature navigation system** for seamless interaction between **chats, calls, users, and settings**.
+### Tab-Based Chat
-**Features:**
+Tabbed navigation — Chat, Call Logs, Users, Settings in separate tabs. Good for full-featured apps.
-* **Tab Navigation** – Easily switch between **Chat, Call Logs, Users, and Settings**.
-* **Dedicated Chat Window** – Full-screen messaging experience for focused communication.
-* **No Sidebar** – Unlike multi-panel UI, this design prioritizes individual interactions.
-* **Unified Experience** – Users can seamlessly manage conversations, call history, and settings from a single interface.
-* **Scalable for future features** – Easily extend to include more functionalities such as notifications or contact management.
-* **Optimized for both desktop and mobile** – Ensures a smooth experience across different screen sizes.
+- Tab navigation between Chat, Call Logs, Users, and Settings
+- Full-screen messaging within each tab
+- Unified experience for conversations, call history, and settings
+- Scales well for adding future features like notifications or contacts
-
+
-**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.
+
+ Step-by-step guide to build this layout
+
-[Integrate Tab-Based Chat](./astro-tab-based-chat)
-
-***
+---
## Build Your Own Chat Experience
-If you need full control, combine the JavaScript SDK with your own UI or mix Astro islands with select UI Kit components. Customize themes, behaviors, and data flows as needed.
+Need full control over the UI? Use individual components, customize themes, and wire up your own layouts.
-**Key Areas to Explore:**
+- [Sample App](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app) — Working reference app to compare against
+- [Components](/ui-kit/react/components-overview) — All prebuilt UI elements with props and customization options
+- [Core Features](/ui-kit/react/core-features) — Messaging, real-time updates, and other capabilities
+- [Theming](/ui-kit/react/theme) — Colors, fonts, dark mode, and custom styling
+- [Build Your Own UI](/sdk/javascript/overview) — Skip the UI Kit entirely and build on the raw SDK
-- [React Sample App](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app)
-- [Core Features](./core-features)
-- [Components](./components-overview)
-- [Themes](./theme)
-- [Build Your Own UI](./../../../sdk/javascript/overview)
-
-***
+---
## Next Steps
-Proceed with your chosen experience:
-
-- Conversation + Messages (UI Kit) in Astro using `CometChatConversationsWithMessages`
-- One-to-One/Group Messages (UI Kit) in Astro using `CometChatMessages`
-- Tab-Based Chat (UI Kit) in Astro using `CometChatFullScreenView`
-- Advanced customizations with themes and components
-
-
- You’ve set up CometChat in your Astro app. Initialize, log in, and render your preferred chat experience.
-
-
-
+
+
+ Browse all prebuilt UI components
+
+
+ Customize colors, fonts, and styles
+
+
+ Chat features included out of the box
+
+
+ Common issues and fixes
+
+
diff --git a/ui-kit/react/astro-one-to-one-chat.mdx b/ui-kit/react/astro-one-to-one-chat.mdx
index 54addcac0..cb092d9e0 100644
--- a/ui-kit/react/astro-one-to-one-chat.mdx
+++ b/ui-kit/react/astro-one-to-one-chat.mdx
@@ -1,270 +1,262 @@
---
-title: "Building a One-to-One/Group Chat in Astro"
-sidebarTitle: "One To One/Group Chat"
+title: "One-to-One / Group Chat"
+sidebarTitle: "One-to-One / Group Chat"
+description: "Build a focused one-to-one or group chat experience in Astro with CometChat React UI Kit."
---
-The One‑to‑One/Group chat layout focuses on a single conversation, ideal for support chats and private messaging. This guide uses Astro with React islands and the CometChat React UI Kit.
+
-***
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Framework | Astro (with `@astrojs/react` islands) |
+| Components | `CometChatMessageHeader`, `CometChatMessageList`, `CometChatMessageComposer` |
+| Layout | Single chat window — no sidebar, no conversation list |
+| Prerequisite | Complete [Astro Integration](/ui-kit/react/astro-integration) Steps 1–5 first |
+| SSR | `client:only="react"` directive — CometChat requires browser APIs |
+| Pattern | Support chat, embedded widgets, focused messaging |
-## User Interface Preview
+
+
+This guide builds a single chat window — no sidebar, no conversation list. Users go directly into a one-to-one or group chat. Good for support chat, embedded widgets, or any focused messaging experience.
+
+This assumes you've already completed [Astro Integration](/ui-kit/react/astro-integration) (project created, React added, UI Kit installed).
-
+
-**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`
-
-
-
- ```bash
- npm create astro@latest
- cd
- npm install
- ```
-
-
- If you already have the sample `astro-one-to-one-chat` project, open it instead.
-
-
-
-
- ```bash
- npx astro add react
- npm i @cometchat/chat-uikit-react react react-dom
- ```
-
- Add required environment variables to `.env`:
- ```bash
- PUBLIC_COMETCHAT_APP_ID=your_app_id
- PUBLIC_COMETCHAT_REGION=your_region
- PUBLIC_COMETCHAT_AUTH_KEY=your_auth_key
- # Login user and the peer for one-to-one
- PUBLIC_COMETCHAT_LOGIN_UID=cometchat-uid-3
- PUBLIC_COMETCHAT_TARGET_UID=cometchat-uid-1
- ```
-
-
- Use Auth Tokens in production instead of Auth Keys.
-
-
-
-
- Create `src/lib/cometchat-init.js` used by the island to initialize the UI Kit and handle login.
-
- ```javascript src/lib/cometchat-init.js
- import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
-
- const APP_ID = import.meta.env.PUBLIC_COMETCHAT_APP_ID;
- const REGION = import.meta.env.PUBLIC_COMETCHAT_REGION;
- const AUTH_KEY = import.meta.env.PUBLIC_COMETCHAT_AUTH_KEY;
-
- export async function initCometChat() {
- if (!APP_ID || !REGION || !AUTH_KEY) {
- throw new Error("Missing PUBLIC_COMETCHAT_* env vars.");
- }
+---
+
+## What You're Building
- const settings = new UIKitSettingsBuilder()
- .setAppId(APP_ID)
- .setRegion(REGION)
- .setAuthKey(AUTH_KEY) // use Auth Tokens in prod
+Three components stacked vertically:
+
+1. **Chat header** — displays recipient name, avatar, online status, and optional call buttons
+2. **Message list** — real-time chat history with scrolling
+3. **Message composer** — text input with media, emojis, and reactions
+
+---
+
+## Step 1 — Create the React Island
+
+Create a `OneToOneChat` component inside `src/components/`. This handles init, login, fetches the target user, and renders the chat UI.
+
+
+
+
+
+
+
+
+
+
+
+
+
+```tsx title="OneToOneChat.tsx" lines highlight={14-16, 37, 55, 62}
+import { useEffect, useState } from "react";
+import {
+ CometChatMessageComposer,
+ CometChatMessageHeader,
+ CometChatMessageList,
+ CometChatUIKit,
+ UIKitSettingsBuilder,
+} from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
+import "@cometchat/chat-uikit-react/css-variables.css";
+import "./OneToOneChat.css";
+
+const COMETCHAT_CONSTANTS = {
+ APP_ID: "", // Replace with your App ID
+ REGION: "", // Replace with your Region
+ AUTH_KEY: "", // Replace with your Auth Key (dev only)
+};
+
+export default function OneToOneChat() {
+ const [user, setUser] = useState(undefined);
+ const [selectedUser, setSelectedUser] = useState(undefined);
+ const [selectedGroup, setSelectedGroup] = useState(undefined);
+
+ useEffect(() => {
+ const UIKitSettings = new UIKitSettingsBuilder()
+ .setAppId(COMETCHAT_CONSTANTS.APP_ID)
+ .setRegion(COMETCHAT_CONSTANTS.REGION)
+ .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
.subscribePresenceForAllUsers()
.build();
- await CometChatUIKit.init(settings);
- }
-
- export async function ensureLogin(uid) {
- const existing = await CometChatUIKit.getLoggedinUser();
- if (!existing) await CometChatUIKit.login(uid);
- }
- ```
-
-
-
- This component initializes CometChat, logs in the desired user, and loads a single peer (user or group) to chat with.
-
- ```javascript src/components/OneToOneChat.jsx
- import { useEffect, useState } from "react";
- import {
- CometChatUIKit,
- CometChatMessageHeader,
- CometChatMessageList,
- CometChatMessageComposer,
- } from "@cometchat/chat-uikit-react";
- import "@cometchat/chat-uikit-react/css-variables.css";
- import { initCometChat, ensureLogin } from "../lib/cometchat-init.js";
-
- // current user + peer
- const LOGIN_UID = import.meta.env.PUBLIC_COMETCHAT_LOGIN_UID; // e.g., cometchat-uid-3
- const TARGET_UID = import.meta.env.PUBLIC_COMETCHAT_TARGET_UID; // e.g., cometchat-uid-1
-
- export default function OneToOneChat() {
- const [phase, setPhase] = useState("boot"); // boot | ready | error
- const [errorMsg, setErrorMsg] = useState("");
- const [peer, setPeer] = useState(null); // CometChat.User
-
- useEffect(() => {
- let cancelled = false;
-
- (async () => {
- try {
- if (!LOGIN_UID || !TARGET_UID) {
- throw new Error("Missing PUBLIC_COMETCHAT_LOGIN_UID or PUBLIC_COMETCHAT_TARGET_UID.");
+ CometChatUIKit.init(UIKitSettings)
+ .then(() => {
+ console.log("Initialization completed successfully");
+ CometChatUIKit.getLoggedinUser().then((loggedInUser) => {
+ if (!loggedInUser) {
+ CometChatUIKit.login("cometchat-uid-2")
+ .then((u) => {
+ console.log("Login Successful", { u });
+ setUser(u);
+ })
+ .catch((error) => console.error("Login failed", error));
+ } else {
+ console.log("Already logged-in", { loggedInUser });
+ setUser(loggedInUser);
}
+ });
+ })
+ .catch((error) => console.error("Initialization failed", error));
+ }, []);
+
+ useEffect(() => {
+ if (user) {
+ // Fetch the user whose chat you want to load
+ const UID = "cometchat-uid-1";
+ CometChat.getUser(UID).then(
+ (u) => setSelectedUser(u),
+ (error) => console.log("User fetching failed with error:", error)
+ );
+
+ // To load a group chat instead, uncomment below:
+ // const GUID = "GUID";
+ // CometChat.getGroup(GUID).then(
+ // (group) => setSelectedGroup(group),
+ // (error) => console.log("Group fetching failed with error:", error)
+ // );
+ }
+ }, [user]);
- // 1) Initialize CometChat
- await initCometChat();
-
- // 2) Handle user switching - logout if different user
- try {
- const currentUser = await CometChatUIKit.getLoggedinUser();
- if (currentUser && currentUser.uid !== LOGIN_UID) {
- await CometChatUIKit.logout();
- }
- } catch (error) {
- // No existing user session
- }
+ if (!user) return
- );
- }
- ```
-
-
-
- Import the island and styles, then hydrate on the client.
-
- ```astro src/pages/index.astro
- ---
- import OneToOneChat from "../components/OneToOneChat.jsx";
- import "../styles/globals.css"; // your existing base CSS (optional, recommended)
- import "../styles/one-to-one.css"; // the file from this setup
- ---
-
-
-
-
- One-to-One Chat
-
-
-
-
-
-
-
- ```
-
-
-
- ```bash
- npm run dev
- ```
-
-
- Set `PUBLIC_COMETCHAT_LOGIN_UID` and `PUBLIC_COMETCHAT_TARGET_UID` then verify messages appear for the selected peer.
-
-
-
-
-***
-
-## Switch to Group Chat
-
-To load a group instead of a user, fetch it with the SDK and pass it to the UI Kit components.
-
-```javascript
-const { CometChat } = await import("@cometchat/chat-sdk-javascript");
-const group = await CometChat.getGroup("YOUR_GROUP_ID");
-// Then render header, list, composer with group prop instead of user
+Key points:
+- `CometChat.getUser(UID)` fetches the user object from the SDK — you need a real user object, not a manually constructed one.
+- Pass either `user` or `group` to the message components, never both.
+- The highlighted lines show where to set your credentials and target UID.
+
+---
+
+## Switching Between User and Group Chat
+
+To load a group chat instead of one-to-one, replace the `getUser` call with `getGroup`:
+
+```tsx lines highlight={1}
+const GUID = "GUID"; // Replace with your actual Group ID
+
+CometChat.getGroup(GUID)
+ .then((group) => setSelectedGroup(group))
+ .catch((error) => console.error("Failed to fetch group:", error));
```
-
-When switching between user and group, keep only one of `user` or `group` props set at a time.
-
+---
-***
+## Step 2 — Render the Astro Page
-## Troubleshooting
+Import the island and hydrate it client-side using `client:only="react"`.
-
-
-Ensure the component is rendered as a React island (`client:only=\"react\"`).
-
+```astro title="src/pages/index.astro" lines
+---
+import OneToOneChat from "../components/OneToOneChat.tsx";
+import "../styles/globals.css";
+---
-
-Verify `.env` contains `PUBLIC_COMETCHAT_APP_ID`, `PUBLIC_COMETCHAT_REGION`, `PUBLIC_COMETCHAT_AUTH_KEY`, and both `PUBLIC_COMETCHAT_LOGIN_UID` and `PUBLIC_COMETCHAT_TARGET_UID`.
-
+
+
+
+ One-to-One Chat
+
+
+
+
+
+```
-
-The island logs out if a different user session is active, then logs in with `PUBLIC_COMETCHAT_LOGIN_UID`.
-
-
+The `client:only="react"` directive ensures the component skips SSR entirely and only renders in the browser.
-***
+---
-## Next Steps
+## Step 3 — Run the Project
+
+
+
+```bash lines
+npm run dev
+```
+
+
+```bash lines
+pnpm dev
+```
+
+
+```bash lines
+yarn dev
+```
+
+
-- Add typing indicators and read receipts
-- Apply theming and component overrides
-- Extend to conversations list + messages or tabbed layout
+You should see the chat window load with the conversation for the UID you set.
-
-You can reuse `src/lib/cometchat-init.js` across different chat experiences and swap the island component.
-
+---
+## Next Steps
+
+
+ Customize colors, fonts, and styles to match your brand
+
+
+ Browse all prebuilt UI components
+
+ } href="/ui-kit/react/astro-integration">
+ Back to the main setup guide
+
+
+ Chat features included out of the box
+
+
diff --git a/ui-kit/react/astro-tab-based-chat.mdx b/ui-kit/react/astro-tab-based-chat.mdx
index cf532ef4f..c4f6b27b7 100644
--- a/ui-kit/react/astro-tab-based-chat.mdx
+++ b/ui-kit/react/astro-tab-based-chat.mdx
@@ -1,368 +1,536 @@
---
-title: "Building a Messaging UI with Tabs, Sidebar, and Message View in Astro"
-sidebarTitle: "Tab Based Chat Experience"
+title: "Tab-Based Chat"
+sidebarTitle: "Tab-Based Chat"
+description: "Build a tab-based messaging UI with chats, calls, users, and groups in Astro with CometChat React UI Kit."
---
-This guide shows how to build a tab‑based messaging UI in Astro using the CometChat React UI Kit. The interface includes sections for Chats, Calls, Users, and Groups with a message panel.
+
-***
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Framework | Astro (with `@astrojs/react` islands) |
+| Components | `CometChatConversations`, `CometChatCallLogs`, `CometChatUsers`, `CometChatGroups`, `CometChatMessageHeader`, `CometChatMessageList`, `CometChatMessageComposer` |
+| Layout | Tabbed sidebar (Chats, Calls, Users, Groups) + message view |
+| Prerequisite | Complete [Astro Integration](/ui-kit/react/astro-integration) Steps 1–5 first |
+| SSR | `client:only="react"` directive — CometChat requires browser APIs |
+| Pattern | Full-featured messaging app with multiple sections |
-## User Interface Preview
+
+
+This guide builds a tabbed messaging UI — Chats, Calls, Users, and Groups tabs in the sidebar, with a message view on the right. Good for full-featured apps that need more than just conversations.
+
+This assumes you've already completed [Astro Integration](/ui-kit/react/astro-integration) (project created, React added, UI Kit installed).
-
+
-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`
-
-
-
- ```bash
- npm create astro@latest
- cd
- npm install
- ```
-
-
- If you already have the sample `astro-tab-based-chat` project, open it instead.
-
-
-
-
- ```bash
- npx astro add react
- npm i @cometchat/chat-uikit-react react react-dom
- ```
-
- Add required environment variables to `.env`:
- ```bash
- PUBLIC_COMETCHAT_APP_ID=your_app_id
- PUBLIC_COMETCHAT_REGION=your_region
- PUBLIC_COMETCHAT_AUTH_KEY=your_auth_key
- # Login UID for tabbed example
- PUBLIC_COMETCHAT_LOGIN_UID=cometchat-uid-3
- ```
-
-
- Use Auth Tokens in production instead of Auth Keys.
-
-
-
-
- Create `src/lib/cometchat-init.js` to initialize the UI Kit and provide a helper for login.
-
- ```javascript src/lib/cometchat-init.js
- import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
-
- const APP_ID = import.meta.env.PUBLIC_COMETCHAT_APP_ID;
- const REGION = import.meta.env.PUBLIC_COMETCHAT_REGION;
- const AUTH_KEY = import.meta.env.PUBLIC_COMETCHAT_AUTH_KEY;
-
- export async function initCometChat() {
- if (!APP_ID || !REGION || !AUTH_KEY) {
- throw new Error("Missing PUBLIC_COMETCHAT_* env vars.");
- }
-
- const settings = new UIKitSettingsBuilder()
- .setAppId(APP_ID)
- .setRegion(REGION)
- .setAuthKey(AUTH_KEY) // use Auth Tokens in prod
- .subscribePresenceForAllUsers()
- .build();
+---
+
+## What You're Building
- await CometChatUIKit.init(settings);
- }
-
- export async function ensureLogin(uid) {
- const existing = await CometChatUIKit.getLoggedinUser();
- if (!existing) await CometChatUIKit.login(uid);
- }
- ```
-
-
-
- A simple bottom tab bar used to switch between sections.
-
- ```javascript src/components/CometChatTabs.jsx
- import { useState } from "react";
- // CSS styling is handled by tabs-layout.css imported in the main page
-
- const chatsIcon = "/assets/chats.svg";
- const callsIcon = "/assets/calls.svg";
- const usersIcon = "/assets/users.svg";
- const groupsIcon = "/assets/groups.svg";
-
- export default function CometChatTabs({ activeTab = "chats", onTabClicked = () => {} }) {
- const [hover, setHover] = useState("");
-
- const items = [
- { name: "CHATS", icon: chatsIcon },
- { name: "CALLS", icon: callsIcon },
- { name: "USERS", icon: usersIcon },
- { name: "GROUPS", icon: groupsIcon },
- ];
-
- return (
-
- );
- }
- ```
-
-
-
- Import the island and styles, then hydrate on the client.
-
- ```astro src/pages/index.astro
- ---
- import TabbedChat from "../components/TabbedChat.jsx";
- import "../styles/tabs-layout.css"; // the CSS from this setup
- // (optional) also import your existing globals.css if you have one
- import "../styles/globals.css";
- ---
-
-
-
-
- Tabbed Messaging UI
-
-
-
-
-
-
-
- ```
-
-
-
- ```bash
- npm run dev
- ```
-
-
- Log in using `PUBLIC_COMETCHAT_LOGIN_UID`, switch tabs, and open a conversation to send messages.
-
-
-
-
-***
-
-## Troubleshooting
-
-
-
-Ensure `CometChatTabs` is wired via `onTabClicked` and that the active tab state drives which list is rendered.
-
-
-Verify `.env` contains `PUBLIC_COMETCHAT_APP_ID`, `PUBLIC_COMETCHAT_REGION`, `PUBLIC_COMETCHAT_AUTH_KEY`, and `PUBLIC_COMETCHAT_LOGIN_UID`.
-
+ {selectedUser || selectedGroup ? (
+
+
+
+
+
+ ) : (
+
Select a conversation to start chatting
+ )}
+
+ );
+}
+```
+
+
+
+
+```css title="TabbedChat.css" lines
+.conversations-with-messages {
+ display: flex;
+ height: 100%;
+ width: 100%;
+}
+.conversations-wrapper {
+ height: 100%;
+ width: 480px;
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+}
+.conversations-wrapper > .cometchat { overflow: hidden; }
+.messages-wrapper {
+ width: calc(100% - 480px);
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+}
+.empty-conversation {
+ height: 100%;
+ width: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ background: var(--cometchat-background-color-03, #F5F5F5);
+ color: var(--cometchat-text-color-secondary, #727272);
+ font: var(--cometchat-font-body-regular, 400 14px Roboto);
+}
+.cometchat .cometchat-message-composer { border-radius: 0px; }
+```
+
+
+
+
+How it works:
+- Selections from any tab (Chats, Calls, Users, Groups) flow through the same `onSelectorItemClicked` callback.
+- Conversation items are unwrapped via `getConversationWith()` to extract the underlying `User` or `Group`.
+- Only one of `selectedUser` / `selectedGroup` is set at a time — the other is cleared.
-
-The message panel shows only for Chats, Users, or Groups. Calls tab does not open a message panel.
-
-
+---
-***
+## Step 4 — Render the Astro Page
-## Next Steps
+Import the island and hydrate it client-side using `client:only="react"`.
+
+```astro title="src/pages/index.astro" lines
+---
+import TabbedChat from "../components/TabbedChat.tsx";
+import "../styles/globals.css";
+---
-- Add call handling with CometChat Calls SDK
-- Apply theming and component overrides
-- Extend with unread badges and notifications
+
+
+
+ Tabbed Messaging UI
+
+
+
+
+
+```
-
-You can reuse `src/lib/cometchat-init.js` and swap the island component to build other experiences.
-
+The `client:only="react"` directive ensures the component skips SSR entirely and only renders in the browser.
+---
+
+## Step 5 — Run the Project
+
+
+
+```bash lines
+npm run dev
+```
+
+
+```bash lines
+pnpm dev
+```
+
+
+```bash lines
+yarn dev
+```
+
+
+
+You should see the tab bar at the bottom of the sidebar. Switch between Chats, Calls, Users, and Groups — tapping any item loads the message view on the right.
+
+---
+
+## Next Steps
+
+
+ Customize colors, fonts, and styles to match your brand
+
+
+ Browse all prebuilt UI components
+
+ } href="/ui-kit/react/astro-integration">
+ Back to the main setup guide
+
+
+ Chat features included out of the box
+
+
diff --git a/ui-kit/react/call-buttons.mdx b/ui-kit/react/call-buttons.mdx
index 4c67d12bb..f3c713f66 100644
--- a/ui-kit/react/call-buttons.mdx
+++ b/ui-kit/react/call-buttons.mdx
@@ -1,22 +1,35 @@
---
title: "Call Buttons"
+description: "Add voice and video call buttons to initiate calls using the CometChatCallButtons component."
---
-## Overview
-
-The `Call Button` is a Component provides users with the ability to make calls, access call-related functionalities, and control call settings. Clicking this button typically triggers the call to be placed to the desired recipient.
-
-## Usage
+
+
+| Field | Value |
+| --- | --- |
+| Purpose | Voice and video call initiation buttons for user or group conversations |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatCallButtons } from "@cometchat/chat-uikit-react";` |
+| Used in experiences | Chat header, user profile, conversation toolbar |
+| Copy-paste base | See [Base Code](#base-code--stylesheet) below |
+| Primary output | Call initiation, call lifecycle events |
+| Primary hook points | `onError`, `callSettingsBuilder`, `OutgoingCallConfiguration` |
+| CSS root class | `.cometchat-call-button` |
+| Real-time events | `CometChatCallEvents.ccCallRejected`, `CometChatCallEvents.ccCallEnded`, `CometChatCallEvents.ccOutgoingCall`, `CometChatMessageEvents.ccMessageSent` |
+
+
+
+## Base Code and Stylesheet
-### Integration
+Renders voice and video call buttons for a user or group conversation.
-```tsx
+```tsx lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatCallButtons } from "@cometchat/chat-uikit-react";
import React from "react";
@@ -33,49 +46,70 @@ const CallButtonDemo = () => {
export default CallButtonDemo;
```
-
+
-
-```tsx
-import { CallButtonDemo } from "./CallButtonDemo";
-
-export default function App() {
- return (
-
-
-
-
-
- );
+Root CSS class for style overrides:
+
+```css lines
+.cometchat-call-button {
+ /* overrides here */
}
```
-
+## Functionality
-
+Props that control component behavior, grouped by surface area.
-### Actions
+### Data
-[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.
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `user` | `CometChat.User` | `undefined` | Sets the user for 1-on-1 call buttons | Pass either `user` or `group`, not both |
+| `group` | `CometChat.Group` | `undefined` | Sets the group for group call buttons | Pass either `user` or `group`, not both |
-##### 1. onError
+### UI Visibility Toggles
-This action doesn't change the behavior of the component but rather listens for any errors that occur in the Call Button component.
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `hideVideoCallButton` | `boolean` | `false` | Hides the video call button | — |
+| `hideVoiceCallButton` | `boolean` | `false` | Hides the voice call button | — |
-
-
-```ts
+### Callbacks
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `onVoiceCallClick` | `(user?: CometChat.User, group?: CometChat.Group) => void` | `undefined` | Overrides the default voice call initiation behavior | — |
+| `onVideoCallClick` | `(user?: CometChat.User, group?: CometChat.Group) => void` | `undefined` | Overrides the default video call initiation behavior | — |
+
+## Actions
+
+[Actions](/ui-kit/react/components-overview#actions) split into predefined (built-in triggers) and user-defined (callbacks).
+
+### Predefined Actions
+
+Clicking a call button initiates a call via the SDK. The component renders `CometChatOutgoingCall` internally.
+
+### User-Defined Actions
+
+#### onError
+
+Fires when the component encounters an error.
+
+| Detail | Value |
+| --- | --- |
+| When it fires | Any internal error during call initiation |
+| Payload type | `(error: CometChat.CometChatException) => void` |
+| What devs typically do next | Log to error tracking service |
+
+```ts lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatCallButtons } from "@cometchat/chat-uikit-react";
-import React from "react";
const CallButtonDemo = () => {
const [chatUser, setChatUser] = React.useState();
React.useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
+ CometChat.getUser("uid").then((user) => setChatUser(user));
}, []);
const handleOnError = (error: CometChat.CometChatException) => {
@@ -84,326 +118,182 @@ const CallButtonDemo = () => {
return ;
};
-
-export default CallButtonDemo;
```
-
+#### onVoiceCallClick
+
+Fires when the voice call button is clicked. Overrides the default voice call initiation.
-
-```js
-import React, { useState, useEffect } from "react";
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks the voice call button |
+| Payload type | `(user?: CometChat.User, group?: CometChat.Group) => void` |
+| What devs typically do next | Custom call initiation logic, pre-call checks |
+
+```ts lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatCallButtons } from "@cometchat/chat-uikit-react";
const CallButtonDemo = () => {
- const [chatUser, setChatUser] = useState(null);
-
- useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
+ const [chatUser, setChatUser] = React.useState();
+ React.useEffect(() => {
+ CometChat.getUser("uid").then((user) => setChatUser(user));
}, []);
- const handleOnError = (error) => {
- console.log("Your Custom on error actions", error);
+ const handleVoiceCallClick = (user?: CometChat.User, group?: CometChat.Group) => {
+ console.log("Voice call clicked", user, group);
};
- return ;
+ return ;
};
-
-export default CallButtonDemo;
```
-
-
-
-
-***
+#### onVideoCallClick
-### Filters
+Fires when the video call button is clicked. Overrides the default video call initiation.
-You can set `CallSettingsBuilder` in the Call Buttons Component to customise the calling experience. To know more about the filters available please refer to [CallSettingsBuilder](/sdk/javascript/direct-call#settings).
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks the video call button |
+| Payload type | `(user?: CometChat.User, group?: CometChat.Group) => void` |
+| What devs typically do next | Custom call initiation logic, pre-call checks |
-
-
-```ts
+```ts lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatCallButtons } from "@cometchat/chat-uikit-react";
-import React from "react";
const CallButtonDemo = () => {
const [chatUser, setChatUser] = React.useState();
-
React.useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
+ CometChat.getUser("uid").then((user) => setChatUser(user));
}, []);
- const getCallSettingsBuilder = (call: CometChat.Call) => {
- return new CometChatCalls.CallSettingsBuilder()
- .setIsAudioOnlyCall(
- call?.getType() === CometChatUIKitConstants.MessageTypes.audio
- ? true
- : false
- )
- .build();
+ const handleVideoCallClick = (user?: CometChat.User, group?: CometChat.Group) => {
+ console.log("Video call clicked", user, group);
};
- return (
-
- );
+ return ;
};
-
-export default CallButtonDemo;
```
-
+## Filters
+
+Set `CallSettingsBuilder` to customize the calling experience. Refer to [CallSettingsBuilder](/sdk/javascript/direct-call#settings).
-
-```js
-import React, { useState, useEffect } from "react";
+```ts lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatCallButtons } from "@cometchat/chat-uikit-react";
const CallButtonDemo = () => {
- const [chatUser, setChatUser] = useState(null);
-
- useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
+ const [chatUser, setChatUser] = React.useState();
+ React.useEffect(() => {
+ CometChat.getUser("uid").then((user) => setChatUser(user));
}, []);
- const getCallSettingsBuilder = (call) => {
+ const getCallSettingsBuilder = (isAudioOnlyCall: boolean, user?: CometChat.User, group?: CometChat.Group) => {
return new CometChatCalls.CallSettingsBuilder()
- .setIsAudioOnlyCall(
- call?.getType() === CometChatUIKitConstants.MessageTypes.audio
- ? true
- : false
- )
+ .setIsAudioOnlyCall(isAudioOnlyCall)
.build();
};
- return (
-
- );
+ return ;
};
-
-export default CallButtonDemo;
```
-
-
-
-
-***
+## Events
-### Events
+### UI Events
-[Events](/ui-kit/react/components-overview#events) are emitted by a `Component`. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
+Events emitted by the CallButtons component:
-The list of events emitted by the `Call Buttons` component is as follows.
+| Event | Source | When it fires |
+| --- | --- | --- |
+| `ccCallRejected` | `CometChatCallEvents` | Initiated call is rejected |
+| `ccCallEnded` | `CometChatCallEvents` | Call ends |
+| `ccOutgoingCall` | `CometChatCallEvents` | User initiates a voice/video call |
+| `ccMessageSent` | `CometChatMessageEvents` | Call message is sent |
-| Event | Description |
-| ------------------ | --------------------------------------------------------------------------------------------------------- |
-| **ccCallRejected** | This event is triggered when the initiated call is rejected by the receiver. |
-| **ccCallEnded** | This event is triggered when the initiated call successfully ends. |
-| **ccOutgoingCall** | This event is triggered when the user initiates a voice/video call. |
-| **ccMessageSent** | This event is triggered when the sent message is in transit and also when it is received by the receiver. |
+#### Subscribe
-***
-
-
-
-```tsx
+```tsx lines
const ccCallRejected = CometChatCallEvents.ccCallRejected.subscribe(
- (call: CometChat.Call) => {
- //Your Code
- }
+ (call: CometChat.Call) => { /* Your Code */ }
);
const ccCallEnded = CometChatCallEvents.ccCallEnded.subscribe(
- (call: CometChat.Call) => {
- //Your Code
- }
+ (call: CometChat.Call) => { /* Your Code */ }
);
const ccOutgoingCall = CometChatCallEvents.ccOutgoingCall.subscribe(
- (call: CometChat.Call) => {
- //Your Code
- }
+ (call: CometChat.Call) => { /* Your Code */ }
);
const ccMessageSent = CometChatMessageEvents.ccMessageSent.subscribe(() => {
- //Your Code
+ /* Your Code */
});
```
-
-
-
+#### Unsubscribe
-***
-
-
-
-```tsx
+```tsx lines
ccCallRejected?.unsubscribe();
-
ccCallEnded?.unsubscribe();
-
ccOutgoingCall?.unsubscribe();
-
ccMessageSent?.unsubscribe();
```
-
+### SDK Events (Real-Time)
-
+The component internally listens to SDK call events for real-time updates. No manual attachment needed.
+
+## Advanced: Custom View Slots
+
+The CallButtons component renders [CometChatOutgoingCall](/ui-kit/react/outgoing-call) internally. Customize the outgoing call sub-component using `OutgoingCallConfiguration`.
-***
+### OutgoingCallConfiguration
-## Customization
+| Property | Type | Description |
+| --- | --- | --- |
+| `customSoundForCalls` | `string` | Custom sound for outgoing calls |
+| `disableSoundForCalls` | `boolean` | Disables outgoing call sound |
+| `onError` | `(error: CometChat.CometChatException) => void` | Error callback |
+| `onCloseClicked` | `() => void` | Cancel button callback |
+| `titleView` | `JSX.Element` | Custom title view |
+| `subtitleView` | `JSX.Element` | Custom subtitle view |
+| `avatarView` | `JSX.Element` | Custom avatar view |
+| `cancelButtonView` | `JSX.Element` | Custom cancel button view |
-To fit your app's design requirements, you can customize the appearance of the Call Buttons component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.
+Refer to [CometChatOutgoingCall](/ui-kit/react/outgoing-call) for details on each property.
-### Style
+## Theme and Styling
-Using CSS you can customize the look and feel of the component in your app like the color, size, shape, and fonts.
+Using CSS, customize the look and feel of the component. The root CSS class is `.cometchat-call-button`.
-**Example**
-
-
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatCallButtons } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const CallButtonDemo = () => {
- const [chatUser, setChatUser] = React.useState();
- React.useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
- }, []);
-
- return ;
-};
-
-export default CallButtonDemo;
-```
-
-
-
-
-```js
-import React, { useState, useEffect } from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatCallButtons } from "@cometchat/chat-uikit-react";
-
-const CallButtonDemo = () => {
- const [chatUser, setChatUser] = useState(null);
-
- useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
- }, []);
-
- return ;
-};
-
-export default CallButtonDemo;
+```tsx lines
+
```
-
-
-
-```css
+```css lines
.cometchat-call-button {
display: flex;
- width: 183px;
- height: 64px;
padding: 8px 16px;
justify-content: center;
align-items: center;
- border-bottom: 1px solid #f5f5f5;
background: #fff;
}
-.cometchat-call-button .cometchat-call-button__voice,
-.cometchat-call-button .cometchat-call-button__video {
- width: auto;
- height: auto;
-}
-
.cometchat .cometchat-button {
- display: flex;
- width: 52px;
- height: 40px;
- justify-content: center;
- padding: 8px 20px;
- align-items: center;
border-radius: 8px;
border: 1px solid #e8e8e8;
background: #edeafa;
}
-.cometchat .cometchat-button:hover {
- background-color: #edeafa;
-}
-
.cometchat-call-button .cometchat-call-button__video .cometchat-button__icon,
.cometchat-call-button .cometchat-call-button__voice .cometchat-button__icon {
- width: 24px;
- height: 24px;
- flex-shrink: 0;
background-color: #6852d6;
}
-```
-
-
-
-
-
-***
-
-## Configurations
-
-Configurations offer the ability to customize the properties of each component within a Composite Component. `CallButtons` component renders [CometChatOutgoingCall](/ui-kit/react/outgoing-call) component.
-
-#### Outgoing Call
-
-You can customize the properties of the `CometChatOutgoingCall` component by making use of the `OutgoingCallConfiguration`. Below properties are available in `OutgoingCallConfiguration`.
-
-| Property | Description | Code |
-| -------------------------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
-| **User** | Sets the user object for Call Buttons | `user={chatUser}` |
-| **Group** | Used to set the group object for Call Buttons | `group={chatGroup}` |
-| **Custom Sound** | Specifies a custom sound to play for outgoing calls. | `customSoundForCalls='Your Custom Sound For Calls'` |
-| **Disable Sound** | Disables the sound of outgoing calls. | `disableSoundForCalls={false}` |
-| **On Error** | Callback function triggered when an error occurs in the call buttons component. | `onError={(error: CometChat.CometChatException)=>{ console.log('error', error) }}` |
-| **Cancel Call Clicked** | Callback function triggered when the cancel button is clicked. | `onCloseClicked={()=>{console.log("Outgoing call canceled")}}` |
-| **Title View** | This prop renders the custom title view for the outgoing call. | `titleView={<>Custom Title View>}` |
-| **Sub Title View** | This prop renders the custom sub title view for the outgoing call. | `subtitleView={<>Custom Sub Title View>}` |
-| **Avatar View** | This prop renders the custom avatar view for the outgoing call. | `avatarView={<>Custom Avatar View>}` |
-| **Cancel Button View** | This prop renders the custom cancel-call button view for the outgoing call. | `cancelButtonView={<>Custom Cancel Button View>}` |
-| **Hide Video Call Button** | Used to hide the video call button. | `hideVideoCallButton={true}` |
-| **Hide Voice Call Button** | Used to hide the voice call button. | `hideVoiceCallButton={true}` |
-
-You can refer to [CometChatOutgoingCall](/ui-kit/react/outgoing-call) component to know more about each of the above properties.
-
-***
+```
\ No newline at end of file
diff --git a/ui-kit/react/call-features.mdx b/ui-kit/react/call-features.mdx
index f9d61886a..2086b7c33 100644
--- a/ui-kit/react/call-features.mdx
+++ b/ui-kit/react/call-features.mdx
@@ -1,10 +1,25 @@
---
title: "Call"
+description: "Overview of CometChat's audio and video calling features including incoming calls, outgoing calls, and call logs — with the UI Kit components that power each feature."
---
+
+- **Packages:** `@cometchat/chat-uikit-react` + `@cometchat/calls-sdk-javascript` (`npm install @cometchat/calls-sdk-javascript`)
+- **Required setup:** `CometChatUIKit.init(UIKitSettings)` then `CometChatUIKit.login("UID")` — Calls SDK must also be installed
+- **Call features:** Incoming Call, Outgoing Call, Call Logs, Call Buttons
+- **Key components:** `CometChatCallButtons` → [Call Buttons](/ui-kit/react/call-buttons), `CometChatIncomingCall` → [Incoming Call](/ui-kit/react/incoming-call), `CometChatOutgoingCall` → [Outgoing Call](/ui-kit/react/outgoing-call), `CometChatCallLogs` → [Call Logs](/ui-kit/react/call-logs)
+- **Auto-detection:** UI Kit automatically detects the Calls SDK and enables call UI components
+- **CSS class prefix:** `.cometchat-`
+
+
## 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 React UI Kit.
+CometChat's Calls feature lets you integrate one-on-one and group audio/video calling into your application. This document provides a technical overview of these features as implemented in the React UI Kit.
+
+
+
+**Before using call components:** Ensure `CometChatUIKit.init(UIKitSettings)` has completed and the user is logged in via `CometChatUIKit.login("UID")`. See [React.js Integration](/ui-kit/react/react-js-integration).
+
## Integration
@@ -14,7 +29,7 @@ Once you've successfully integrated the UI Kit, the next step is to add the Come
Add the SDK files to your project's dependencies or libraries:
-```java
+```bash lines
npm install @cometchat/calls-sdk-javascript
```
@@ -53,3 +68,23 @@ Importantly, the Outgoing Call component is smartly designed to transition autom
+
+
+---
+
+## Next Steps
+
+
+
+ Add audio and video call buttons to your chat
+
+
+ Handle incoming call notifications and UI
+
+
+ Display call history and details
+
+
+ Explore core chat features like messaging and reactions
+
+
diff --git a/ui-kit/react/call-logs.mdx b/ui-kit/react/call-logs.mdx
index 35f786e34..3c6d8901c 100644
--- a/ui-kit/react/call-logs.mdx
+++ b/ui-kit/react/call-logs.mdx
@@ -1,30 +1,35 @@
---
title: "Call Logs"
+description: "Display and manage call history with filtering, custom views, and call-back functionality using the CometChatCallLogs component."
---
-## Overview
-
-`CometChatCallLogs` is a Component that shows the list of Call Log available . By default, names are shown for all listed users, along with their avatar if available.
-
-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. |
+| Field | Value |
+| --- | --- |
+| Purpose | Scrollable list of call history entries with filtering, call-back actions, and custom views |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatCallLogs } from "@cometchat/chat-uikit-react";` |
+| Used in experiences | Call history panel, call log sidebar |
+| Copy-paste base | See [Base Code](#base-code--stylesheet) below |
+| Primary output | Item click (from `onItemClick`), call-back (from `onCallButtonClicked`) |
+| Primary hook points | `onItemClick`, `onCallButtonClicked`, `onError`, `callLogRequestBuilder`, view slots (`subtitleView`, `trailingView`, `leadingView`, `titleView`, `itemView`) |
+| CSS root class | `.cometchat-call-logs` |
+| Real-time events | `CometChatMessageEvents.ccMessageSent` |
-## Usage
+
-### Integration
+## Base Code and Stylesheet
+
+Renders a scrollable list of call log entries.
-```tsx
+```tsx lines
import { CometChatCallLogs } from "@cometchat/chat-uikit-react";
import React from "react";
@@ -34,188 +39,133 @@ const CallLogDemo = () => {
export default CallLogDemo;
```
-
+
-
-```tsx
-import { CallLogDemo } from "./CallLogDemo";
+Root CSS class for style overrides:
-export default function App() {
- return (
-
-
-
-
-
- );
+```css lines
+.cometchat-call-logs {
+ /* overrides here */
}
```
-
+## Functionality
-
+Props that control component behavior, grouped by surface area.
-### Actions
+### Data
-[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.
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `activeCall` | `object` | `undefined` | Highlights the currently active/selected call log entry | — |
+| `title` | `string` | `"Call Logs"` | Sets the header title | — |
-##### 1. onItemClick
+### UI Visibility Toggles
-`onItemClick` is a callback function which triggers when a call log list item is clicked. It does not have a default behavior. However, you can override its behavior using the following code snippet.
-
-
-
-```ts
-import { CometChatCallLogs } from "@cometchat/chat-uikit-react";
-import React from "react";
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `showScrollbar` | `boolean` | `false` | Shows the scrollbar in the list | — |
-const CallLogDemo = () => {
- const handleOnItemClick = (callLog: any) => {
- console.log("custom on item click", callLog);
- };
- return ;
-};
+### Custom Views (Render Props)
-export default CallLogDemo;
-```
+| Property | Type | Effect |
+| --- | --- | --- |
+| `loadingView` | `JSX.Element` | Shown while call logs are loading |
+| `emptyView` | `JSX.Element` | Shown when no call logs are available |
+| `errorView` | `JSX.Element` | Shown when an error occurs |
-
+### Date Formatting
-
-```js
-import { CometChatCallLogs } from "@cometchat/chat-uikit-react";
-import React from "react";
+| Property | Type | Default | Effect |
+| --- | --- | --- | --- |
+| `callInitiatedDateTimeFormat` | `CalendarObject` | `DD MMM, hh:mm A` | Customizes the call initiated timestamp |
-const CallLogDemo = () => {
- const handleOnItemClick = (callLog) => {
- console.log("custom on item click", callLog);
- };
- return ;
-};
+
+If a property is not passed in the CalendarObject, the component checks the [global configuration](/ui-kit/react/localize#customisation) first, then falls back to the component's default formatting.
+
-export default CallLogDemo;
-```
+## Actions
-
+[Actions](/ui-kit/react/components-overview#actions) split into predefined (built-in triggers) and user-defined (callbacks).
-
+### Predefined Actions
-##### 2. onCallButtonClicked
+The component handles list rendering and pagination internally.
-`onCallButtonClicked` is a callback function which triggers when the call button in the trailing view is clicked.
+### User-Defined Actions
-
-
-```ts
-import { CometChatCallLogs } from "@cometchat/chat-uikit-react";
-import React from "react";
+#### onItemClick
-const CallLogDemo = () => {
- const handleOnCallButtonClick = (callLog: any) => {
- console.log("custom on info click", callLog);
- };
- return ;
-};
+Fires when a call log list item is clicked.
-export default CallLogDemo;
-```
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks a call log entry |
+| Payload type | `(callLog: any) => void` |
+| What devs typically do next | Navigate to call details, show call info |
-
-
-
-```js
+```ts lines
import { CometChatCallLogs } from "@cometchat/chat-uikit-react";
-import React from "react";
const CallLogDemo = () => {
- const handleOnCallButtonClick = (callLog) => {
- console.log("custom on info click", callLog);
+ const handleOnItemClick = (callLog: any) => {
+ console.log("custom on item click", callLog);
};
- return ;
+ return ;
};
-
-export default CallLogDemo;
```
-
+#### onCallButtonClicked
-
-
-##### 3. onError
+Fires when the call button in the trailing view is clicked.
-This is a callback function which is triggered when the component encounters an error.
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks the call-back button on a log entry |
+| Payload type | `(callLog: any) => void` |
+| What devs typically do next | Initiate a call-back |
-
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
+```ts lines
import { CometChatCallLogs } from "@cometchat/chat-uikit-react";
-import React from "react";
const CallLogDemo = () => {
- const handleOnError = (error: CometChat.CometChatException) => {
- console.log("your custom on error actions", error);
- };
- return ;
-};
-
-export default CallLogDemo;
-```
-
-
-
-
-```js
-import { CometChatCallLogs } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const CallLogDemo = () => {
- const handleOnError = (error) => {
- console.log("your custom on error actions", error);
+ const handleOnCallButtonClick = (callLog: any) => {
+ console.log("custom on call button click", callLog);
};
- return ;
+ return ;
};
-
-export default CallLogDemo;
```
-
-
-
-
-***
-
-### Filters
-
-**Filters** allow you to customize the data displayed in a list within a `Component`. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using `RequestBuilders` of Chat SDK.
+#### onError
-##### 1. CallLogRequestBuilder
+Fires when the component encounters an error.
-The [CallLogRequestBuilder](/sdk/javascript/call-logs) enables you to filter and customize the Call Log based on available parameters in [CallLogRequestBuilder](/sdk/javascript/call-logs). This feature allows you to create more specific and targeted queries when fetching the call logs. The following are the parameters available in [CallLogRequestBuilder](/sdk/javascript/call-logs)
+| Detail | Value |
+| --- | --- |
+| When it fires | Any internal error during data fetching or rendering |
+| Payload type | `(error: CometChat.CometChatException) => void` |
+| What devs typically do next | Log to error tracking service |
-| Methods | Type | Description |
-| -------------------- | ---------- | ------------------------------------------------------------ |
-| **setLimit** | number | Specifies the number of call logs to fetch. |
-| **setCallType** | String | Sets the type of calls to fetch (call or meet). |
-| **setCallStatus** | callStatus | Sets the status of calls to fetch (initiated, ongoing, etc.) |
-| **setHasRecording** | boolean | Sets whether to fetch calls that have recordings. |
-| **setCallCategory** | string | Sets the category of calls to fetch (call or meet). |
-| **setCallDirection** | string | Sets the direction of calls to fetch (incoming or outgoing) |
-| **setUid** | string | Sets the UID of the user whose call logs to fetch. |
-| **setGuid** | string | Sets the GUID of the user whose call logs to fetch. |
-| **setAuthToken** | string | Sets the Auth token of the logged-in user. |
+## Filters
-**Example**
+Control which call logs appear using `CallLogRequestBuilder`. Refer to [CallLogRequestBuilder](/sdk/javascript/call-logs) for the full API.
-In the example below, we're filtering Call Logs to show only canceled calls and setting the limit to five.
+| Method | Type | Description |
+| --- | --- | --- |
+| `setLimit` | `number` | Number of call logs to fetch |
+| `setCallType` | `string` | Type of calls (call or meet) |
+| `setCallStatus` | `callStatus` | Status filter (initiated, ongoing, etc.) |
+| `setHasRecording` | `boolean` | Filter calls with recordings |
+| `setCallCategory` | `string` | Category filter (call or meet) |
+| `setCallDirection` | `string` | Direction filter (incoming or outgoing) |
+| `setUid` | `string` | Filter by user UID |
+| `setGuid` | `string` | Filter by group GUID |
+| `setAuthToken` | `string` | Auth token of the logged-in user |
-
-
-```ts
+```ts lines
import { CallLogRequestBuilder } from "@cometchat/calls-sdk-javascript";
import { CometChatCallLogs } from "@cometchat/chat-uikit-react";
-import React from "react";
const CallLogDemo = () => {
return (
@@ -227,925 +177,282 @@ const CallLogDemo = () => {
/>
);
};
-
-export default CallLogDemo;
```
-
+## Events
-
-```js
-import { CallLogRequestBuilder } from "@cometchat/calls-sdk-javascript";
-import { CometChatCallLogs } from "@cometchat/chat-uikit-react";
-import React from "react";
+### UI Events
-const CallLogDemo = () => {
- return (
-
- );
-};
-
-export default CallLogDemo;
-```
+| Event | Source | When it fires |
+| --- | --- | --- |
+| `ccMessageSent` | `CometChatMessageEvents` | Call message is sent |
-
+#### Subscribe
-
-
-***
-
-### Events
-
-[Events](/ui-kit/react/components-overview#events) are emitted by a `Component`. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
-
-The list of events emitted by the `Call Logs` component is as follows.
-
-| Event | Description |
-| ----------------- | --------------------------------------------------------------------------------------------------------- |
-| **ccMessageSent** | This event is triggered when the sent message is in transit and also when it is received by the receiver. |
-
-***
-
-
-
-```tsx
+```tsx lines
const ccMessageSent = CometChatMessageEvents.ccMessageSent.subscribe(() => {
//Your Code
});
```
-
+#### Unsubscribe
-
-
-***
-
-
-
-```tsx
+```tsx lines
ccMessageSent?.unsubscribe();
```
-
+### SDK Events (Real-Time)
-
+The component internally listens to SDK events for real-time updates. No manual attachment needed.
-***
-## Customization
+## Advanced: Custom View Slots
-To fit your app's design requirements, you can customize the appearance of the Call Logs component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.
+Customization override points for the call logs UI.
-### Style
+### Slot Catalog
-Using CSS you can customize the look and feel of the component in your app like the color, size, shape, and fonts.
+| Slot | Params | What it replaces | Section |
+| --- | --- | --- | --- |
+| `itemView` | `(callLog: any) => JSX.Element` | Entire call log list item | Whole item |
+| `leadingView` | `(callLog: any) => JSX.Element` | Avatar / left section | Sub-section (leading) |
+| `trailingView` | `(callLog: any) => JSX.Element` | Right section (call-back button area) | Sub-section (trailing) |
+| `titleView` | `(callLog: any) => JSX.Element` | Name / title text | Sub-section (title) |
+| `subtitleView` | `(callLog: any) => JSX.Element` | Subtitle text (call type, duration) | Sub-section (subtitle) |
-**Example:**
+### itemView
-
-
-
+Replace the entire call log list item.
-```ts
-import { CometChatCallLogs } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const CallLogDemo = () => {
- return ;
-};
-
-export default CallLogDemo;
-```
-
-
-
-
-```js
+```ts lines
import { CometChatCallLogs } from "@cometchat/chat-uikit-react";
-import React from "react";
-const CallLogDemo = () => {
- return ;
+const getItemView = (callLog: any) => {
+ return (
+
+
+ {callLog?.getInitiator()?.getName()}
+
+
+ {callLog?.getStatus()}
+
+
+ );
};
-export default CallLogDemo;
+;
```
-
-
-
-```css
-.cometchat .cometchat-call-logs .cometchat-list__header-title {
- background-color: #fce9ea;
- color: #f76808;
- border: 0px 1px 1px 0px solid #e5484d;
- font-family: "Times New Roman";
-}
-
-.cometchat .cometchat-call-logs .cometchat-list-item__body-title {
- overflow: hidden;
- color: #141414;
- text-overflow: ellipsis;
- font-family: "Times New Roman";
- font-size: 16px;
- font-style: normal;
- font-weight: 400;
- line-height: 19.2px;
-}
-
-.cometchat .cometchat-call-logs .cometchat-list-item__body-subtitle {
- overflow: hidden;
- color: #727272;
- text-overflow: ellipsis;
- white-space: nowrap;
- font-family: "Times New Roman";
- font-size: 14px;
- font-style: normal;
- font-weight: 400;
- line-height: 16.8px;
+
+```css lines
+.custom-call-log-item {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 8px 16px;
+ border-bottom: 1px solid var(--cometchat-border-color-light);
}
-.cometchat .cometchat-call-logs .cometchat-avatar {
- border-radius: 8px;
- background: #fbaa75;
+.custom-call-log-item__name {
+ font: var(--cometchat-font-heading4-medium);
+ color: var(--cometchat-text-color-primary);
}
-.cometchat .cometchat-call-logs .cometchat-avatar__image {
- border-radius: 8px;
+.custom-call-log-item__status {
+ font: var(--cometchat-font-body-regular);
+ color: var(--cometchat-text-color-secondary);
}
```
-
-
-***
-
-### 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.
+### subtitleView
-Here is a code snippet demonstrating how you can customize the functionality of the `Call Logs` component.
+Replace the subtitle text (call type, duration).
-```ts
+```ts lines
import { CometChatCallLogs } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const CallLogDemo = () => {
- return ;
-};
-
-export default CallLogDemo;
-```
-
-
-
-```js
-import { CometChatCallLogs } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const CallLogDemo = () => {
- return ;
+const getSubtitleView = (callLog: any) => {
+ return (
+
+ {callLog?.getStatus()} • {callLog?.getType()}
+
+ );
};
-export default CallLogDemo;
+;
```
-
-
-
-
-Below is a list of customizations along with corresponding code snippets
-
-| Property | Description | Code |
-| ------------------ | --------------------------------------------------------------------------- | ----------------------------------------------------------------- |
-| **Active Call** | Object representing the active call that is currently selected. | `activeCall={call}` |
-| **Show Scrollbar** | Controls the visibility of the scrollbar in the list. | `showScrollbar={true}` |
-| **Loading View** | A custom view to display when call logs are being loaded. | `loadingView={<>Custom Loading View>}` |
-| **Empty View** | A custom view to display when no call logs are available. | `emptyView={<>Custom Empty View>}` |
-| **Error View** | A custom view to display when an error occurs while fetching the call logs. | `errorView={<>Custom Error View>}` |
-| **Item View** | A function that renders a JSX element to display the item view. | `itemView={(call) => { return (<>Custom Item View>)}}` |
-| **Leading View** | A function that renders a JSX element to display the leading view. | `leadingView={(call) => { return (<>Custom Leading View>)}}` |
-| **Title View** | A function that renders a JSX element to display the title view. | `titleView={(call) => { return (<>Custom Title View>)}}` |
-| **Sub Title View** | A function that renders a JSX element to display the subtitle view. | `subtitleView={(call) => { return (<>Custom Sub Title View>)}}` |
-| **Trailing View** | A function that renders a JSX element to display the trailing view. | `trailingView={(call) => { return (<>Custom Trailing View>)}}` |
-
-***
-
-### 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.
-
-***
-
-#### Call Initiated Date Time Format
-
-The `callInitiatedDateTimeFormat` property allows you to customize the **Call Initiated** timestamp displayed in the call logs.
-
-Default Date Time Format:
-
-```ruby
-new CalendarObject({
- today: `DD MMM, hh:mm A`, // Example: "25 Jan, 10:30 AM"
- yesterday: `DD MMM, hh:mm A`, // Example: "25 Jan, 10:30 AM"
- otherDays: `DD MMM, hh:mm A`, // Example: "25 Jan, 10:30 AM"
-});
-```
-
-The following example demonstrates how to modify the **Call Initiated** timestamp format using a custom [`CalendarObject`](/ui-kit/react/localize#calendarobject).
-
-
-
-```ts
-import { CometChatCallLogs, CalendarObject } from "@cometchat/chat-uikit-react";
-
-// 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/05/2025"
- });
- return dateFormat;
+
+```css lines
+.custom-call-log-subtitle {
+ font: var(--cometchat-font-body-regular);
+ color: var(--cometchat-text-color-secondary);
}
-
-// Apply the custom format to the CometChatCallLogs component
-;
```
-
-
-
-
-**Fallback Mechanism**
+### trailingView
-* If you **do not** pass any property in the [**CalendarObject**](/ui-kit/react/localize#calendarobject), the component will first check the [**global configuration**](/ui-kit/react/localize#customisation). If the property is **also missing in the global configuration**, it will **fallback to the component's default formatting**.
-
-
-
-***
-
-#### ItemView
-
-With this property, you can assign a custom ListItem to the Call Logs Component.
-
-Shown below is the default chat interface.
-
-
-
-
-
-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).
-```ts
-import {
- CometChatCallLogs,
- CometChatUIKitLoginListener,
- isMissedCall,
- isSentByMe,
- verifyCallUser,
-} from "@cometchat/chat-uikit-react";
+```ts lines
import { CometChatCallLogs } from "@cometchat/chat-uikit-react";
-const CallLogDemo = () => {
- const getItemView = (call: any) => {
- const missedCall = isMissedCall(
- call,
- CometChatUIKitLoginListener?.getLoggedInUser()!
- );
- const isCallSentByMe = isSentByMe(
- call,
- CometChatUIKitLoginListener?.getLoggedInUser()!
- );
-
- let callStatus = missedCall
- ? "Missed Call"
- : isCallSentByMe
- ? "Outgoing Call"
- : "Incoming Call";
-
- let callIcon = missedCall
- ? missedIcon
- : isCallSentByMe
- ? outgoingIcon
- : incomingIcon;
-
- function formatDate(timestamp: number) {
- // Convert the timestamp from seconds to milliseconds
- const date = new Date(timestamp * 1000);
-
- // Define options for formatting
- const options: Object = {
- day: "2-digit",
- month: "short",
- hour: "2-digit",
- minute: "2-digit",
- hour12: true,
- };
-
- // Format the date with the specified options
- return date.toLocaleDateString("en-GB", options);
- }
-
- return (
-
- );
- };
-
- return ;
-};
-
-export default CallLogDemo;
-```
-
-
-
-
-```css
-.call-log-title {
- overflow: hidden;
+.cometchat-call-logs .cometchat-list-item__title {
color: #141414;
- text-overflow: ellipsis;
- white-space: nowrap;
font: 500 16px Roboto;
}
```
-
-
-
-
diff --git a/ui-kit/react/components-overview.mdx b/ui-kit/react/components-overview.mdx
index dfc456255..37f64a1a8 100644
--- a/ui-kit/react/components-overview.mdx
+++ b/ui-kit/react/components-overview.mdx
@@ -1,29 +1,131 @@
---
title: "Overview"
+description: "Browse all prebuilt UI components in the CometChat React UI Kit — conversations, messages, users, groups, calls, search, and AI."
---
-CometChat's **UI Kit** is a set of pre-built UI components that allows you to easily craft an in-app chat with all the essential messaging features.
+
-## Actions
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Required setup | `CometChatUIKit.init()` + `CometChatUIKit.login()` before rendering any component |
+| Callback actions | `on={(param) => {}}` |
+| Data filtering | `RequestBuilder={new CometChat.RequestBuilder()}` |
+| Toggle features | `hide={true}` or `show={true}` |
+| Custom rendering | `View={() => JSX}` |
+| CSS overrides | Target `.cometchat-` class in global CSS |
+| Calling | Requires separate `@cometchat/calls-sdk-javascript` package |
-Actions direct the operational behavior of a component. They are split into two categories: Predefined Actions and User-Defined Actions.
+
-### Predefined Actions
+## Component Catalog
-These are actions that are inherently programmed into a UI component. They are ingrained in the component itself by default, and they execute automatically in response to user interaction, without needing any additional user input.
+All components are imported from `@cometchat/chat-uikit-react`.
-### User-Defined Actions
+### Conversations and Lists
-These are actions that must be explicitly specified by the user. They are not innately part of the component like predefined actions. Instead, they must be developed based on the unique needs of the user or the application. User-defined actions provide adaptability and allow for the creation of custom behaviors that align with the individual needs of the application.
+| Component | Purpose | Key Props | Page |
+| --- | --- | --- | --- |
+| CometChatConversations | Scrollable list of recent conversations | `conversationsRequestBuilder`, `onItemClick`, `onError` | [Conversations](/ui-kit/react/conversations) |
+| CometChatUsers | Scrollable list of users | `usersRequestBuilder`, `onItemClick`, `onError` | [Users](/ui-kit/react/users) |
+| CometChatGroups | Scrollable list of groups | `groupsRequestBuilder`, `onItemClick`, `onError` | [Groups](/ui-kit/react/groups) |
+| CometChatGroupMembers | Scrollable list of group members | `group`, `groupMemberRequestBuilder`, `onItemClick` | [Group Members](/ui-kit/react/group-members) |
-To customize the behavior of a component, actions can be overridden by you. This provides you with control over how the component responds to specific events or interactions.
+### Messages
-All components expose actions to the user, which means that users can interact with these types of components through predefined or user-defined actions.
+| Component | Purpose | Key Props | Page |
+| --- | --- | --- | --- |
+| CometChatMessageHeader | Toolbar with avatar, name, status, typing indicator | `user`, `group`, `enableAutoSummaryGeneration` | [Message Header](/ui-kit/react/message-header) |
+| CometChatMessageList | Scrollable message list with reactions, receipts, threads | `user`, `group`, `messagesRequestBuilder`, `goToMessageId` (string) | [Message List](/ui-kit/react/message-list) |
+| CometChatMessageComposer | Rich text input with attachments, mentions, voice notes | `user`, `group`, `onSendButtonClick`, `placeholderText` | [Message Composer](/ui-kit/react/message-composer) |
+| CometChatMessageTemplate | Pre-defined structure for custom message bubbles | `type`, `category`, `contentView`, `headerView`, `footerView` | [Message Template](/ui-kit/react/message-template) |
+| CometChatThreadHeader | Parent message bubble and reply count for threaded view | `parentMessage`, `onClose`, `hideReceipts`, `textFormatters` | [Thread Header](/ui-kit/react/thread-header) |
-***
+### Calling
-## Events
+| Component | Purpose | Key Props | Page |
+| --- | --- | --- | --- |
+| CometChatCallButtons | Voice and video call initiation buttons | `user`, `group`, `onVoiceCallClick`, `onVideoCallClick` | [Call Buttons](/ui-kit/react/call-buttons) |
+| CometChatIncomingCall | Incoming call notification with accept/decline | `call`, `onAccept(call)`, `onDecline(call)` | [Incoming Call](/ui-kit/react/incoming-call) |
+| CometChatOutgoingCall | Outgoing call screen with cancel control | `call`, `onCloseClicked` | [Outgoing Call](/ui-kit/react/outgoing-call) |
+| CometChatCallLogs | Scrollable list of call history | `callLogsRequestBuilder`, `onItemClick` | [Call Logs](/ui-kit/react/call-logs) |
-Events allow for a decoupled, flexible architecture where different parts of the application can interact without having to directly reference each other. This makes it easier to create complex, interactive experiences, as well as to extend and customize the functionality provided by the CometChat UI Kit.
+### Search and AI
-All Components have the ability to emit events. These events are dispatched in response to certain changes or user interactions within the component. By emitting events, these components allow other parts of the application to react to changes or interactions, thus enabling dynamic and interactive behavior within the application.
+| Component | Purpose | Key Props | Page |
+| --- | --- | --- | --- |
+| CometChatSearch | Real-time search across conversations and messages | `onConversationClicked(conversation, searchKeyword?)`, `onMessageClicked(message, searchKeyword?)`, `uid`, `guid`, `textFormatters` | [Search](/ui-kit/react/search) |
+| CometChatAIAssistantChat | AI agent chat with streaming, suggestions, history | `user`, `onSendButtonClick(message, previewMessageMode?)`, `aiAssistantTools` | [AI Assistant Chat](/ui-kit/react/ai-assistant-chat) |
+
+## Component API Pattern
+
+All components share a consistent API surface.
+
+### Actions
+
+Actions control component behavior. They split into two categories:
+
+**Predefined Actions** are built into the component and execute automatically on user interaction (e.g., clicking send dispatches the message). No configuration needed.
+
+**User-Defined Actions** are callback props that fire on specific events. Override them to customize behavior:
+
+```tsx lines
+ openThreadPanel(message)}
+ onError={(error) => logError(error)}
+/>
+```
+
+### Events
+
+Events enable decoupled communication between components. A component emits events that other parts of the application can subscribe to without direct references.
+
+```tsx lines
+import { CometChatMessageEvents } from "@cometchat/chat-uikit-react";
+
+const sub = CometChatMessageEvents.ccMessageSent.subscribe((message) => {
+ // react to sent message
+});
+
+// cleanup
+sub?.unsubscribe();
+```
+
+Each component page documents its emitted events in the Events section.
+
+### Filters
+
+List-based components accept `RequestBuilder` props to control which data loads:
+
+```tsx lines
+
+```
+
+### Custom View Slots
+
+Components expose named view slots to replace sections of the default UI:
+
+```tsx lines
+}
+ subtitleView={}
+ leadingView={}
+/>
+```
+
+### CSS Overrides
+
+Every component has a root CSS class (`.cometchat-`) for style customization:
+
+```css lines
+.cometchat-message-list .cometchat-text-bubble__body-text {
+ font-family: "SF Pro";
+}
+```
diff --git a/ui-kit/react/conversations.mdx b/ui-kit/react/conversations.mdx
index a148e2bb6..923a59f2e 100644
--- a/ui-kit/react/conversations.mdx
+++ b/ui-kit/react/conversations.mdx
@@ -1,24 +1,35 @@
---
title: "Conversations"
+description: "Display and manage the list of recent conversations for the logged-in user using the CometChatConversations component in the React UI Kit."
---
-## Overview
+
+
+
-The Conversations is a Component, that shows all conversations related to the currently logged-in user.
+
-This component lists the most recent or latest conversations or contacts with whom you have exchanged messages. It provides a convenient way to quickly access and resume conversations with the people you have been in contact with recently.
+| Field | Value |
+| --- | --- |
+| Purpose | Scrollable list of recent one-on-one and group conversations for the logged-in user |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatConversations } from "@cometchat/chat-uikit-react";` |
+| Used in experiences | [One-to-one chat](/ui-kit/react/react-js-integration), Tab-based chat, Conversations + Messages layout |
+| Copy-paste base | See [Base Code](#base-code--stylesheet) below |
+| Primary output | `CometChat.Conversation` object (from `onItemClick`) |
+| Primary hook points | `onItemClick`, `onSelect`, `onError`, `onSearchBarClicked`, `conversationsRequestBuilder`, view slots (`itemView`, `subtitleView`, `trailingView`, `leadingView`, `headerView`, `titleView`) |
+| CSS root class | `.cometchat-conversations` |
+| Real-time events | `CometChatConversationEvents.ccConversationDeleted`, `CometChatConversationEvents.ccUpdateConversation`, `CometChatConversationEvents.ccMarkConversationAsRead` |
-
-
-
+
-## Usage
+## Base Code and Stylesheet
-### Integration
+Renders a scrollable list of recent conversations.
-```tsx
+```tsx lines
import {
CometChatConversations,
TitleAlignment,
@@ -36,11 +47,9 @@ function ConversationsDemo() {
export default ConversationsDemo;
```
-
-
-```tsx
+```tsx lines
import { ConversationsDemo } from "./ConversationsDemo";
export default function App() {
@@ -51,23 +60,90 @@ export default function App() {
);
}
```
-
-
-### Actions
+Root CSS class for style overrides:
-[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.
+```css lines
+.cometchat-conversations {
+ /* overrides here */
+}
+```
-#### 1. OnItemClick
+## Functionality
-`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.
+Small functional customizations for fine-tuning the component experience — text, icons, and UI element visibility.
-
-
-```tsx
+Props that control component behavior, grouped by surface area.
+
+### Data and Loading
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `conversationsRequestBuilder` | `CometChat.ConversationsRequestBuilder` | SDK default (30 per page) | Controls which conversations load and in what order | Forgetting `.build()` is not needed — pass the builder, not the built request |
+| `activeConversation` | `CometChat.Conversation` | `undefined` | Highlights the specified conversation in the list | Must be a reference-equal object from the SDK; a manually constructed object won't match |
+
+### Selection Behavior
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `selectionMode` | `SelectionMode` | `SelectionMode.none` | Enables single or multi-select checkboxes on list items | Must pair with `onSelect` to capture selections |
+
+### UI Visibility Toggles
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `hideReceipts` | `boolean` | `false` | Hides message read/delivery receipt indicators | — |
+| `hideError` | `boolean` | `false` | Hides the default and custom error views | Also suppresses `errorView` if set |
+| `hideDeleteConversation` | `boolean` | `false` | Hides the delete option in the context menu | — |
+| `hideUserStatus` | `boolean` | `false` | Hides online/offline status indicator | — |
+| `hideGroupType` | `boolean` | `false` | Hides the group type icon | — |
+| `showSearchBar` | `boolean` | `false` | Shows a search bar at the top of the list | — |
+| `showScrollbar` | `boolean` | `false` | Shows the scrollbar in the conversation list | — |
+
+### State and UX Behavior
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `disableSoundForMessages` | `boolean` | `false` | Disables the notification sound for incoming messages | — |
+| `customSoundForMessages` | `string` | built-in sound | URL to a custom audio file for incoming message notifications | Must be a valid audio URL accessible from the browser |
+
+### Custom Views (Render Props)
+
+These replace sections of the default UI. See [Custom View Slots](#custom-view-slots) for full examples.
+
+| Property | Type | Effect |
+| --- | --- | --- |
+| `searchView` | `JSX.Element` | Replaces the default search bar |
+| `loadingView` | `JSX.Element` | Shown while conversations are loading |
+| `emptyView` | `JSX.Element` | Shown when there are no conversations |
+| `errorView` | `JSX.Element` | Shown when an error occurs |
+
+
+## Actions
+
+[Actions](/ui-kit/react/components-overview#actions) split into predefined (built-in triggers) and user-defined (callbacks).
+
+### Predefined Actions
+
+Devs can specify custom behavior for predefined actions like navigation or routing.
+
+### User-Defined Actions
+
+#### onItemClick
+
+Fires when a user taps a conversation row. Primary navigation hook — typically used to set the active conversation and render the message view.
+
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks/taps a conversation list item |
+| Payload type | `(conversation: CometChat.Conversation) => void` |
+| What devs typically do next | Set active conversation in state, navigate to message view |
+
+```tsx lines
import { CometChatConversations } from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
const getOnItemClick = (conversation: CometChat.Conversation) => {
console.log("ItemClick:", conversation);
@@ -77,23 +153,22 @@ const getOnItemClick = (conversation: CometChat.Conversation) => {
;
```
-
-
-
-
-***
+#### onSelect
-#### 2. OnSelect
+Fires when a conversation is selected or deselected in multi-select mode. Requires `selectionMode` to be set.
-The `OnSelect` event is triggered upon the completion of a selection in `SelectionMode`. It does not have a default behavior. However, you can override its behavior using the following code snippet.
+| Detail | Value |
+| --- | --- |
+| When it fires | User checks/unchecks a conversation in selection mode |
+| Payload type | `(conversation: CometChat.Conversation, selected: boolean) => void` |
+| What devs typically do next | Track selected conversations for batch operations (delete, mute) |
-
-
-```tsx
+```tsx lines
import {
CometChatConversations,
SelectionMode,
} from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
const getOnSelect = (
conversation: CometChat.Conversation,
@@ -109,20 +184,19 @@ const getOnSelect = (
/>;
```
-
-
-
-
-***
+#### onError
-#### 3. OnError
+Fires when the component encounters an error (network failure, auth issue, etc.).
-This action doesn't change the behavior of the component but rather listens for any errors that occur in the Conversations component.
+| Detail | Value |
+| --- | --- |
+| When it fires | Any internal error during data fetching or rendering |
+| Payload type | `(error: CometChat.CometChatException) => void` |
+| What devs typically do next | Log to error tracking service, show custom toast |
-
-
-```tsx
+```tsx lines
import { CometChatConversations } from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
const handleOnError = (error: CometChat.CometChatException) => {
// Your exception handling code
@@ -131,19 +205,17 @@ const handleOnError = (error: CometChat.CometChatException) => {
;
```
-
-
-
-
-***
+#### onSearchBarClicked
-#### 4. onSearchBarClicked
+Fires when the user clicks the search bar (requires `showSearchBar={true}`).
-The `onSearchBarClicked` event is triggered when the user clicks the search bar. It does not have a default behavior. However, you can override its behavior using the following code snippet.
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks/focuses the search bar |
+| Payload type | `() => void` |
+| What devs typically do next | Open a custom search overlay, track analytics |
-
-
-```tsx
+```tsx lines
import { CometChatConversations } from "@cometchat/chat-uikit-react";
const handleSearchClick = () => {
@@ -153,28 +225,26 @@ const handleSearchClick = () => {
;
```
-
-
-
+## Filters
-***
+Control which conversations appear using `ConversationsRequestBuilder`. Pass the builder (not a built request) to the `conversationsRequestBuilder` prop.
-### Filters
+Refer to [ConversationRequestBuilder](/sdk/javascript/retrieve-conversations) for the full API.
-You can set `ConversationsRequestBuilder` in the Conversations Component to filter the conversation list. You can modify the builder as per your specific requirements with multiple options available to know more refer to [ConversationRequestBuilder](/sdk/javascript/retrieve-conversations).
+### Filter Recipes
-You can set filters using the following parameters.
+| Recipe | Code |
+| --- | --- |
+| Only user conversations | `new CometChat.ConversationsRequestBuilder().setConversationType("user")` |
+| Only group conversations | `new CometChat.ConversationsRequestBuilder().setConversationType("group")` |
+| Limit to 10 per page | `new CometChat.ConversationsRequestBuilder().setLimit(10)` |
+| With specific tags | `new CometChat.ConversationsRequestBuilder().setTags(["vip"])` |
+| Filter by user tags | `new CometChat.ConversationsRequestBuilder().withUserAndGroupTags(true).setUserTags(["premium"])` |
+| Filter by group tags | `new CometChat.ConversationsRequestBuilder().withUserAndGroupTags(true).setGroupTags(["support"])` |
-1. **Conversation Type:** Filters on type of Conversation, `User` or `Groups`
-2. **Limit:** Number of conversations fetched in a single request.
-3. **WithTags:** Filter on fetching conversations containing tags
-4. **Tags:** Filters on specific `Tag`
-5. **UserTags:** Filters on specific User `Tag`
-6. **GroupTags:** Filters on specific Group `Tag`
+### Example
-
-
-```tsx
+```tsx lines
import { CometChatConversations } from "@cometchat/chat-uikit-react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
@@ -185,164 +255,117 @@ import { CometChat } from "@cometchat/chat-sdk-javascript";
/>;
```
-
-
-
-
-***
-
-### Events
-
-[Events](/ui-kit/react/components-overview#events) are emitted by a `Component`. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
-
-
-
-```tsxtsx
-const ccConversationDeleted =
- CometChatConversationEvents.ccConversationDeleted.subscribe(
- (conversation: CometChat.Conversation) => {
- // Your code here
- }
- );
-```
-
-
+### Performance Note
-
+The default page size is 30. Reducing it with `setLimit` can improve initial load time on slower connections. The component uses infinite scroll — the next page loads automatically as the user scrolls to the bottom.
-***
-
-
-```tsxtsx
-ccConversationDeleted?.unsubscribe();
-```
+## Events
-
+### UI Events
-
+The CometChatConversations component emits events via `CometChatConversationEvents`. Global events — subscribable from anywhere in the application.
-## Customization
+| Event | When it fires | Payload type |
+| --- | --- | --- |
+| `CometChatConversationEvents.ccConversationDeleted` | A conversation is deleted from the list | `CometChat.Conversation` |
+| `CometChatConversationEvents.ccUpdateConversation` | A conversation is updated (e.g., last message change, metadata update) | `CometChat.Conversation` |
+| `CometChatConversationEvents.ccMarkConversationAsRead` | A conversation is marked as read | `CometChat.Conversation` |
-To fit your app's design requirements, you can customize the appearance of the conversation component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.
+#### Subscribe
-### Style
+```tsx lines
+import { CometChatConversationEvents } from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
-Using CSS you can customize the look and feel of the component in your app like the color, size, shape, and fonts.
+const deletedSub = CometChatConversationEvents.ccConversationDeleted.subscribe(
+ (conversation: CometChat.Conversation) => {
+ console.log("Conversation deleted:", conversation.getConversationId());
+ }
+);
-
-
-
+const updatedSub = CometChatConversationEvents.ccUpdateConversation.subscribe(
+ (conversation: CometChat.Conversation) => {
+ console.log("Conversation updated:", conversation.getConversationId());
+ }
+);
-
-
-```tsx
-
+const readSub = CometChatConversationEvents.ccMarkConversationAsRead.subscribe(
+ (conversation: CometChat.Conversation) => {
+ console.log("Conversation marked as read:", conversation.getConversationId());
+ }
+);
```
-
-
-
-```css
-.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";
-}
-
-.cometchat-conversations .cometchat-list__header-title {
- background: #fef8f8;
- border-bottom: 2px solid #f4b6b8;
-}
-
-.cometchat-conversations .cometchat-avatar {
- background: #f0999b;
-}
-
-.cometchat-conversations .cometchat-status-indicator {
- min-width: 10px;
- height: 10px;
-}
-
-.cometchat-conversations .cometchat-badge {
- background: #e5484d;
-}
+#### Unsubscribe
-.cometchat-conversations .cometchat-receipts-read {
- background: #e96b6f;
-}
+```tsx lines
+// In useEffect cleanup or component unmount
+deletedSub?.unsubscribe();
+updatedSub?.unsubscribe();
+readSub?.unsubscribe();
```
-
-
-
+### SDK Events (Real-Time)
-### Functionality
+The component automatically listens to these SDK events internally for real-time updates. No manual attachment needed unless additional side effects are required.
-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.
+| SDK Listener | What it does inside the component |
+| --- | --- |
+| `onTextMessageReceived` / `onMediaMessageReceived` / `onCustomMessageReceived` | Moves the conversation to the top, updates last message preview and unread count |
+| `onTypingStarted` / `onTypingEnded` | Shows/hides typing indicator in the subtitle |
+| `onMessagesDelivered` / `onMessagesRead` | Updates receipt ticks (unless `hideReceipts={true}`) |
+| `onUserOnline` / `onUserOffline` | Updates the online/offline status dot (unless `hideUserStatus={true}`) |
+| `onMemberAddedToGroup` / `onGroupMemberLeft` / etc. | Updates group conversation metadata |
-
-
-```tsx
-
-
-
-
-
-```
+#### Automatic updates vs. manual refresh
-
+- Automatic: new messages, typing indicators, receipts, user presence, group membership changes
+- Manual: deleting a conversation via the SDK directly (not through the component's context menu) requires emitting `CometChatConversationEvents.ccConversationDeleted` for the UI to update
-
+#### React StrictMode Note
-Below is a list of customizations along with corresponding code snippets
+In React 18 StrictMode, `useEffect` runs twice on mount in development. SDK listeners may be registered twice. The component handles cleanup internally, but any additional listeners added alongside the component need cleanup in the `useEffect` return function to avoid duplicate event handling.
-| Property | Description | Code |
-| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
-| **Hide Receipts** | Disables the display of message read receipts. If set to `true`, the receipt status of the sent message won't be displayed. | `hideReceipts={false}` |
-| **Hide Error** | Hides the default and the custom error view passed in the `errorView` prop. | `hideError={true}` |
-| **Hide Delete Conversation** | Hides the delete conversation option in the default context menu. | `hideDeleteConversation={false}` |
-| **Hide User Status** | Hides the user's online/offline status indicator. | `hideUserStatus={true}` |
-| **Hide Group Type** | Hides the group type icon. | `hideGroupType={false}` |
-| **Show Search Bar** | Shows the search bar. | `showSearchBar={true}` |
-| **Active Conversation** | Specifies the conversation to highlight in the list. | `activeConversation={activeConversation}` |
-| **Selection Mode** | Determines the selection mode for the component. | `selectionMode={SelectionMode.multiple}` |
-| **Disable Sound For Messages** | Used to Disable sound for incoming messages. | `disableSoundForMessages={false}` |
-| **Custom Sound For Messages** | Custom audio sound for incoming messages. | `customSoundForMessages="Your custom sound url"` |
-| **Search View** | A custom search view which replaces the default search bar. | `searchView={<>Custom Search View>}` |
-| **Loading View** | A custom component to display during the loading state. | `loadingView={<>Custom Loading View>}` |
-| **Empty View** | A custom component to display when there are no conversations available. | `emptyView={<>Custom Empty View>}` |
-| **Error View** | A custom component to display when an error occurs. | `errorView={<>Custom Error View>}` |
+## Advanced: Custom View Slots
-### Advanced
+Customization override points for the conversation list UI. Each slot receives the conversation object and returns JSX.
-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.
+### Slot Catalog
-***
+| Slot | Params | What it replaces | Section |
+| --- | --- | --- | --- |
+| `itemView` | `(conversation: CometChat.Conversation) => JSX.Element` | Entire list item row | Whole item |
+| `leadingView` | `(conversation: CometChat.Conversation) => JSX.Element` | Avatar / left section | Sub-section (leading) |
+| `trailingView` | `(conversation: CometChat.Conversation) => JSX.Element` | Timestamp / badge / right section | Sub-section (trailing) |
+| `titleView` | `(conversation: CometChat.Conversation) => JSX.Element` | Name / title text | Sub-section (title) |
+| `subtitleView` | `(conversation: CometChat.Conversation) => JSX.Element` | Last message preview text | Sub-section (subtitle) |
+| `headerView` | `JSX.Element` | Entire header bar | Whole section |
+| `searchView` | `JSX.Element` | Search bar | Whole section |
+| `loadingView` | `JSX.Element` | Loading spinner | Empty/loading/error |
+| `emptyView` | `JSX.Element` | Empty state | Empty/loading/error |
+| `errorView` | `JSX.Element` | Error state | Empty/loading/error |
+| `options` | `(conversation: CometChat.Conversation) => CometChatOption[]` | Context menu / hover actions | Whole item |
-#### ItemView
+### itemView
-With this function, you can assign a custom ListItem to the Conversations Component.
+Replace the entire list item row.
-Shown below is the default chat interface.
+Default:
-The customized chat interface is displayed below.
+Customized:
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import {
CometChatListItem,
@@ -370,11 +393,9 @@ const getItemView = (conversation: CometChat.Conversation) => {
itemView={getItemView} // Custom list item view
/>;
```
-
-
-
-```css
+
+```css lines
.cometchat-conversations .cometchat-avatar {
border-radius: 8px;
width: 32px;
@@ -385,26 +406,18 @@ const getItemView = (conversation: CometChat.Conversation) => {
gap: 4px;
}
```
-
-
-***
+### leadingView
-#### LeadingView
-
-The customized chat interface is displayed below.
+Replace the avatar / left section. Typing-aware avatar example.
-Use the following code to achieve the customization shown above.
-
-
-
-```ts
+```ts lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import {
@@ -473,25 +486,17 @@ const CustomLeadingView = (conversation: CometChat.Conversation) => {
;
```
-
-
-
-
-***
+### trailingView
-#### TrailingView
-
-The customized chat interface is displayed below.
+Replace the timestamp / badge / right section. Relative time badge example.
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatConversations } from "@cometchat/chat-uikit-react";
@@ -539,11 +544,9 @@ const CustomTrailingButtonView = (conv: CometChat.Conversation) => {
;
```
-
-
-
-```css
+
+```css lines
.conversations__trailing-view {
display: flex;
flex-direction: column;
@@ -584,226 +587,156 @@ const CustomTrailingButtonView = (conv: CometChat.Conversation) => {
height: 50px;
}
```
-
-
-***
-#### TextFormatters
+### titleView
-Assigns the list of text formatters. If the provided list is not null, it sets the list. Otherwise, it assigns the default text formatters retrieved from the data source. To configure the existing Mentions look and feel check out [CometChatMentionsFormatter](/ui-kit/react/mentions-formatter-guide)
+Replace the name / title text. User status inline example.
+
+
+
+
-
-```ts
-import { CometChatTextFormatter } from "@cometchat/chat-uikit-react";
-import DialogHelper from "./Dialog";
+
+```ts lines
+import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
+import { CometChatConversations } from "@cometchat/chat-uikit-react";
-class ShortcutFormatter extends CometChatTextFormatter {
- private shortcuts: { [key: string]: string } = {};
- private dialogIsOpen: boolean = false;
- private dialogHelper = new DialogHelper();
- private currentShortcut: string | null = null; // Track the currently open shortcut
+// Custom title view component
+const customTitleView = (conversation: CometChat.Conversation) => {
+ let user =
+ conversation.getConversationType() == "user"
+ ? (conversation.getConversationWith() as CometChat.User)
+ : undefined;
+ return (
+
}` |
+| CSS overrides | Target `.cometchat-conversations` class in global CSS | `.cometchat-conversations .cometchat-list-item { ... }` |
diff --git a/ui-kit/react/core-features.mdx b/ui-kit/react/core-features.mdx
index 78a6de7de..eb8edf329 100644
--- a/ui-kit/react/core-features.mdx
+++ b/ui-kit/react/core-features.mdx
@@ -1,13 +1,29 @@
---
title: "Core"
+description: "Overview of CometChat's core chat features including instant messaging, media sharing, read receipts, typing indicators, user presence, reactions, mentions, threaded conversations, search, and moderation — with the UI Kit components that power each feature."
---
+
+- **Package:** `@cometchat/chat-uikit-react`
+- **Required setup:** `CometChatUIKit.init(UIKitSettings)` then `CometChatUIKit.login("UID")` — must complete before rendering any component
+- **Core features:** Instant Messaging, Media Sharing, Read Receipts, Mark as Unread, Typing Indicator, User Presence, Reactions, Mentions, Quoted Reply, Search, Threaded Conversations, Moderation, Report Message, Group Chat
+- **Key components:** `CometChatConversations` → [Conversations](/ui-kit/react/conversations), `CometChatMessageList` → [Message List](/ui-kit/react/message-list), `CometChatMessageComposer` → [Message Composer](/ui-kit/react/message-composer), `CometChatMessageHeader` → [Message Header](/ui-kit/react/message-header), `CometChatUsers` → [Users](/ui-kit/react/users), `CometChatGroups` → [Groups](/ui-kit/react/groups), `CometChatGroupMembers` → [Group Members](/ui-kit/react/group-members)
+- **CSS class prefix:** `.cometchat-`
+- **Theming:** Override CSS variables on `.cometchat` class. See [Theming](/ui-kit/react/theme)
+
+
## Overview
-The UI Kit comprises a variety of components, each designed to work seamlessly with one another to deliver a comprehensive and intuitive chat experience.
+The UI Kit comprises a variety of components that work together to deliver a comprehensive chat experience.
+
Here's how different UI Kit components work together to achieve CometChat's Core features:
+
+
+**Before using these components:** Ensure `CometChatUIKit.init(UIKitSettings)` has completed and the user is logged in via `CometChatUIKit.login("UID")`. See [React.js Integration](/ui-kit/react/react-js-integration).
+
+
## Instant Messaging
At the heart of CometChat's functionality is the ability to support real-time text messaging. Users can send and receive instant messages, fostering quick and efficient communication.
@@ -115,45 +131,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) works with Quoted Message by showing the quoted reply above the input field, letting users compose their response in proper context. |
-## 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. |
+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).
## Moderation
@@ -189,12 +200,39 @@ 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.
-
+
+| 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. |
+
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).
+
+
+---
+
+## Next Steps
+
+
+
+ Browse all available UI Kit components
+
+
+ Customize the look and feel of your chat UI
+
+
+ Add audio and video calling to your app
+
+
+ Explore AI-powered chat capabilities
+
+
diff --git a/ui-kit/react/custom-text-formatter-guide.mdx b/ui-kit/react/custom-text-formatter-guide.mdx
index eadbdc933..639300055 100644
--- a/ui-kit/react/custom-text-formatter-guide.mdx
+++ b/ui-kit/react/custom-text-formatter-guide.mdx
@@ -1,7 +1,23 @@
---
title: "Custom Text Formatter"
+description: "Extend the CometChatTextFormatter base class to implement custom inline text patterns with regex and callbacks."
---
+
+
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Key class | `CometChatTextFormatter` (abstract base class for custom formatters) |
+| Init | `CometChatUIKit.init(UIKitSettings)` then `CometChatUIKit.login("UID")` |
+| Purpose | Extend to create custom inline text patterns with regex, styling, and callbacks |
+| Features | Text formatting, customizable styles, dynamic text replacement, input field integration, key event callbacks |
+| Sample app | [GitHub](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app) |
+| Related | [ShortCut Formatter](/ui-kit/react/shortcut-formatter-guide) · [Mentions Formatter](/ui-kit/react/mentions-formatter-guide) · [All Guides](/ui-kit/react/guide-overview) |
+
+
+
+
## Overview
You can create your custom text formatter for CometChat using the `CometChatTextFormatter`. `CometChatTextFormatter` is an abstract utility class that serves as a foundational structure for enabling text formatting in the message composer and text message bubbles. It can be extended to create custom formatter classes, tailored to suit specific application needs, making it a valuable tool for text customization and enhancement in chat interfaces.
@@ -26,13 +42,13 @@ To integrate the `CometChatTextFormatter` class into your application:
1. Firstly, you need to import `CometChatTextFormatter` from the CometChat UI Kit react library.
-```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`.
-```java
+```javascript lines
class HashTagTextFormatter extends CometChatTextFormatter {
...
}
@@ -40,7 +56,7 @@ class HashTagTextFormatter extends CometChatTextFormatter {
3. set up the `trackCharacter`, `regexPatterns` and `regexToReplaceFormatting`. For a hashtag formatter, we're setting the track character to `#`.
-```csharp
+```javascript lines
this.setTrackingCharacter("#");
this.setRegexPatterns([/\B#(\w+)\b/g]);
this.setRegexToReplaceFormatting([
@@ -50,14 +66,14 @@ this.setRegexToReplaceFormatting([
4. Set callback functions for key up and key down events.
-```javascript
+```javascript lines
this.setKeyUpCallBack(this.onKeyUp.bind(this));
this.setKeyDownCallBack(this.onKeyDown.bind(this));
```
5. Implement the `getFormattedText`, `getOriginalText` and custom logic to format text methods.
-```typescript
+```typescript lines
getFormattedText(inputText:string) { ... }
getOriginalText(inputText:string) { ... }
customLogicToFormatText(inputText: string) { ... }
@@ -73,7 +89,7 @@ Below is an example demonstrating how to use a custom formatter class in compone
-```ts
+```ts lines
import { CometChatTextFormatter } from "@cometchat/chat-uikit-react";
class HashTagTextFormatter extends CometChatTextFormatter {
@@ -227,7 +243,7 @@ export default HashTagTextFormatter;
-```tsx
+```tsx lines
import { HashTagTextFormatter } from "./HashTagTextFormatter";
export default function MessageListDemo() {
@@ -288,7 +304,7 @@ Upon calling `reRender`, the composer will invoke the `getFormattedText` functio
-```js
+```js lines
/**
* If the input text is provided, it returns the formatted text. Otherwise, it edits the text using the current cursor position.
* @param {string|null} inputText - The text to format.
@@ -306,7 +322,7 @@ Upon calling `reRender`, the composer will invoke the `getFormattedText` functio
-```js
+```js lines
/**
* Handles 'keydown' events.
* @param {KeyboardEvent} event - The keyboard event.
@@ -325,7 +341,7 @@ onKeyUp(event: KeyboardEvent) {
-```js
+```js lines
/**
* Handles 'keydown' events.
* @param {KeyboardEvent} event - The keyboard event.
@@ -336,7 +352,7 @@ onKeyDown(event: KeyboardEvent) {}
-```js
+```js lines
/**
* Composer and Text Bubbles will call this function when rendering the HTML content.
* This will be called for each HTML Element present in the formatted string.
@@ -407,7 +423,7 @@ registerEventListeners(element: HTMLElement, domTokenList: DOMTokenList) {
-```js
+```js lines
/**
* Returns the original unformatted text from the input text.
* @param {string|null|undefined} inputText - The input text to get original text from.
@@ -433,4 +449,23 @@ registerEventListeners(element: HTMLElement, domTokenList: DOMTokenList) {
-
\ No newline at end of file
+
+
+## Next Steps
+
+
+
+ Add @mentions with styled tokens.
+
+
+ Customize the message input component.
+
+
+ Browse all feature and formatter guides.
+
+
+ Full working sample application on GitHub.
+
+
+
+***
diff --git a/ui-kit/react/events.mdx b/ui-kit/react/events.mdx
index 0ba3e00fc..75f2cf6f7 100644
--- a/ui-kit/react/events.mdx
+++ b/ui-kit/react/events.mdx
@@ -1,96 +1,102 @@
---
title: "Events"
+description: "Reference for CometChat React UI Kit events including conversation, user, group, message, and call events."
---
-## Overview
+
+
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Conversation events | `ccConversationDeleted`, `ccUpdateConversation` |
+| User events | `ccUserBlocked`, `ccUserUnblocked` |
+| Group events | `ccGroupCreated`, `ccGroupDeleted`, `ccGroupLeft`, `ccGroupMemberScopeChanged`, `ccGroupMemberKicked`, `ccGroupMemberBanned`, `ccGroupMemberUnbanned`, `ccGroupMemberJoined`, `ccGroupMemberAdded`, `ccOwnershipChanged` |
+| Message events | `ccMessageSent`, `ccMessageEdited`, `ccReplyToMessage`, `ccMessageDeleted`, `ccMessageRead`, `ccLiveReaction`, plus SDK listener events |
+| Call events | `ccOutgoingCall`, `ccCallAccepted`, `ccCallRejected`, `ccCallEnded` |
+| UI events | `ccActiveChatChanged` |
+| Purpose | Decoupled communication between UI Kit components — subscribe to events to react to changes without direct component references |
-Events allow for a decoupled, flexible architecture where different parts of the application can interact without having to directly reference each other. This makes it easier to create complex, interactive experiences, as well as to extend and customize the functionality provided by the CometChat UI Kit.
+
-All components have the ability to emit events. These events are dispatched in response to certain changes or user interactions within the component. By emitting events, these components allow other parts of the application to react to changes or interactions, thus enabling dynamic and interactive behavior within the application.
+## Overview
+
+Events provide decoupled communication between UI Kit components. Components emit events in response to user interactions or state changes, allowing other parts of the application to react without direct component references.
### CometChatConversationEvents
-`CometChatConversationEvents` emits events when the logged-in user executes some action on a conversation object.
+`CometChatConversationEvents` emits events when the logged-in user acts on a conversation object.
| Name | Description |
| ------------------------- | ------------------------------------------------------------------------------------------------ |
-| ccConversationDeleted | This event is triggered when the user successfully deletes a conversation. |
-| ccUpdateConversation | This event is triggered to update a conversation in the conversation list. Takes a Conversation object to update. |
+| **ccConversationDeleted** | This event is triggered when the user successfully deletes a conversation. |
+| **ccUpdateConversation** | This event is triggered to update a conversation in the conversation list. Takes a Conversation object to update. |
### CometChatUserEvents
-`CometChatUserEvents` emits events when the logged-in user executes some action on an user object.
-
-It consists of the following events:
+`CometChatUserEvents` emits events when the logged-in user acts on another user object.
| Name | Description |
| --------------- | ------------------------------------------------------------------------- |
-| ccUserBlocked | This event is triggered when the user successfully blocks another user. |
-| ccUserUnblocked | This event is triggered when the user successfully unblocks another user. |
+| **ccUserBlocked** | This event is triggered when the user successfully blocks another user. |
+| **ccUserUnblocked** | This event is triggered when the user successfully unblocks another user. |
### CometChatGroupEvents
-`CometChatGroupEvents` emits events when the logged-in user executes some action on a group object.
-
-It consists of the following events:
+`CometChatGroupEvents` emits events when the logged-in user acts on a group object.
| Name | Description |
| ------------------------- | ------------------------------------------------------------------------------------ |
-| ccGroupCreated | This event is triggered when the user creates a group successfully |
-| ccGroupDeleted | This event is triggered when the group member deletes the group successfully |
-| ccGroupLeft | This event is triggered when the group member leaves the group successfully |
-| ccGroupMemberScopeChanged | This event is triggered when the group member's scope is updated successfully |
-| ccGroupMemberKicked | This event is triggered when the group member is kicked |
-| ccGroupMemberBanned | This event is triggered when the group member is banned |
-| ccGroupMemberUnbanned | This event is triggered when the group member is un-banned |
-| ccGroupMemberJoined | This event is triggered when a user joins the group |
-| ccGroupMemberAdded | This event is triggered when a user is added to the group |
-| ccOwnershipChanged | This event is triggered when the group ownership is assigned to another group member |
+| **ccGroupCreated** | This event is triggered when the user creates a group successfully |
+| **ccGroupDeleted** | This event is triggered when the group member deletes the group successfully |
+| **ccGroupLeft** | This event is triggered when the group member leaves the group successfully |
+| **ccGroupMemberScopeChanged** | This event is triggered when the group member's scope is updated successfully |
+| **ccGroupMemberKicked** | This event is triggered when the group member is kicked |
+| **ccGroupMemberBanned** | This event is triggered when the group member is banned |
+| **ccGroupMemberUnbanned** | This event is triggered when the group member is un-banned |
+| **ccGroupMemberJoined** | This event is triggered when a user joins the group |
+| **ccGroupMemberAdded** | This event is triggered when a user is added to the group |
+| **ccOwnershipChanged** | This event is triggered when the group ownership is assigned to another group member |
### CometChatMessageEvents
-`CometChatMessageEvents` emits events when the logged-in user executes some action on a message object.
-
-It consists of the following events:
+`CometChatMessageEvents` emits events when the logged-in user acts on a message object.
| Name | Description |
| -------------------------- | --------------------------------------------------------------------------------------------------------- |
-| ccMessageSent | This event is triggered when the sent message is in transit and also when it is received by the receiver. |
-| ccMessageEdited | This event is triggered when the user successfully edits the message. |
-| ccReplyToMessage | This event is triggered when the user successfully replies to a message. |
-| ccMessageDeleted | This event is triggered when the user successfully deletes the message. |
-| ccMessageRead | This event is triggered when the sent message is read by the receiver. |
-| ccLiveReaction | This event is triggered when the user sends a live reaction. |
-| onTextMessageReceived | This event is emitted when the CometChat SDK listener emits a text message. |
-| onMediaMessageReceived | This event is emitted when the CometChat SDK listener emits a media message. |
-| onCustomMessageReceived | This event is emitted when the CometChat SDK listener emits a custom message. |
-| onTypingStarted | This event is emitted when the CometChat SDK listener indicates that a user has started typing. |
-| onTypingEnded | This event is emitted when the CometChat SDK listener indicates that a user has stopped typing. |
-| onMessagesDelivered | This event is emitted when the CometChat SDK listener indicates that messages have been delivered. |
-| onMessagesRead | This event is emitted when the CometChat SDK listener indicates that messages have been read. |
-| onMessageEdited | This event is emitted when the CometChat SDK listener indicates that a message has been edited. |
-| onMessageDeleted | This event is emitted when the CometChat SDK listener indicates that a message has been deleted. |
-| onTransientMessageReceived | This event is emitted when the CometChat SDK listener emits a transient message. |
+| **ccMessageSent** | This event is triggered when the sent message is in transit and also when it is received by the receiver. |
+| **ccMessageEdited** | This event is triggered when the user successfully edits the message. |
+| **ccReplyToMessage** | This event is triggered when the user successfully replies to a message. |
+| **ccMessageDeleted** | This event is triggered when the user successfully deletes the message. |
+| **ccMessageRead** | This event is triggered when the sent message is read by the receiver. |
+| **ccLiveReaction** | This event is triggered when the user sends a live reaction. |
+| **onTextMessageReceived** | This event is emitted when the CometChat SDK listener emits a text message. |
+| **onMediaMessageReceived** | This event is emitted when the CometChat SDK listener emits a media message. |
+| **onCustomMessageReceived** | This event is emitted when the CometChat SDK listener emits a custom message. |
+| **onTypingStarted** | This event is emitted when the CometChat SDK listener indicates that a user has started typing. |
+| **onTypingEnded** | This event is emitted when the CometChat SDK listener indicates that a user has stopped typing. |
+| **onMessagesDelivered** | This event is emitted when the CometChat SDK listener indicates that messages have been delivered. |
+| **onMessagesRead** | This event is emitted when the CometChat SDK listener indicates that messages have been read. |
+| **onMessageEdited** | This event is emitted when the CometChat SDK listener indicates that a message has been edited. |
+| **onMessageDeleted** | This event is emitted when the CometChat SDK listener indicates that a message has been deleted. |
+| **onTransientMessageReceived** | This event is emitted when the CometChat SDK listener emits a transient message. |
### CometChatCallEvents
-`CometChatCallEvents` emits events when the logged-in user executes some action on a call object.
-
-It consists of the following events:
+`CometChatCallEvents` emits events when the logged-in user acts on a call object.
| Name | Description |
| -------------- | ---------------------------------------------------------------------------- |
-| ccOutgoingCall | This event is triggered when the user initiates a voice/video call. |
-| ccCallAccepted | This event is triggered when the initiated call is accepted by the receiver. |
-| ccCallRejected | This event is triggered when the initiated call is rejected by the receiver. |
-| ccCallEnded | This event is triggered when the initiated call successfully ends. |
+| **ccOutgoingCall** | This event is triggered when the user initiates a voice/video call. |
+| **ccCallAccepted** | This event is triggered when the initiated call is accepted by the receiver. |
+| **ccCallRejected** | This event is triggered when the initiated call is rejected by the receiver. |
+| **ccCallEnded** | This event is triggered when the initiated call successfully ends. |
### UI events
-UI events, refer to actions or interactions performed by a user within the CometChat's UI Kit. These events are triggered when a user interacts with various UI elements, such as buttons, menus, checkboxes, input fields, or any other interactive components.
-
-It consists of the following events:
+UI events are triggered when a user interacts with UI Kit elements such as buttons, menus, or input fields.
| Name | Description |
| ------------------- | ---------------------------------------------------------------------------- |
-| ccActiveChatChanged | This event is triggered when the user navigates to a particular chat window. |
+| **ccActiveChatChanged** | This event is triggered when the user navigates to a particular chat window. |
+
+***
diff --git a/ui-kit/react/extensions.mdx b/ui-kit/react/extensions.mdx
index 15f4332d9..14aa71a92 100644
--- a/ui-kit/react/extensions.mdx
+++ b/ui-kit/react/extensions.mdx
@@ -1,32 +1,102 @@
---
title: "Extensions"
+description: "Overview of CometChat's extensions grouped by Dashboard categories (User Experience, User Engagement, Collaboration, Security, Customer Support, Smart Chat Features) and how they auto-integrate into React UI Kit components."
---
+
+- **Package:** `@cometchat/chat-uikit-react`
+- **Required setup:** `CometChatUIKit.init(UIKitSettings)` then `CometChatUIKit.login("UID")` + Extensions enabled in [CometChat Dashboard](/fundamentals/extensions-overview)
+- **Extension categories:** User Experience, User Engagement, Collaboration, Security, Customer Support, Smart Chat Features
+- **Key components:** `CometChatMessageComposer` → [Message Composer](/ui-kit/react/message-composer) (Stickers, Polls, Whiteboard, Document), `CometChatMessageList` → [Message List](/ui-kit/react/message-list) (Translation, Link Preview, Thumbnails)
+- **Activation:** Enable each extension from the CometChat Dashboard — UI Kit auto-integrates them, no additional code required
+
+
## Overview
CometChat's UI Kit offers built-in support for various extensions, enriching the chatting experience with enhanced functionality. These extensions augment your chat application, making it more interactive, secure, and efficient.
+
+
+**Before using extensions:** Ensure `CometChatUIKit.init(UIKitSettings)` has completed and the user is logged in via `CometChatUIKit.login("UID")`. Extensions must also be activated from the [CometChat Dashboard](/fundamentals/extensions-overview).
+
+
Activating extensions within CometChat is a straightforward process through your application's dashboard. For detailed instructions, refer to our guide on [Extensions](/fundamentals/extensions-overview).
-Once you've enabled your desired extension in the dashboard, it seamlessly integrates into your CometChat application upon initialization and successful login. It's important to note that extension features will only be available if they are supported by the CometChat UI Kit.
+Once you've enabled your desired extension in the dashboard, it integrates into your CometChat application upon initialization and successful login. Extension features are only available if supported by the CometChat UI Kit.
-CometChat's UI Kit provides native support for 12 powerful extensions. This effortless integration enables you to enhance your chat application with engaging features without any additional coding. Simply enable the desired extensions from the CometChat Dashboard, and they will automatically enhance the relevant components of your application, providing a richer and more engaging experience for your users.
+The UI Kit provides native support for a wide range of extensions. Enable the desired extensions from the CometChat Dashboard, and they automatically enhance the relevant components of your application.
## Built-in Extensions
-Here's a guide on how you can enable and integrate these extensions:
+Here's a guide on how you can enable and integrate these extensions. The grouping below mirrors the CometChat Dashboard.
-### Stickers
+### User Experience
-The Stickers extension allows users to express their emotions more creatively. It adds a much-needed fun element to the chat by allowing users to send various pre-designed stickers. For a comprehensive understanding and guide on implementing and using the Sticker Extension, refer to our specific guide on the [Sticker Extension](/fundamentals/stickers).
+#### Bitly
-Once you have successfully activated the [Sticker Extension](/fundamentals/stickers) from your CometChat Dashboard, the feature will automatically be incorporated into the [Message Composer](/ui-kit/react/message-composer) component of UI Kits.
+The Bitly extension allows you to shorten long URLs in your text messages using Bitly's URL shortening service. For a comprehensive understanding and guide on implementing and using the Bitly Extension, refer to our specific guide on the [Bitly Extension](/fundamentals/bitly).
+
+#### Link Preview
+
+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).
+
+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.
-
+
+
+
+#### Message Shortcuts
+
+The Message Shortcuts extension enables users to send predefined messages using short codes. For example, typing `!hb` can automatically expand to `Happy birthday!`. For a comprehensive understanding and guide on implementing and using the Message Shortcuts Extension, refer to our specific guide on the [Message Shortcuts Extension](/fundamentals/message-shortcuts).
+
+#### Pin Message
+
+The Pin Message extension allows users to pin important messages in a conversation, making them easily accessible for all participants. For a comprehensive understanding and guide on implementing and using the Pin Message Extension, refer to our specific guide on the [Pin Message Extension](/fundamentals/pin-message).
+
+#### Rich Media Preview
+
+The Rich Media Preview extension generates rich preview panels for URLs shared in messages, fetching detailed information from popular sites using iFramely. For a comprehensive understanding and guide on implementing and using the Rich Media Preview Extension, refer to our specific guide on the [Rich Media Preview Extension](/fundamentals/rich-media-preview).
+
+#### Save Message
+
+The Save Message extension allows users to bookmark messages for later reference. Saved messages are private and visible only to the user who saved them. For a comprehensive understanding and guide on implementing and using the Save Message Extension, refer to our specific guide on the [Save Message Extension](/fundamentals/save-message).
+
+#### 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).
+
+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.
+
+
+
-### Polls
+#### TinyURL
+
+The TinyURL extension provides URL shortening capabilities for messages, similar to Bitly but using the TinyURL service. For a comprehensive understanding and guide on implementing and using the TinyURL Extension, refer to our specific guide on the [TinyURL Extension](/fundamentals/tinyurl).
+
+#### Voice Transcription
+
+The Voice Transcription extension converts audio messages into text, making it easier to read voice messages without playing them. For a comprehensive understanding and guide on implementing and using the Voice Transcription Extension, refer to our specific guide on the [Voice Transcription Extension](/fundamentals/voice-transcription).
+
+### User Engagement
+
+#### Giphy
+
+The Giphy extension allows users to search for and share GIFs in their conversations, adding a fun and expressive element to chats. For a comprehensive understanding and guide on implementing and using the Giphy Extension, refer to our specific guide on the [Giphy Extension](/fundamentals/giphy).
+
+#### Message Translation
+
+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).
+
+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.
+
+
+
+
+
+#### Polls
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).
@@ -36,17 +106,31 @@ Once you have successfully activated the [Polls Extension](/fundamentals/polls)
-### Collaborative Whiteboard
+#### Reminders
-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).
+The Reminders extension allows users to set reminders for messages or create personal reminders. When a reminder is due, a bot sends a notification message to the user. For a comprehensive understanding and guide on implementing and using the Reminders Extension, refer to our specific guide on the [Reminders Extension](/fundamentals/reminders).
-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/react/message-composer) component of UI Kits.
+#### Stickers
+
+The Stickers extension allows users to express their emotions more creatively. It adds a much-needed fun element to the chat by allowing users to send various pre-designed stickers. For a comprehensive understanding and guide on implementing and using the Sticker Extension, refer to our specific guide on the [Sticker Extension](/fundamentals/stickers).
+
+Once you have successfully activated the [Sticker Extension](/fundamentals/stickers) from your CometChat Dashboard, the feature will automatically be incorporated into the [Message Composer](/ui-kit/react/message-composer) component of UI Kits.
-
+
-### Collaborative Document
+#### Stipop
+
+The Stipop extension integrates the world's trendiest sticker platform into your chat, allowing users to search for and send stickers from Stipop's extensive library. For a comprehensive understanding and guide on implementing and using the Stipop Extension, refer to our specific guide on the [Stipop Extension](/fundamentals/stickers-stipop).
+
+#### Tenor
+
+The Tenor extension allows users to search for and share GIFs from Tenor's library in their conversations. For a comprehensive understanding and guide on implementing and using the Tenor Extension, refer to our specific guide on the [Tenor Extension](/fundamentals/tenor).
+
+### Collaboration
+
+#### Collaborative Document
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).
@@ -56,32 +140,64 @@ Once you have successfully activated the [Collaborative Document Extension](/fun
-### Message Translation
+#### Collaborative Whiteboard
-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).
+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).
-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.
+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/react/message-composer) component of UI Kits.
-
+
-### Link Preview
+### Security
-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).
+#### Disappearing Messages
-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.
+The Disappearing Messages extension allows users to send messages that automatically disappear after a specified time interval. This works for both one-on-one and group messages. For a comprehensive understanding and guide on implementing and using the Disappearing Messages Extension, refer to our specific guide on the [Disappearing Messages Extension](/fundamentals/disappearing-messages).
-
-
-
+### Customer Support
-### Thumbnail Generation
+#### Chatwoot
-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).
+The Chatwoot extension integrates customer support by allowing your users to communicate with your support team directly through CometChat, eliminating the need for a separate support interface. For a comprehensive understanding and guide on implementing and using the Chatwoot Extension, refer to our specific guide on the [Chatwoot Extension](/fundamentals/chatwoot).
-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.
+#### Intercom
-
-
-
+The Intercom extension integrates Intercom's customer support platform with CometChat, enabling users to chat with your support team using the same chat interface they use for regular conversations. For a comprehensive understanding and guide on implementing and using the Intercom Extension, refer to our specific guide on the [Intercom Extension](/fundamentals/intercom).
+
+### Smart Chat Features
+
+#### Conversation Starter
+
+Conversation Starter suggests AI-generated opening messages to help users begin a new chat. For a comprehensive understanding and guide on implementing and using Conversation Starter, refer to our specific guide on the [Conversation Starter](/fundamentals/ai-user-copilot/conversation-starter) and the [AI Features](/ui-kit/react/ai-features) overview.
+
+#### Smart Replies
+
+Smart Replies provide AI-generated response suggestions to keep conversations flowing. For a comprehensive understanding and guide on implementing and using Smart Replies, refer to our specific guide on the [Smart Replies](/fundamentals/ai-user-copilot/smart-replies) and the [AI Features](/ui-kit/react/ai-features) overview.
+
+#### Conversation Summary
+
+Conversation Summary generates an AI-written recap of a conversation when needed. For a comprehensive understanding and guide on implementing and using Conversation Summary, refer to our specific guide on the [Conversation Summary](/fundamentals/ai-user-copilot/conversation-summary) and the [AI Features](/ui-kit/react/ai-features) overview.
+
+---
+
+
+---
+
+## Next Steps
+
+
+
+ Customize the composer where most extensions appear
+
+
+ Customize the message list for extension-rendered content
+
+
+ Explore core chat features like messaging and reactions
+
+
+ Explore AI-powered chat capabilities
+
+
diff --git a/ui-kit/react/group-members.mdx b/ui-kit/react/group-members.mdx
index ce7ec270f..f0c04c863 100644
--- a/ui-kit/react/group-members.mdx
+++ b/ui-kit/react/group-members.mdx
@@ -1,26 +1,35 @@
---
title: "Group Members"
+description: "Display and manage the list of members in a CometChat group with roles, scopes, online status, and member management actions using the CometChatGroupMembers component in the React UI Kit."
---
-## Overview
-
-`CometChatGroupMembers` is a Component that displays all users added or invited to a group, granting them access to group discussions, shared content, and collaborative features. Group members can communicate in real-time via messaging, voice and video calls, and other activities. They can interact, share files, and join calls based on group permissions set by the administrator or owner.
-
-***
+
+
+| Field | Value |
+| --- | --- |
+| Purpose | Scrollable, searchable list of members in a specific group with roles, scopes, online status, and member management actions (kick, ban, scope change) |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";` |
+| Used in experiences | Group detail panel, member management, mentions picker, admin tools |
+| Copy-paste base | See [Base Code](#base-code--stylesheet) below |
+| Primary output | `CometChat.GroupMember` object (from `onItemClick`) |
+| Primary hook points | `onItemClick`, `onSelect`, `onEmpty`, `onError`, `groupMemberRequestBuilder`, view slots (`itemView`, `subtitleView`, `trailingView`, `leadingView`, `headerView`, `titleView`) |
+| CSS root class | `.cometchat-group-members` |
+| Real-time events | `CometChatGroupEvents.ccGroupMemberKicked`, `CometChatGroupEvents.ccGroupMemberBanned`, `CometChatGroupEvents.ccGroupMemberScopeChanged`, `CometChatGroupEvents.ccGroupMemberAdded` |
-## Usage
+
-### Integration
+## Base Code and Stylesheet
-The following code snippet illustrates how you can directly incorporate the Group Members component into your Application.
+Renders a scrollable, searchable list of all members in a given group.
-```tsx
+```tsx lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
import React from "react";
@@ -39,12 +48,10 @@ const GroupMembersDemo = () => {
export default GroupMembersDemo;
```
-
-
-```tsx
-import { GroupMembersDemo } from "./GroupMembersDemo";
+```tsx lines
+import GroupMembersDemo from "./GroupMembersDemo";
export default function App() {
return (
@@ -54,758 +61,335 @@ export default function App() {
);
}
```
-
-
-
-
-
-***
-
-### Actions
-
-[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. onSelect
-
-The `onSelect` action is activated when you select the done icon while in selection mode. This returns a list of all the group members that you have selected.
-
-This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
-
-
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import {
- CometChatGroupMembers,
- SelectionMode,
-} from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const GroupMembersDemo = () => {
- const [chatGroup, setChatGroup] = React.useState();
-
- React.useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
-
- function handleOnSelect(
- groupMembers: CometChat.GroupMember,
- selected: boolean
- ): void {
- console.log(groupMembers, selected);
- /** Your custom onSelect actions */
- }
-
- return (
- <>
- {chatGroup && (
-
- )}
- >
- );
-};
-
-export default GroupMembersDemo;
-```
-
-
-
-
-```js
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import {
- CometChatGroupMembers,
- SelectionMode,
-} from "@cometchat/chat-uikit-react";
-import React, { useEffect, useState } from "react";
-
-const GroupMembersDemo = () => {
- const [chatGroup, setChatGroup] = useState(null);
-
- useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
-
- function handleOnSelect(groupMembers, selected) {
- console.log(groupMembers);
- /** Your custom onSelect actions
- }
-
- return (
- <>
- {chatGroup && (
-
- )}
- >
- );
-};
-
-export default GroupMembersDemo;
-```
-
-
-
-
-
-##### 2. onItemClick
-
-The `onItemClick` event is activated when you click on the Group Members List item. This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
-
-
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const GroupMembersDemo = () => {
- const [chatGroup, setChatGroup] = React.useState();
-
- React.useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
-
- function handleOnItemClick(groupMembers: CometChat.GroupMember): void {
- console.log(groupMembers, "your custom on item click action");
- }
-
- return (
- <>
- {chatGroup && (
-
- )}
- >
- );
-};
-
-export default GroupMembersDemo;
-```
-
-
-
-```js
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-import { useEffect, useState } from "react";
-
-const GroupMembersDemo = () => {
- const [chatGroup, setChatGroup] = useState(null);
-
- useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
-
- function handleOnItemClick(groupMembers) {
- console.log(groupMembers, "your custom on item click action");
- }
-
- return (
- <>
- {chatGroup && (
-
- )}
- >
- );
-};
-
-export default GroupMembersDemo;
-```
-
-
-
-##### 3. onEmpty
-
-This action allows you to specify a callback function to be executed when a certain condition, typically the absence of data or content, is met within the component or element.
-
-
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const GroupMembersDemo = () => {
- const [chatGroup, setChatGroup] = React.useState();
-
- React.useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
-
- function handleOnEmpty(): void {
- console.log("your custom on empty actions");
- }
-
- return (
- <>
- {chatGroup && (
-
- )}
- >
- );
-};
-
-export default GroupMembersDemo;
-```
-
-
-
-
-```js
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-import { useEffect, useState } from "react";
-
-const GroupMembersDemo = () => {
- const [chatGroup, setChatGroup] = useState(null);
-
- useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
-
- function handleOnEmpty() {
- console.log("your custom on empty actions");
- }
-
- return (
- <>
- {chatGroup && (
-
- )}
- >
- );
-};
-
-export default GroupMembersDemo;
-```
+Root CSS class for style overrides:
-
-
-
-
-##### 4. onError
-
-This action doesn't change the behavior of the component but rather listens for any errors that occur in the Group Members component.
-
-
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const GroupMembersDemo = () => {
- const [chatGroup, setChatGroup] = React.useState();
-
- React.useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
-
- function handleOnError(error: CometChat.CometChatException): void {
- /** Your Custom on error actions */
- }
-
- return (
- <>
- {chatGroup && (
-
- )}
- >
- );
-};
-
-export default GroupMembersDemo;
+```css lines
+.cometchat-group-members {
+ /* overrides here */
+}
```
-
+## Functionality
-
-```js
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-import { useEffect, useState } from "react";
-
-const GroupMembersDemo = () => {
- const [chatGroup, setChatGroup] = useState(null);
-
- useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
-
- function handleOnError(error) {
- /** Your Custom on error actions */
- }
-
- return (
- <>
- {chatGroup && (
-
- )}
- >
- );
-};
+Props that control component behavior, grouped by surface area.
-export default GroupMembersDemo;
-```
+### Data and Loading
-
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `group` | `CometChat.Group` | — (required) | The group whose members are fetched and displayed | Must be a valid SDK group object |
+| `groupMemberRequestBuilder` | `CometChat.GroupMembersRequestBuilder` | SDK default (30 per page) | Controls which members load and in what order | Pass the builder, not a built request |
+| `searchRequestBuilder` | `CometChat.GroupMembersRequestBuilder` | Same as `groupMemberRequestBuilder` | Controls filtering when the search bar is active | Keeps search results consistent with the main list filters |
+| `searchKeyword` | `string` | `""` | Pre-fills the search and filters the member list | Changing this prop triggers a re-fetch |
+| `disableLoadingState` | `boolean` | `false` | Skips the loading spinner when re-fetching | Useful when embedding inside another component that manages its own loading state |
-
+### Selection Behavior
-***
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `selectionMode` | `SelectionMode` | `SelectionMode.none` | Enables single or multi-select checkboxes on list items | Must pair with `onSelect` to capture selections |
-### Filters
+### UI Visibility Toggles
-**Filters** allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `hideSearch` | `boolean` | `false` | Hides the default search bar | — |
+| `hideError` | `boolean` | `false` | Hides the default and custom error views | Also suppresses `errorView` if set |
+| `hideKickMemberOption` | `boolean` | `false` | Hides the option to kick a member from the group | — |
+| `hideBanMemberOption` | `boolean` | `false` | Hides the option to ban a member from the group | — |
+| `hideScopeChangeOption` | `boolean` | `false` | Hides the option to change the scope of a group member | — |
+| `hideUserStatus` | `boolean` | `false` | Hides the user's online/offline status indicator | Also disables the SDK user presence listener |
+| `showScrollbar` | `boolean` | `false` | Shows the scrollbar in the member list | — |
-##### 1. GroupMembersRequestBuilder
+### Custom Views (Render Props)
-The [GroupMembersRequestBuilder](/sdk/javascript/retrieve-group-members) enables you to filter and customize the group members list based on available parameters in GroupMembersRequestBuilder. This feature allows you to create more specific and targeted queries when fetching groups. The following are the parameters available in [GroupMembersRequestBuilder](/sdk/javascript/retrieve-group-members)
+These replace sections of the default UI. See [Custom View Slots](#custom-view-slots) for full examples.
-| Methods | Type | Description |
-| -------------------- | -------------- | ------------------------------------------------------------------------------------------------- |
-| **setLimit** | number | sets the number of group members that can be fetched in a single request, suitable for pagination |
-| **setSearchKeyword** | String | used for fetching group members matching the passed string |
-| **setScopes** | Array\ | used for fetching group members based on multiple scopes |
+| Property | Type | Effect |
+| --- | --- | --- |
+| `loadingView` | `JSX.Element` | Shown while members are loading |
+| `emptyView` | `JSX.Element` | Shown when there are no members |
+| `errorView` | `JSX.Element` | Shown when an error occurs |
-**Example**
+## Actions
-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.
+[Actions](/ui-kit/react/components-overview#actions) split into predefined (built-in triggers) and user-defined (callbacks).
-
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-import React from "react";
+### Predefined Actions
-const GroupMembersDemo = () => {
- const [chatGroup, setChatGroup] = React.useState();
+The component has no built-in navigation behavior. All interaction handling is delegated to callbacks.
- React.useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
+### User-Defined Actions
- return (
- <>
- {chatGroup && (
-
- )}
- >
- );
-};
+#### onItemClick
-export default GroupMembersDemo;
-```
+Fires when a user taps a group member row.
-
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks/taps a group member list item |
+| Payload type | `(groupMember: CometChat.GroupMember) => void` |
+| What devs typically do next | Open member profile, start direct message |
-
-```js
+```tsx lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-import { useEffect, useState } from "react";
-const GroupMembersDemo = () => {
- const [chatGroup, setChatGroup] = useState(null);
-
- useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
-
- return (
- <>
- {chatGroup && (
-
- )}
- >
- );
+const handleOnItemClick = (groupMember: CometChat.GroupMember) => {
+ console.log("Selected member:", groupMember.getName());
+ // Your custom action here
};
-export default GroupMembersDemo;
+;
```
-
-
-
-
-##### 2. SearchRequestBuilder
+#### onSelect
-The SearchRequestBuilder uses [GroupMembersRequestBuilder](/sdk/javascript/retrieve-group-members) enables you to filter and customize the search list based on available parameters in GroupMembersRequestBuilder. This feature allows you to keep uniformity between the displayed Group Members List and searched Group Members List.
+Fires when a group member is selected or deselected in multi-select mode. Requires `selectionMode` to be set.
-**Example**
+| Detail | Value |
+| --- | --- |
+| When it fires | User checks/unchecks a member in selection mode |
+| Payload type | `(groupMember: CometChat.GroupMember, selected: boolean) => void` |
+| What devs typically do next | Track selected members for batch operations (kick, ban) |
-
-
-```ts
+```tsx lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const GroupMembersDemo = () => {
- const [chatGroup, setChatGroup] = React.useState();
-
- React.useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
-
- return (
- <>
- {chatGroup && (
-
- )}
- >
- );
-};
-
-export default GroupMembersDemo;
-```
-
-
-
-
-```js
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-import { useEffect, useState } from "react";
-
-const GroupMembersDemo = () => {
- const [chatGroup, setChatGroup] = useState(null);
-
- useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
-
- return (
- <>
- {chatGroup && (
-
- )}
- >
- );
-};
-
-export default GroupMembersDemo;
-```
-
-
-
-
-
-***
-
-### Events
-
-[Events](/ui-kit/react/components-overview#events) are emitted by a `Component`. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
-
-Events emitted by the Group Members component is as follows.
-
-| Event | Description |
-| ----------------------------- | ----------------------------------------------------------------- |
-| **ccGroupMemberBanned** | Triggers when the group member banned from the group successfully |
-| **ccGroupMemberKicked** | Triggers when the group member kicked from the group successfully |
-| **ccGroupMemberScopeChanged** | Triggers when the group member scope is changed in the group |
-
-
-
-```tsx
-const ccGroupMemberBanned = CometChatGroupEvents.ccGroupMemberBanned.subscribe(
- (item: IGroupMemberKickedBanned) => {
- /** Your Code */
- }
-);
-
-const ccGroupMemberKicked = CometChatGroupEvents.ccGroupMemberKicked.subscribe(
- (item: IGroupMemberKickedBanned) => {
- /** Your Code */
- }
-);
-
-const ccGroupMemberScopeChanged =
- CometChatGroupEvents.ccGroupMemberScopeChanged.subscribe(
- (item: IGroupMemberScopeChanged) => {
- /** Your Code */
- }
- );
-```
-
-
-
-
-
-***
-
-
-
-```tsx
-ccGroupMemberBanned?.unsubscribe();
+import {
+ CometChatGroupMembers,
+ SelectionMode,
+} from "@cometchat/chat-uikit-react";
-ccGroupMemberKicked?.unsubscribe();
+const handleOnSelect = (
+ groupMember: CometChat.GroupMember,
+ selected: boolean
+) => {
+ console.log("Member selected:", groupMember.getName(), selected);
+ // Your custom selection action
+};
-ccGroupMemberScopeChanged?.unsubscribe();
+;
```
-
+#### onEmpty
-
+Fires when the group members list has no data to display.
-***
+| Detail | Value |
+| --- | --- |
+| When it fires | The fetched member list is empty |
+| Payload type | `() => void` |
+| What devs typically do next | Show a prompt to invite members |
-## Customization
+```tsx lines
+import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-To fit your app's design requirements, you can customize the appearance of the Group Members component.
+const handleOnEmpty = () => {
+ console.log("No group members found");
+};
-### Style
+;
+```
-Using CSS you can customize the look and feel of the component in your app like the color, size, shape, and fonts.
+#### onError
-
-
-
+Fires when the component encounters an error (network failure, auth issue, etc.).
-
-
-```ts
+| Detail | Value |
+| --- | --- |
+| When it fires | Any internal error during data fetching or rendering |
+| Payload type | `(error: CometChat.CometChatException) => void` |
+| What devs typically do next | Log to error tracking service, show custom toast |
+
+```tsx lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-import React from "react";
-import "./GroupMembersStyle.css";
-
-const GroupMembersDemo = () => {
- const [chatGroup, setChatGroup] = React.useState();
-
- React.useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
- return <>{chatGroup && }>;
+const handleOnError = (error: CometChat.CometChatException) => {
+ console.error("Group members error:", error);
+ // Your exception handling code
};
-export default GroupMembersDemo;
+;
```
-
+## Filters
-
-```css
-.cometchat-group-members .cometchat-list__header-title {
- background: #feede1;
- color: #f76808;
- font-family: "Times New Roman";
-}
+Control which members appear using `GroupMembersRequestBuilder`. Pass the builder (not a built request) to the `groupMemberRequestBuilder` prop.
-.cometchat-group-members .cometchat-list-item__body-title,
-.cometchat-group-members .cometchat-search-bar__input::placeholder {
- font-family: "Times New Roman";
-}
+Refer to [GroupMembersRequestBuilder](/sdk/javascript/retrieve-group-members) for the full API.
-.cometchat-group-members .cometchat-group-members__trailing-view-options {
- background: #feede1;
- color: #f76808;
- font-family: "Times New Roman";
-}
+### Filter Recipes
-.cometchat-group-members .cometchat-group-members__trailing-view-options-admin {
- border: 1px solid #f76808;
-}
+| Recipe | Code |
+| --- | --- |
+| Limit to 10 per page | `new CometChat.GroupMembersRequestBuilder("GROUP_GUID").setLimit(10)` |
+| Search by keyword | `new CometChat.GroupMembersRequestBuilder("GROUP_GUID").setSearchKeyword("john")` |
+| Admins and moderators only | `new CometChat.GroupMembersRequestBuilder("GROUP_GUID").setScopes(["admin", "moderator"])` |
-.cometchat-group-members .cometchat-group-members__trailing-view-options-owner {
- background: #f76808;
- color: #fff;
- font-family: "Times New Roman";
-}
+### Example
-.cometchat-group-members .cometchat-list-item__leading-view,
-.cometchat-group-members .cometchat-avatar {
- height: 40px;
- width: 40px;
-}
+```tsx lines
+import { CometChat } from "@cometchat/chat-sdk-javascript";
+import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
+
+;
```
-
+### Search Request Builder
-
+The `searchRequestBuilder` uses `GroupMembersRequestBuilder` to filter the search list independently, keeping uniformity between the displayed member list and searched results.
-***
+```tsx lines
+import { CometChat } from "@cometchat/chat-sdk-javascript";
+import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-### 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.
+### Performance Note
-
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-import React from "react";
+The default page size is 30. Reducing it with `setLimit` can improve initial load time on slower connections. The component uses infinite scroll — the next page loads automatically as the user scrolls to the bottom.
-const GroupMembersDemo = () => {
- const [chatGroup, setChatGroup] = React.useState();
+## Events
- React.useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
+### UI Events
- return (
- <>
- {chatGroup && (
-
- )}
- >
- );
-};
+The CometChatGroupMembers component emits events when member management actions are performed (kick, ban, scope change). It also subscribes to events fired by other components to keep the list in sync.
-export default GroupMembersDemo;
-```
+#### Events Emitted
-
+| Event | Payload type | When it fires |
+| --- | --- | --- |
+| `CometChatGroupEvents.ccGroupMemberKicked` | `IGroupMemberKickedBanned` | A member is kicked from the group |
+| `CometChatGroupEvents.ccGroupMemberBanned` | `IGroupMemberKickedBanned` | A member is banned from the group |
+| `CometChatGroupEvents.ccGroupMemberScopeChanged` | `IGroupMemberScopeChanged` | A member's scope is changed |
+
+#### Events Subscribed
-
-```js
+The component internally subscribes to these events to update the list in real time:
+
+| Event | What it does inside the component |
+| --- | --- |
+| `CometChatGroupEvents.ccGroupMemberKicked` | Removes the kicked member from the list |
+| `CometChatGroupEvents.ccGroupMemberBanned` | Removes the banned member from the list |
+| `CometChatGroupEvents.ccGroupMemberScopeChanged` | Updates the member's scope in the list |
+| `CometChatGroupEvents.ccGroupMemberAdded` | Appends newly added members to the list |
+
+#### Subscribe
+
+```tsx lines
+import { CometChatGroupEvents } from "@cometchat/chat-uikit-react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-import { useEffect, useState } from "react";
-const GroupMembersDemo = () => {
- const [chatGroup, setChatGroup] = useState(null);
+const kickedSub = CometChatGroupEvents.ccGroupMemberKicked.subscribe(
+ (item: { message: CometChat.Action; kickedFrom: CometChat.Group; kickedUser: CometChat.User; kickedBy: CometChat.User }) => {
+ console.log("Member kicked:", item.kickedUser.getName());
+ }
+);
- useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
+const bannedSub = CometChatGroupEvents.ccGroupMemberBanned.subscribe(
+ (item: { message: CometChat.Action; kickedFrom: CometChat.Group; kickedUser: CometChat.User; kickedBy: CometChat.User }) => {
+ console.log("Member banned:", item.kickedUser.getName());
+ }
+);
- return (
- <>
- {chatGroup && (
-
- )}
- >
- );
-};
+const scopeChangedSub = CometChatGroupEvents.ccGroupMemberScopeChanged.subscribe(
+ (item: { message: CometChat.Action; updatedUser: CometChat.GroupMember; scopeChangedTo: string; scopeChangedFrom: string; group: CometChat.Group }) => {
+ console.log("Scope changed for:", item.updatedUser.getName(), "to", item.scopeChangedTo);
+ }
+);
-export default GroupMembersDemo;
+const memberAddedSub = CometChatGroupEvents.ccGroupMemberAdded.subscribe(
+ (item: { messages: CometChat.Action[]; usersAdded: CometChat.User[]; userAddedIn: CometChat.Group; userAddedBy: CometChat.User }) => {
+ console.log("Members added to:", item.userAddedIn.getName());
+ }
+);
```
-
+#### Unsubscribe
-
+```tsx lines
+// In useEffect cleanup or component unmount
+kickedSub?.unsubscribe();
+bannedSub?.unsubscribe();
+scopeChangedSub?.unsubscribe();
+memberAddedSub?.unsubscribe();
+```
-Below is a list of customizations along with corresponding code snippets,
+### SDK Events (Real-Time)
-| Property | Description | Code |
-| ---------------------------- | ------------------------------------------------------------------------- | ---------------------------------------- |
-| **Hide Search** | Hides the default search bar. | `hideSearch={true}` |
-| **Hide Error** | Hides the default and custom error view passed in `errorView` prop. | `hideError={true}` |
-| **Hide Kick Member Option** | Hides the option to kick a member from the group. | `hideKickMemberOption={true}` |
-| **Hide Ban Member Option** | Hides the option to ban a member from the group. | `hideBanMemberOption={true}` |
-| **Hide Scope Change Option** | Hides the option to change the scope of a group member. | `hideScopeChangeOption={true}` |
-| **Hide User Status** | Hides the user's online/offline status indicator. | `hideUserStatus={true}` |
-| **Group** | The group for which members are being fetched. | `group={chatGroup}` |
-| **Search Keyword** | The keyword used to filter the group members list. | `searchKeyword="admin"` |
-| **Selection Mode** | Selection mode to use for the default list item view. | `selectionMode={SelectionMode.multiple}` |
-| **Show Scrollbar** | Controls the visibility of the scrollbar in the list. | `showScrollbar={true}` |
-| **Loading View** | A custom view to display during the loading state. | `loadingView={}` |
-| **Error View** | Custom view for the error state of the component. | `errorView={}` |
-| **Empty View** | A custom view to display when no group members are available in the list. | |
+The component automatically listens to SDK group events internally for real-time updates. No manual attachment needed unless additional side effects are required.
-***
+| SDK Listener | What it does inside the component |
+| --- | --- |
+| `onGroupMemberScopeChanged` | Updates the member's scope in the list |
+| `onGroupMemberKicked` | Removes the kicked member from the list |
+| `onGroupMemberBanned` | Removes the banned member from the list |
+| `onMemberAddedToGroup` | Appends the new member to the list |
+| `onGroupMemberLeft` | Removes the member who left from the list |
+| `onGroupMemberJoined` | Appends the joined member to the list |
+| `onUserOnline` / `onUserOffline` | Updates the member's online/offline status (disabled when `hideUserStatus` is `true`) |
-### Advanced
+#### React StrictMode Note
-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.
+In React 18 StrictMode, `useEffect` runs twice on mount in development. SDK listeners may be registered twice. The component handles cleanup internally, but any additional listeners added alongside the component need cleanup in the `useEffect` return function to avoid duplicate event handling.
-***
+## Advanced: Custom View Slots
-#### ItemView
+Customization override points for the group member list UI. Each slot receives the group member object and returns JSX.
-With this property, you can assign a custom ListItem to the Group Members Component.
+### Slot Catalog
-Shown below is the default chat interface.
+| Slot | Params | What it replaces | Section |
+| --- | --- | --- | --- |
+| `itemView` | `(groupMember: CometChat.GroupMember) => JSX.Element` | Entire list item row | Whole item |
+| `leadingView` | `(groupMember: CometChat.GroupMember) => JSX.Element` | Avatar / left section | Sub-section (leading) |
+| `trailingView` | `(groupMember: CometChat.GroupMember) => JSX.Element` | Right section (scope badge / actions) | Sub-section (trailing) |
+| `titleView` | `(groupMember: CometChat.GroupMember) => JSX.Element` | Name / title text | Sub-section (title) |
+| `subtitleView` | `(groupMember: CometChat.GroupMember) => JSX.Element` | Subtitle text | Sub-section (subtitle) |
+| `headerView` | `JSX.Element` | Entire header bar | Whole section |
+| `loadingView` | `JSX.Element` | Loading spinner | Empty/loading/error |
+| `emptyView` | `JSX.Element` | Empty state | Empty/loading/error |
+| `errorView` | `JSX.Element` | Error state | Empty/loading/error |
+| `options` | `(group: CometChat.Group, groupMember: CometChat.GroupMember) => CometChatOption[]` | Context menu / hover actions | Whole item |
+
+### itemView
+
+Replace the entire list item row.
+
+Default:
-The customized chat interface is displayed below.
+Customized:
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import { CometChat, GroupMember } from "@cometchat/chat-sdk-javascript";
import React from "react";
import {
@@ -880,11 +464,9 @@ const GroupMembersDemo = () => {
export default GroupMembersDemo;
```
-
-
-
-```css
+
+```css lines
.group-member-list-item {
display: flex;
min-width: 240px;
@@ -964,59 +546,57 @@ export default GroupMembersDemo;
display: none;
}
```
-
-
-***
+### titleView
-#### TitleView
-
-The customized chat interface is displayed below.
+Replace the name / title text. Role badge inline example.
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroups } from "@cometchat/chat-uikit-react";
+import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
-// Custom title view component
const customTitleView = (member: CometChat.GroupMember) => {
- return
- {member.getName()}
- {member.getRole()}
-
;
-}
+ return (
+
+ {member.getName()}
+
+
+ {member.getRole()}
+
+
+ );
+};
-;
+;
```
-
-
-
-```css
-.group-members__title-view{
+
+```css lines
+.group-members__title-view {
display: flex;
align-items: center;
gap: 4px;
align-self: stretch;
- }
- .group-members__title-view-name{
+}
+
+.group-members__title-view-name {
overflow: hidden;
color: #141414;
text-overflow: ellipsis;
- font:500 16px Roboto
- }
- .group-members__title-view-type{
- color: #FFF;
+ font: 500 16px Roboto;
+}
+
+.group-members__title-view-type {
+ color: #fff;
font: 600 8px Roboto;
display: flex;
height: 15px;
@@ -1025,41 +605,35 @@ const customTitleView = (member: CometChat.GroupMember) => {
align-items: center;
gap: 3px;
border-radius: 7px;
- background: #09C26F;
- }
- .group-members__title-view-public .group-members__title-view-role{
- //add css based on roles
- background: #0B7BEA;
- }
-```
+ background: #09c26f;
+}
+.group-members__title-view-public .group-members__title-view-role {
+ background: #0b7bea;
+}
+```
-
-***
+### subtitleView
-#### SubtitleView
+Replace the subtitle text. Joined date example.
-You can customize the subtitle view for each group members to meet your requirements.
-
-Shown below is the default chat interface.
+Default:
-The customized chat interface is displayed below.
+Customized:
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import { CometChat, GroupMember } from "@cometchat/chat-sdk-javascript";
import React from "react";
import { CometChatGroupMembers } from "@cometchat/chat-uikit-react";
@@ -1100,11 +674,9 @@ const GroupMembersDemo = () => {
export default GroupMembersDemo;
```
-
-
-
-```css
+
+```css lines
.group-member-subtitle {
overflow: hidden;
color: #727272;
@@ -1113,116 +685,108 @@ export default GroupMembersDemo;
font: 400 14px Roboto;
}
```
-
-
-***
+### leadingView
-#### LeadingView
-
-The customized chat interface is displayed below.
+Replace the avatar / left section. Scope badge overlay example.
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroupMembers,CometChatAvatar } from "@cometchat/chat-uikit-react";
+import { CometChatGroupMembers, CometChatAvatar } from "@cometchat/chat-uikit-react";
-// Custom leading view component
const customLeadingView = (member: CometChat.GroupMember): JSX.Element => {
- // Determine the member's scope or owner status
const scope = member.getUid() === group.getOwner() ? "owner" : member.getScope();
return (
-
-
- {scope}
+
+ {scope}
+
);
};
-;
-```
+;
+```
-
-
-```css
-.cometchat-group-members .cometchat-list-item .group-member__leading-view .cometchat-avatar__image, .cometchat-group-members .cometchat-list-item .group-member__leading-view .cometchat-avatar{
-border-radius: 8px;
-height: 48px ;
-width: 48px ;
+
+```css lines
+.cometchat-group-members .cometchat-list-item .group-member__leading-view .cometchat-avatar__image,
+.cometchat-group-members .cometchat-list-item .group-member__leading-view .cometchat-avatar {
+ border-radius: 8px;
+ height: 48px;
+ width: 48px;
}
-.group-member__leading-view-scope{
-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;
+
+.group-member__leading-view-scope {
+ 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;
}
-.group-member__leading-view{
-position: relative;
+
+.group-member__leading-view {
+ position: relative;
}
-.group-member__leading-view-participant .group-member__leading-view-scope{
-display: none;
+.group-member__leading-view-participant .group-member__leading-view-scope {
+ display: none;
}
-.group-member__leading-view-owner .group-member__leading-view-scope{
-background: #0B7BEA;
+
+.group-member__leading-view-owner .group-member__leading-view-scope {
+ background: #0b7bea;
}
-.group-member__leading-view-admin .group-member__leading-view-scope{
-background: #FFAB00;
+
+.group-member__leading-view-admin .group-member__leading-view-scope {
+ background: #ffab00;
}
-.group-member__leading-view-moderator .group-member__leading-view-scope{
-background: #09C26F;
+
+.group-member__leading-view-moderator .group-member__leading-view-scope {
+ background: #09c26f;
}
```
-
-
-***
-
-#### TrailingView
+### trailingView
-You can customize the trailing view for each group members to meet your requirements.
+Replace the right section. Scope tag example.
-Shown below is the default chat interface.
+Default:
-The customized chat interface is displayed below.
+Customized:
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import { CometChat, GroupMember } from "@cometchat/chat-sdk-javascript";
import React from "react";
import {
@@ -1264,7 +828,10 @@ const GroupMembersDemo = () => {
return (
<>
{chatGroup && (
-
+
)}
>
);
@@ -1272,11 +839,9 @@ const GroupMembersDemo = () => {
export default GroupMembersDemo;
```
-
-
-
-```css
+
+```css lines
.group-member-scope-tag {
display: flex;
padding: 4px 12px;
@@ -1291,55 +856,49 @@ export default GroupMembersDemo;
font: 400 12px Roboto;
}
```
-
-
-***
-
-#### HeaderView
-
-You can set the Custom headerView to add more options to the Group Members component.
+### headerView
-The customized chat interface is displayed below.
+Replace the entire header bar.
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroupMembers,localize } from "@cometchat/chat-uikit-react";
+import {
+ CometChatGroupMembers,
+ CometChatButton,
+ localize,
+} from "@cometchat/chat-uikit-react";
import React from "react";
const getHeaderView = () => {
- return (
-
+ );
};
-
+;
```
-
-
-
-```css
+
+```css lines
.cometchat-group-members__header {
display: flex;
width: 100%;
@@ -1350,19 +909,22 @@ const getHeaderView = () => {
flex: 1 0 0;
align-self: stretch;
border-radius: 10px;
- border: 1px solid #E8E8E8;
- background: #EDEAFA;
+ border: 1px solid #e8e8e8;
+ background: #edeafa;
}
+
.cometchat-group-members__header__title {
overflow: hidden;
color: #141414;
text-overflow: ellipsis;
font: 700 24px Roboto;
}
+
.cometchat-group-members__header .cometchat-button .cometchat-button__icon {
- background: #6852D6;
+ background: #6852d6;
}
-.cometchat-group-members__header .cometchat-button{
+
+.cometchat-group-members__header .cometchat-button {
width: 24px;
border: none;
background: transparent;
@@ -1370,28 +932,20 @@ const getHeaderView = () => {
display: block;
}
```
-
-
-***
-
-#### Options
-
-You can set the Custom options to the Group Members component.
+### options
-The customized chat interface is displayed below.
+Replace the context menu / hover actions on each group member item.
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import {
CometChatGroupMembers,
@@ -1423,7 +977,7 @@ const GroupMembersDemo = () => {
id: "1",
title: "Kick User",
onClick: () => {
- /** Your logic for handling click of custom option. */
+ // Your logic for handling click of custom option.
},
}),
];
@@ -1437,11 +991,9 @@ const GroupMembersDemo = () => {
export default GroupMembersDemo;
```
-
-
-
-```css
+
+```css lines
.cometchat-group-members .cometchat-menu-list__main-menu-item-icon {
height: 24px;
width: 24px;
@@ -1455,9 +1007,61 @@ export default GroupMembersDemo;
box-shadow: none;
}
```
-
-
-***
+#### Structure of CometChatOption
+
+| Name | Description |
+| --- | --- |
+| `id` | Unique identifier for each option |
+| `title` | Heading text for each option |
+| `iconURL` | Asset URL of the icon for each option |
+| `onClick` | Method invoked when user clicks the option |
+
+## Theme and Styling
+
+Using CSS, customize the look and feel of the component. The root CSS class is `.cometchat-group-members`.
+
+
+
+
+
+```tsx lines
+
+```
+
+```css lines
+.cometchat-group-members .cometchat-list__header-title {
+ background: #feede1;
+ color: #f76808;
+ font-family: "Times New Roman";
+}
+
+.cometchat-group-members .cometchat-list-item__body-title,
+.cometchat-group-members .cometchat-search-bar__input::placeholder {
+ font-family: "Times New Roman";
+}
+
+.cometchat-group-members .cometchat-group-members__trailing-view-options {
+ background: #feede1;
+ color: #f76808;
+ font-family: "Times New Roman";
+}
+
+.cometchat-group-members .cometchat-group-members__trailing-view-options-admin {
+ border: 1px solid #f76808;
+}
+
+.cometchat-group-members .cometchat-group-members__trailing-view-options-owner {
+ background: #f76808;
+ color: #fff;
+ font-family: "Times New Roman";
+}
+
+.cometchat-group-members .cometchat-list-item__leading-view,
+.cometchat-group-members .cometchat-avatar {
+ height: 40px;
+ width: 40px;
+}
+```
diff --git a/ui-kit/react/groups.mdx b/ui-kit/react/groups.mdx
index 27bd1cd69..01833c987 100644
--- a/ui-kit/react/groups.mdx
+++ b/ui-kit/react/groups.mdx
@@ -1,48 +1,51 @@
---
title: "Groups"
+description: "Display and manage the list of all available groups with icons, names, member counts, and group type indicators using the CometChatGroups component in the React UI Kit."
---
-## Overview
-
-The Groups is a Component, showcasing an accessible list of all available groups. It provides an integral search functionality, allowing you to locate any specific groups swiftly and easily. For each group listed, the group name is displayed by default, in conjunction with the group icon when available. Additionally, it provides a useful feature by displaying the number of members in each group as a subtitle, offering valuable context about group size and activity level.
-
-The Groups component is composed of the following BaseComponents:
+
-| 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. |
+| Field | Value |
+| --- | --- |
+| Purpose | Searchable, scrollable list of all available groups with icon, name, member count, and group type indicator |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatGroups } from "@cometchat/chat-uikit-react";` |
+| Used in experiences | Group directory, group discovery, tab-based chat, group management |
+| Copy-paste base | See [Base Code](#base-code--stylesheet) below |
+| Primary output | `CometChat.Group` object (from `onItemClick`) |
+| Primary hook points | `onItemClick`, `onSelect`, `onError`, `groupsRequestBuilder`, view slots (`itemView`, `subtitleView`, `trailingView`, `leadingView`, `headerView`, `titleView`) |
+| CSS root class | `.cometchat-groups` |
+| Real-time events | `CometChatGroupEvents.ccGroupCreated`, `CometChatGroupEvents.ccGroupDeleted`, `CometChatGroupEvents.ccGroupMemberJoined`, `CometChatGroupEvents.ccGroupMemberAdded`, `CometChatGroupEvents.ccGroupLeft`, `CometChatGroupEvents.ccGroupMemberKicked`, `CometChatGroupEvents.ccGroupMemberBanned`, `CometChatGroupEvents.ccOwnershipChanged` |
-***
+
-## Usage
+## Base Code and Stylesheet
-### Integration
-
-The following code snippet illustrates how you can directly incorporate the Groups component into your Application.
+Renders a searchable, scrollable list of all available groups.
-```tsx
+```tsx lines
import { CometChatGroups } from "@cometchat/chat-uikit-react";
-import React from "react";
-const GroupsDemo = () => {
- return ;
-};
+function GroupsDemo() {
+ return (
+
+
+
+ );
+}
export default GroupsDemo;
```
-
-
-```tsx
-import { GroupsDemo } from "./GroupsDemo";
+```tsx lines
+import GroupsDemo from "./GroupsDemo";
export default function App() {
return (
@@ -52,545 +55,324 @@ export default function App() {
);
}
```
-
-
-***
-
-### Actions
-
-[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.
+Root CSS class for style overrides:
-##### 1. onSelect
-
-The `onSelect` action is activated when you select the done icon while in selection mode. This returns the `group` object along with the boolean flag `selected` to indicate if the group was selected or unselected.
-
-This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
-
-
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroups, SelectionMode } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const GroupsDemo = () => {
- function handleOnSelect(group: CometChat.Group, selected: boolean): void {
- console.log(group);
- //your custom onSelect actions
- }
- return (
-
- );
-};
-
-export default GroupsDemo;
+```css lines
+.cometchat-groups {
+ /* overrides here */
+}
```
-
+## Functionality
-
-```js
-import { CometChatGroups, SelectionMode } from "@cometchat/chat-uikit-react";
-import React from "react";
+Props that control component behavior, grouped by surface area.
-const GroupsDemo = () => {
- function handleOnSelect(group, selected) {
- console.log(group);
- //your custom onSelect actions
- }
- return (
-
- );
-};
+### Data and Loading
-export default GroupsDemo;
-```
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `groupsRequestBuilder` | `CometChat.GroupsRequestBuilder` | SDK default (30 per page) | Controls which groups load and in what order | Pass the builder, not a built request |
+| `searchRequestBuilder` | `CometChat.GroupsRequestBuilder` | Same as `groupsRequestBuilder` | Controls filtering when the search bar is active | Keeps search results consistent with the main list filters |
+| `activeGroup` | `CometChat.Group` | `undefined` | Highlights the specified group in the list | Must be a reference-equal object from the SDK |
-
+### Selection Behavior
-
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `selectionMode` | `SelectionMode` | `SelectionMode.none` | Enables single or multi-select checkboxes on list items | Must pair with `onSelect` to capture selections |
-##### 2. onItemClick
+### UI Visibility Toggles
-The `onItemClick` event is activated when you click on the Group List item. This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `hideSearch` | `boolean` | `false` | Hides the default search bar | — |
+| `hideError` | `boolean` | `false` | Hides the default and custom error views | Also suppresses `errorView` if set |
+| `hideGroupType` | `boolean` | `false` | Hides the group type icon (public/private/password) | — |
+| `showScrollbar` | `boolean` | `false` | Shows the scrollbar in the group list | — |
-
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroups } from "@cometchat/chat-uikit-react";
-import React from "react";
+### Custom Views (Render Props)
-const GroupsDemo = () => {
- function handleOnItemClick(group: CometChat.Group): void {
- console.log(group, "your custom on item click action");
- }
- return ;
-};
+These replace sections of the default UI. See [Custom View Slots](#custom-view-slots) for full examples.
-export default GroupsDemo;
-```
+| Property | Type | Effect |
+| --- | --- | --- |
+| `loadingView` | `JSX.Element` | Shown while groups are loading |
+| `emptyView` | `JSX.Element` | Shown when there are no groups |
+| `errorView` | `JSX.Element` | Shown when an error occurs |
-
+## Actions
-
-```js
-import { CometChatGroups } from "@cometchat/chat-uikit-react";
-import React from "react";
+[Actions](/ui-kit/react/components-overview#actions) split into predefined (built-in triggers) and user-defined (callbacks).
-const GroupsDemo = () => {
- function handleOnItemClick(group) {
- console.log(group, "your custom on item click action");
- }
- return ;
-};
+### Predefined Actions
-export default GroupsDemo;
-```
+The component has no built-in navigation behavior. All interaction handling is delegated to callbacks.
-
+### User-Defined Actions
-
+#### onItemClick
-##### 3. onError
+Fires when a user taps a group row. Primary navigation hook.
-This action doesn't change the behavior of the component but rather listens for any errors that occur in the Groups component.
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks/taps a group list item |
+| Payload type | `(group: CometChat.Group) => void` |
+| What devs typically do next | Set active group in state, navigate to group chat view |
-
-
-```ts
+```tsx lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatGroups } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const GroupsDemo = () => {
- const handleOnError = (error: CometChat.CometChatException) => {
- console.log("Your custom on error actions");
- };
- return ;
-};
-
-export default GroupsDemo;
-```
-
-
-
-
-```js
-import { CometChatGroups } from "@cometchat/chat-uikit-react";
-import React from "react";
-const GroupsDemo = () => {
- const handleOnError = (error) => {
- console.log("Your custom on error actions");
- };
- return ;
+const handleOnItemClick = (group: CometChat.Group) => {
+ console.log("Selected group:", group);
+ // Your custom action here
};
-export default GroupsDemo;
+;
```
-
-
-
-
-### Filters
-
-**Filters** allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.
-
-##### 1. GroupsRequestBuilder
-
-The [GroupsRequestBuilder](/sdk/javascript/retrieve-groups) enables you to filter and customize the group list based on available parameters in [GroupsRequestBuilder](/sdk/javascript/retrieve-groups). This feature allows you to create more specific and targeted queries when fetching groups. The following are the parameters available in [GroupsRequestBuilder](/sdk/javascript/retrieve-groups)
+#### onSelect
-| Methods | Type | Description |
-| -------------------- | -------------- | --------------------------------------------------------------------------------------- |
-| **setLimit** | number | sets the number groups that can be fetched in a single request, suitable for pagination |
-| **setSearchKeyword** | String | used for fetching groups matching the passed string |
-| **joinedOnly** | boolean | to fetch only joined groups. |
-| **setTags** | Array\ | used for fetching groups containing the passed tags |
-| **withTags** | boolean | used to fetch tags data along with the list of groups |
+Fires when a group is selected or deselected in multi-select mode. Requires `selectionMode` to be set.
-**Example**
+| Detail | Value |
+| --- | --- |
+| When it fires | User checks/unchecks a group in selection mode |
+| Payload type | `(group: CometChat.Group, selected: boolean) => void` |
+| What devs typically do next | Track selected groups for batch operations (join, delete) |
-In the example below, we are applying a filter to the Group List based on only joined groups and setting the limit to two.
-
-
-
-```ts
+```tsx lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroups } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const GroupsDemo = () => {
- return (
-
- );
-};
-
-export default GroupsDemo;
-```
-
-
-
-
-```js
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroups } from "@cometchat/chat-uikit-react";
-import React from "react";
+import { CometChatGroups, SelectionMode } from "@cometchat/chat-uikit-react";
-const GroupsDemo = () => {
- return (
-
- );
+const handleOnSelect = (group: CometChat.Group, selected: boolean) => {
+ console.log("Group selected:", group.getName(), selected);
+ // Your custom action on select
};
-export default GroupsDemo;
+;
```
-
-
-
-
-##### 2. SearchRequestBuilder
+#### onError
-The SearchRequestBuilder uses [GroupsRequestBuilder](/sdk/javascript/retrieve-groups) enables you to filter and customize the search list based on available parameters in GroupsRequestBuilder. This feature allows you to keep uniformity between the displayed Groups List and searched Group List.
+Fires when the component encounters an error (network failure, auth issue, etc.).
-**Example**
+| Detail | Value |
+| --- | --- |
+| When it fires | Any internal error during data fetching or rendering |
+| Payload type | `(error: CometChat.CometChatException) => void` |
+| What devs typically do next | Log to error tracking service, show custom toast |
-
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
+```tsx lines
import { CometChatGroups } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const GroupsDemo = () => {
- return (
-
- );
-};
-
-export default GroupsDemo;
-```
-
-
-
-
-```js
import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatGroups } from "@cometchat/chat-uikit-react";
-import React from "react";
-const GroupsDemo = () => {
- return (
-
- );
+const handleOnError = (error: CometChat.CometChatException) => {
+ console.error("Groups error:", error);
+ // Your exception handling code
};
-export default GroupsDemo;
+;
```
-
-
-
-
-***
-
-### Events
-
-[Events](/ui-kit/react/components-overview#events) are emitted by a `Component`. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
-
-To handle events supported by Groups you have to add corresponding listeners by using `CometChatGroupEvents`
-
-The `Groups` component does not produce any events directly.
-
-***
-
-## Customization
+## Filters
-To fit your app's design requirements, you can customize the appearance of the Groups component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.
+Control which groups appear using `GroupsRequestBuilder`. Pass the builder (not a built request) to the `groupsRequestBuilder` prop.
-### Style
+Refer to [GroupsRequestBuilder](/sdk/javascript/retrieve-groups) for the full API.
-Using CSS you can customize the look and feel of the component in your app like the color, size, shape, and fonts.
+### Filter Recipes
-**Example**
+| Recipe | Code |
+| --- | --- |
+| Joined groups only | `new CometChat.GroupsRequestBuilder().joinedOnly(true)` |
+| Limit to 10 per page | `new CometChat.GroupsRequestBuilder().setLimit(10)` |
+| Search by keyword | `new CometChat.GroupsRequestBuilder().setSearchKeyword("design")` |
+| Filter by tags | `new CometChat.GroupsRequestBuilder().setTags(["vip"])` |
+| With tags data | `new CometChat.GroupsRequestBuilder().withTags(true)` |
-
-
-
+### Example
-
-
-```ts
+```tsx lines
import { CometChatGroups } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const GroupsDemo = () => {
- return ;
-};
+import { CometChat } from "@cometchat/chat-sdk-javascript";
-export default GroupsDemo;
+;
```
-
+### Search Request Builder
-
-```js
-import { CometChatGroups } from "@cometchat/chat-uikit-react";
-import React from "react";
+The `searchRequestBuilder` uses `GroupsRequestBuilder` to filter the search list independently, keeping uniformity between the displayed group list and searched results.
-const GroupsDemo = () => {
- return ;
-};
+```tsx lines
+import { CometChatGroups } from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
-export default GroupsDemo;
+;
```
-
+### Performance Note
-
-```css
-.cometchat .cometchat-groups .cometchat-list__header-title {
- background-color: #edeafa;
- color: #6852d6;
- border-width: 0px 1px 1px 0px;
- border-style: solid;
- border-color: #6852d6;
- overflow: hidden;
- text-overflow: ellipsis;
- font-family: "Times New Roman";
- font-size: 24px;
- font-style: normal;
- font-weight: 700;
- line-height: 28.8px;
-}
+The default page size is 30. Reducing it with `setLimit` can improve initial load time on slower connections. The component uses infinite scroll — the next page loads automatically as the user scrolls to the bottom.
-.cometchat .cometchat-groups .cometchat-search-bar__input::placeholder {
- font-family: "Times New Roman";
- font-size: 16px;
- font-style: normal;
- font-weight: 400;
- line-height: 19.2px;
-}
+## Events
-.cometchat .cometchat-groups .cometchat-list-item {
- background: #fff;
- border-right: 1px solid #f5f5f5;
-}
+### UI Events
-.cometchat .cometchat-groups__list-item .cometchat-avatar {
- background-color: #aa9ee8;
- border-radius: 6.67px;
-}
-
-.cometchat .cometchat-groups .cometchat-list-item__body-title {
- overflow: hidden;
- color: #141414;
- text-overflow: ellipsis;
- font-family: "Times New Roman";
- font-size: 16px;
- font-style: normal;
- font-weight: 400;
- line-height: 19.2px;
-}
+The CometChatGroups component does not emit any custom UI events directly.
-.cometchat .cometchat-groups .cometchat-groups__subtitle {
- overflow: hidden;
- color: #727272;
- text-overflow: ellipsis;
- white-space: nowrap;
- font-family: "Times New Roman";
- font-size: 14px;
- font-style: normal;
- font-weight: 400;
- line-height: 16.8px;
-}
-```
+The component internally subscribes to group lifecycle events via `CometChatGroupEvents`:
-
+| Event | When it fires | What it does inside the component |
+| --- | --- | --- |
+| `CometChatGroupEvents.ccGroupCreated` | A new group is created | Prepends the group to the list |
+| `CometChatGroupEvents.ccGroupDeleted` | A group is deleted | Removes the group from the list |
+| `CometChatGroupEvents.ccGroupMemberJoined` | A user joins a group | Updates the group in the list |
+| `CometChatGroupEvents.ccGroupMemberKicked` | A member is kicked from a group | Updates the group in the list |
+| `CometChatGroupEvents.ccGroupLeft` | A user leaves a group | Removes (private) or updates (public/password) the group |
+| `CometChatGroupEvents.ccGroupMemberBanned` | A member is banned from a group | Updates the group in the list |
+| `CometChatGroupEvents.ccGroupMemberAdded` | Members are added to a group | Updates the group in the list |
+| `CometChatGroupEvents.ccOwnershipChanged` | Group ownership is transferred | Updates the group in the list |
-
+These events are subscribable from anywhere in the application.
-***
+#### Subscribe
-### Functionality
+```tsx lines
+import { CometChatGroupEvents } from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
-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.
+const createdSub = CometChatGroupEvents.ccGroupCreated.subscribe(
+ (group: CometChat.Group) => {
+ console.log("Group created:", group.getName());
+ }
+);
-
-
-```ts
-import { CometChatGroups, TitleAlignment } from "@cometchat/chat-uikit-react";
-import React from "react";
+const deletedSub = CometChatGroupEvents.ccGroupDeleted.subscribe(
+ (group: CometChat.Group) => {
+ console.log("Group deleted:", group.getName());
+ }
+);
-const GroupsDemo = () => {
- return (
-
- );
-};
+const memberAddedSub = CometChatGroupEvents.ccGroupMemberAdded.subscribe(
+ (item: { messages: CometChat.Action[]; usersAdded: CometChat.User[]; userAddedIn: CometChat.Group; userAddedBy: CometChat.User }) => {
+ console.log("Members added to:", item.userAddedIn.getName());
+ }
+);
-export default GroupsDemo;
+const leftSub = CometChatGroupEvents.ccGroupLeft.subscribe(
+ (item: { userLeft: CometChat.User; leftGroup: CometChat.Group; message: CometChat.Action }) => {
+ console.log("User left group:", item.leftGroup.getName());
+ }
+);
```
-
-
-
-```js
-import { CometChatGroups, TitleAlignment } from "@cometchat/chat-uikit-react";
-import React from "react";
+#### Unsubscribe
-const GroupsDemo = () => {
- return (
-
- );
-};
-
-export default GroupsDemo;
+```tsx lines
+// In useEffect cleanup or component unmount
+createdSub?.unsubscribe();
+deletedSub?.unsubscribe();
+memberAddedSub?.unsubscribe();
+leftSub?.unsubscribe();
```
-
+### SDK Events (Real-Time)
-
+The component automatically listens to SDK group events internally for real-time updates. No manual attachment needed unless additional side effects are required.
+
+| SDK Listener | What it does inside the component |
+| --- | --- |
+| `onGroupMemberJoined` | Updates member count, sets `hasJoined` if current user joined |
+| `onGroupMemberLeft` | Updates member count, sets `hasJoined(false)` if current user left |
+| `onMemberAddedToGroup` | Updates member count, adds group to list if current user was added |
+| `onGroupMemberKicked` | Updates member count, sets `hasJoined(false)` if current user was kicked |
+| `onGroupMemberBanned` | Removes group if current user was banned, otherwise updates member count |
+| `onGroupMemberScopeChanged` | Updates scope if current user's scope changed, updates member count |
-Below is a list of customizations along with corresponding code snippets:
+#### React StrictMode Note
-| Property | Description | Code |
-| ------------------- | ------------------------------------------------------------------- | ---------------------------------------- |
-| **Hide Search** | Hides the default search bar. | `hideSearch={true}` |
-| **Hide Error** | Hides the default and custom error view passed in `errorView` prop. | `hideError={true}` |
-| **Hide Group Type** | Hides the group type icon. | `hideGroupType={true}` |
-| **Active Group** | The group to highlight in the list. | `activeGroup={chatGroup}` |
-| **Selection Mode** | Selection mode to use for the default trailing view. | `selectionMode={SelectionMode.multiple}` |
-| **Show Scrollbar** | Controls the visibility of the scrollbar in the list. | `showScrollbar={true}` |
-| **Loading View** | A custom view to display during the loading state. | `loadingView={<>Custom Loading View>}` |
-| **Empty View** | Custom view for the empty state of the component. | `emptyView={<>Custom Empty View>}` |
-| **Error View** | A custom view to display when an error occurs. | `errorView={<>Custom Error View>}` |
+In React 18 StrictMode, `useEffect` runs twice on mount in development. SDK listeners may be registered twice. The component handles cleanup internally, but any additional listeners added alongside the component need cleanup in the `useEffect` return function to avoid duplicate event handling.
-***
+## Advanced: Custom View Slots
-### Advanced
+Customization override points for the group list UI. Each slot receives the group object and returns JSX.
-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.
+### Slot Catalog
-***
+| Slot | Params | What it replaces | Section |
+| --- | --- | --- | --- |
+| `itemView` | `(group: CometChat.Group) => JSX.Element` | Entire list item row | Whole item |
+| `leadingView` | `(group: CometChat.Group) => JSX.Element` | Avatar / left section | Sub-section (leading) |
+| `trailingView` | `(group: CometChat.Group) => JSX.Element` | Right section | Sub-section (trailing) |
+| `titleView` | `(group: CometChat.Group) => JSX.Element` | Name / title text | Sub-section (title) |
+| `subtitleView` | `(group: CometChat.Group) => JSX.Element` | Subtitle text (member count) | Sub-section (subtitle) |
+| `headerView` | `JSX.Element` | Entire header bar | Whole section |
+| `loadingView` | `JSX.Element` | Loading spinner | Empty/loading/error |
+| `emptyView` | `JSX.Element` | Empty state | Empty/loading/error |
+| `errorView` | `JSX.Element` | Error state | Empty/loading/error |
+| `options` | `(group: CometChat.Group) => CometChatOption[]` | Context menu / hover actions | Whole item |
-#### ItemView
+### itemView
-A custom view to render for each group in the fetched list.
+Replace the entire list item row.
-Shown below is the default chat interface.
+Default:
-The customized chat interface is displayed below.
+Customized:
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatGroups } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const GroupsDemo = () => {
- const getItemView = (group: CometChat.Group) => {
- return (
-
-
-
{group.getName()}
-
JOIN
-
-
- {group.getMembersCount()} Members • {group.getDescription()}
-
+ );
+};
+;
+```
-
-
-```css
-.groups__trailing-view{
-display: flex;
-padding: 4px 12px;
-justify-content: center;
-align-items: center;
-border-radius: 1000px;
-background: #EDEAFA;
-overflow: hidden;
-color: #6852D6;
-text-overflow: ellipsis;
-font:700 12px Roboto;
+
+```css lines
+.groups__trailing-view {
+ display: flex;
+ padding: 4px 12px;
+ justify-content: center;
+ align-items: center;
+ border-radius: 1000px;
+ background: #edeafa;
+ overflow: hidden;
+ color: #6852d6;
+ text-overflow: ellipsis;
+ font: 700 12px Roboto;
}
-.cometchat-groups .cometchat-list-item__trailing-view{
-width: fit-content;
-height: fit-content;
+
+.cometchat-groups .cometchat-list-item__trailing-view {
+ width: fit-content;
+ height: fit-content;
}
```
-
-
-***
-
-#### Header View
+### headerView
-A custom component to render in the top-right corner of the groups list.
-
-The customized chat interface is displayed below.
+Replace the entire header bar.
-Use the following code to achieve the customization shown above.
-
-```ts
-import { CometChatGroups } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const GroupsDemo = () => {
- const getHeaderView = () => {
- return ;
- };
-
- return ;
-};
-
-export default GroupsDemo;
-```
-
-
-
-
-```js
+```ts lines
import { CometChatGroups } from "@cometchat/chat-uikit-react";
-import React from "react";
-const GroupsDemo = () => {
- const getHeaderView = () => {
- return ;
- };
-
- return ;
+const getHeaderView = () => {
+ return ;
};
-export default GroupsDemo;
+;
```
-
-
-
-```css
+
+```css lines
.group-header-view {
height: 24px;
width: 24px;
@@ -1030,83 +716,44 @@ export default GroupsDemo;
mask-size: contain;
}
```
-
-
-***
-
-#### Options
+### options
-You can set the Custom options to the Groups component.
-
-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.
-
-```ts
+```ts lines
+import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatGroups, CometChatOption } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const GroupsDemo = () => {
- const getOptions = (group: CometChat.Group): CometChatOption[] => {
- return [
- new CometChatOption({
- id: "delete",
- title: "delete",
- onClick: () => {
- console.log("Custom option clicked for group:", group);
- },
- }),
- ];
- };
-
- return ;
-};
-
-export default GroupsDemo;
-```
-
-
-
-```js
-import { CometChatGroups, CometChatOption } from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const GroupsDemo = () => {
- const getOptions = (group: CometChat.Group): CometChatOption[] => {
- return [
- new CometChatOption({
- id: "delete",
- title: "delete",
- onClick: () => {
- console.log("Custom option clicked for group:", group);
- },
- }),
- ];
- };
-
- return ;
+const getOptions = (group: CometChat.Group): CometChatOption[] => {
+ return [
+ new CometChatOption({
+ id: "delete",
+ title: "delete",
+ onClick: () => {
+ console.log("Custom option clicked for group:", group);
+ },
+ }),
+ ];
};
-export default GroupsDemo;
+;
```
-
-
-
-```css
+
+```css lines
.cometchat .cometchat-groups .cometchat-menu-list__menu {
background: none;
}
+
.cometchat .cometchat-groups .cometchat-menu-list__main-menu-item-icon {
height: 24px;
width: 24px;
@@ -1123,7 +770,84 @@ export default GroupsDemo;
mask-size: contain;
}
```
-
-
+
+#### Structure of CometChatOption
+
+| Name | Description |
+| --- | --- |
+| `id` | Unique identifier for each option |
+| `title` | Heading text for each option |
+| `iconURL` | Asset URL of the icon for each option |
+| `onClick` | Method invoked when user clicks the option |
+
+## Theme and Styling
+
+Using CSS, customize the look and feel of the component. The root CSS class is `.cometchat-groups`.
+
+
+
+
+
+```tsx lines
+
+```
+
+```css lines
+.cometchat .cometchat-groups .cometchat-list__header-title {
+ background-color: #edeafa;
+ color: #6852d6;
+ border-width: 0px 1px 1px 0px;
+ border-style: solid;
+ border-color: #6852d6;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ font-family: "Times New Roman";
+ font-size: 24px;
+ font-style: normal;
+ font-weight: 700;
+ line-height: 28.8px;
+}
+
+.cometchat .cometchat-groups .cometchat-search-bar__input::placeholder {
+ font-family: "Times New Roman";
+ font-size: 16px;
+ font-style: normal;
+ font-weight: 400;
+ line-height: 19.2px;
+}
+
+.cometchat .cometchat-groups .cometchat-list-item {
+ background: #fff;
+ border-right: 1px solid #f5f5f5;
+}
+
+.cometchat .cometchat-groups__list-item .cometchat-avatar {
+ background-color: #aa9ee8;
+ border-radius: 6.67px;
+}
+
+.cometchat .cometchat-groups .cometchat-list-item__body-title {
+ overflow: hidden;
+ color: #141414;
+ text-overflow: ellipsis;
+ font-family: "Times New Roman";
+ font-size: 16px;
+ font-style: normal;
+ font-weight: 400;
+ line-height: 19.2px;
+}
+
+.cometchat .cometchat-groups .cometchat-groups__subtitle {
+ overflow: hidden;
+ color: #727272;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ font-family: "Times New Roman";
+ font-size: 14px;
+ font-style: normal;
+ font-weight: 400;
+ line-height: 16.8px;
+}
+```
diff --git a/ui-kit/react/guide-block-unblock-user.mdx b/ui-kit/react/guide-block-unblock-user.mdx
index f758f45b3..952ee092c 100644
--- a/ui-kit/react/guide-block-unblock-user.mdx
+++ b/ui-kit/react/guide-block-unblock-user.mdx
@@ -1,51 +1,50 @@
---
title: "Block/Unblock Users"
sidebarTitle: "Block/Unblock Users"
+description: "Implement block and unblock user functionality in CometChat React UI Kit with composer state management."
---
-Implement user blocking functionality to prevent unwanted communication in your React chat app.
+
-## Overview
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Key components | `CometChatMessages` — uses `CometChat.blockUsers()` / `CometChat.unblockUsers()` SDK methods |
+| Init | `CometChatUIKit.init(UIKitSettings)` then `CometChatUIKit.login("UID")` |
+| Events | `CometChatUserEvents.ccUserBlocked`, `CometChatUserEvents.ccUserUnblocked` |
+| UI helpers | `CometChatConfirmDialog`, `CometChatToast` |
+| Sample app | [GitHub](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app) |
+| Related | [All Guides](/ui-kit/react/guide-overview) |
-The Block Users feature allows users to prevent specific users from sending them messages, effectively cutting off communication from unwanted contacts.
+
-- Block Users feature allows users to prevent specific users from sending them messages.
-- Provides privacy control, prevents harassment, and allows users to manage their communication preferences.
-- Your app will allow users to block/unblock other users, hide message composers for blocked users, and provide appropriate UI feedback for blocked states.
+Block/Unblock lets users prevent specific users from sending them messages. When blocked, the message composer is hidden and replaced with an unblock prompt.
----
-
-## Prerequisites
-
-- React v18.2.0+
-- CometChat React UI Kit v6.1.0+
-- CometChat Chat SDK JavaScript v4.0.13+
-- Project setup with initialized CometChat credentials (App ID, Auth Key, Region)
-- TypeScript support (recommended)
-- User authentication and chat functionality already implemented
+Before starting, complete the [Getting Started](/ui-kit/react/react-js-integration) guide for your framework.
---
## Components
-| Component / Class | Role |
-|:-----------------------------------|:-----|
-| **CometChat.blockUsers()** | SDK method to block specific users |
-| **CometChat.unblockUsers()** | SDK method to unblock previously blocked users |
-| **CometChatUserEvents.ccUserBlocked** | Event listener for when a user is blocked |
-| **CometChatUserEvents.ccUserUnblocked** | Event listener for when a user is unblocked |
-| **CometChatConfirmDialog** | Confirmation dialog for block/unblock actions |
-| **CometChatToast** | Toast notifications for action feedback |
+| Component / Class | Role |
+|:---|:---|
+| `CometChat.blockUsers()` | SDK method to block specific users |
+| `CometChat.unblockUsers()` | SDK method to unblock previously blocked users |
+| `CometChatUserEvents.ccUserBlocked` | Event fired when a user is blocked |
+| `CometChatUserEvents.ccUserUnblocked` | Event fired when a user is unblocked |
+| `CometChatConfirmDialog` | Confirmation dialog for block/unblock actions |
---
## Integration Steps
-### 1. Block User Function Implementation
+### 1. Block User
+
+Call `CometChat.blockUsers()` with the target UID. On success, update the local user object with `setBlockedByMe(true)` and emit `ccUserBlocked` so all subscribed components (like the composer) react to the change.
_File: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx)_
-```tsx
+```tsx lines
const onBlockUserClicked: () => Promise = () => {
let UID = user.getUid();
return new Promise(async (resolve, reject) => {
@@ -67,11 +66,13 @@ const onBlockUserClicked: () => Promise = () => {
---
-### 2. Unblock User Function Implementation
+### 2. Unblock User
+
+Call `CometChat.unblockUsers()` with the target UID. On success, reset the action items back to "Block" (instead of "Unblock"), update the local user object, and emit `ccUserUnblocked` to restore the composer.
_File: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx)_
-```tsx
+```tsx lines
const onUnblockUserClicked = () => {
let UID = user.getUid();
CometChat.unblockUsers([UID]).then(
@@ -96,11 +97,13 @@ const onUnblockUserClicked = () => {
---
-### 3. Block User Confirmation Dialog
+### 3. Confirmation Dialog
+
+Show a confirmation dialog before blocking. This prevents accidental blocks. The dialog uses `CometChatConfirmDialog` with localized title, message, and button text.
_File: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx)_
-```tsx
+```tsx lines
const getBlockUserConfirmationDialogView = () => {
return <>
@@ -119,11 +122,13 @@ const getBlockUserConfirmationDialogView = () => {
---
-### 4. Message Composer Blocked State
+### 4. Composer Blocked State
_File: [CometChatMessages.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatMessages/CometChatMessages.tsx)_
-```tsx
+When a user is blocked, the composer is replaced with an unblock prompt:
+
+```tsx lines
{showComposerState ? (
{
- if (messageUser?.getBlockedByMe()) {
- setShowComposer(false);
- }
- const unsubscribeFromEvents = subscribeToEvents();
- return () => {
- unsubscribeFromEvents();
- };
-}, [subscribeToEvents, selectedItem]);
-```
-
-- **Send Block/Unblock Action Handler**
+### 5. Event Listeners
_File: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx)_
-```tsx
-const onUserActionClick = (item: { name: string; icon: string; }) => {
- if (item.name == getLocalizedString("user_details_block")) {
- setShowBlockUserDialog(true);
- } else if (item.name == getLocalizedString("user_details_unblock")) {
- onUnblockUserClicked();
- }
-}
-```
+Subscribe to block/unblock events to update the UI in real time:
-- **Live Updates / Observers**
-
-_File: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx)_
-
-```tsx
+```tsx lines
const ccUserBlocked = CometChatUserEvents.ccUserBlocked.subscribe(user => {
if (user.getBlockedByMe()) {
setShowComposer(false);
@@ -214,76 +179,34 @@ const ccUserUnblocked = CometChatUserEvents.ccUserUnblocked.subscribe(user => {
---
-## Customization Options
-
-- Styling overrides for blocked states and confirmation dialogs
-- Custom block/unblock confirmation messages
-- Toast notification customization
-- Custom action items for different user states
-- Custom blocked state UI
-
----
-
-## Filtering / Edge Cases
+## Feature Matrix
-- Detect when blocking status changes mid-chat
-- Prevent duplicate block actions
-- Handle blocked users in search results
-- Respect group chat rules when blocking
-- Keep old messages visible from blocked users
+| Feature | Component / Method | File |
+|:---|:---|:---|
+| Block user | `CometChat.blockUsers([UID])` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
+| Unblock user | `CometChat.unblockUsers([UID])` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
+| Check blocked status | `user.getBlockedByMe()` | [CometChatMessages.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatMessages/CometChatMessages.tsx) |
+| Block confirmation | `CometChatConfirmDialog` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
+| Blocked composer state | `message-composer-blocked` | [CometChatMessages.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatMessages/CometChatMessages.tsx) |
+| Block events | `ccUserBlocked.subscribe()` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
+| Unblock events | `ccUserUnblocked.subscribe()` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
+| Update user state | `user.setBlockedByMe(boolean)` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
---
-## Error Handling
-
-```tsx
-CometChat.blockUsers([UID]).then(
- list => {
- user.setBlockedByMe(true);
- CometChatUserEvents.ccUserBlocked.next(user);
- toastTextRef.current = getLocalizedString("blocked_successfully");
- setShowToast(true);
- }, error => {
- console.log("Blocking user fails with error", error);
- }
-)
-```
-
-- Handle block/unblock network errors
-- Provide retry options
-- Maintain UI consistency on errors
-
----
-
-## Context-Specific Notes
-
-- Blocking applies only to private chats, not groups
-- Blocked users may still appear in lists but with indicators
-- Existing messages remain visible
-- Updates are reflected in real-time
-
----
-
-## Summary / Feature Matrix
-
-| Feature | Component / Method | File Reference |
-|:-----------------------|:------------------------------------|:---------------|
-| Block user | `CometChat.blockUsers([UID])` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
-| Unblock user | `CometChat.unblockUsers([UID])` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
-| Check blocked status | `user.getBlockedByMe()` | [CometChatMessages.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatMessages/CometChatMessages.tsx) |
-| Block confirmation dlg | `CometChatConfirmDialog` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
-| Blocked composer state | `message-composer-blocked` | [CometChatMessages.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatMessages/CometChatMessages.tsx) |
-| Block user events | `ccUserBlocked.subscribe()` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
-| Unblock user events | `ccUserUnblocked.subscribe()` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
-| Update user state | `user.setBlockedByMe(boolean)` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
-
----
-
-## Next Steps & Further Reading
-
-- [CometChat React UI Kit Documentation](https://www.cometchat.com/docs/ui-kit/react/overview)
-- [Sample App Repository](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app)
-- User Management Features
-- Advanced Customization Guide
-- Event Handling Documentation
-
+## Next Steps
+
+
+
+ Display and manage user lists.
+
+
+ Customize the message input component.
+
+
+ Browse all feature and formatter guides.
+
+
+ Full working sample application on GitHub.
+
+
\ No newline at end of file
diff --git a/ui-kit/react/guide-call-log-details.mdx b/ui-kit/react/guide-call-log-details.mdx
index a029b601e..aa839f150 100644
--- a/ui-kit/react/guide-call-log-details.mdx
+++ b/ui-kit/react/guide-call-log-details.mdx
@@ -1,54 +1,51 @@
---
title: "Call Log Details"
sidebarTitle: "Call Log Details"
+description: "Build a detailed call insights screen with metadata, participants, and recordings in CometChat React UI Kit."
---
-Display comprehensive call information and history when users select calls from the calls tab in your React chat app.
+
-## Overview
+| Field | Value |
+| --- | --- |
+| Packages | `@cometchat/chat-uikit-react` + `@cometchat/calls-sdk-javascript` |
+| Key components | `CometChatCallDetails`, `CometChatCallDetailsInfo`, `CometChatCallDetailsParticipants`, `CometChatCallDetailsRecording` |
+| Init | `CometChatUIKit.init(UIKitSettings)` then `CometChatUIKit.login("UID")` + Calls SDK installed |
+| Purpose | Detailed call insights screen with metadata, participants, and recordings |
+| Sample app | [GitHub](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app) |
+| Related | [All Guides](/ui-kit/react/guide-overview) |
-The Calls Log Details feature provides users with detailed information about specific calls, including call status, participants, duration, recordings, and call history.
+
-- Provides detailed information about specific calls when selected from the calls tab.
-- Enables users to review call details, understand outcomes, view participants, and access recordings for reference.
-- Users can view call details with tabbed navigation showing participants, recordings, and call history.
+Call Log Details shows call metadata, participants, duration, recordings, and history when a user selects a call from the Calls tab.
----
-
-## Prerequisites
-
-- React v18.2.0+
-- CometChat React UI Kit v6.1.0+
-- CometChat Chat SDK JavaScript v4.0.13+
-- CometChat Calls SDK JavaScript v4.0.11+
-- Project setup with initialized CometChat credentials (App ID, Auth Key, Region)
-- TypeScript support (recommended)
-- Call functionality implemented
-- Calls tab navigation configured
+Before starting, complete the [Getting Started](/ui-kit/react/react-js-integration) guide for your framework and install `@cometchat/calls-sdk-javascript`.
---
## Components
-| Component / Class | Role |
-|:--------------------------------|:-----|
-| **CometChatCallDetails** | Main container for call details display |
-| **CometChatCallDetailsInfo** | Shows call status, duration, and info |
-| **CometChatCallDetailsParticipants** | Displays call participants |
-| **CometChatCallDetailsRecording** | Shows call recordings if available |
-| **CometChatCallDetailsHistory** | Displays call history |
-| **CometChatCallLogs** | Calls list component in the calls tab |
+| Component / Class | Role |
+|:---|:---|
+| `CometChatCallDetails` | Main container for call details display |
+| `CometChatCallDetailsInfo` | Shows call status, duration, and info |
+| `CometChatCallDetailsParticipants` | Displays call participants |
+| `CometChatCallDetailsRecording` | Shows call recordings if available |
+| `CometChatCallDetailsHistory` | Displays call history |
+| `CometChatCallLogs` | Calls list component in the calls tab |
---
## Integration Steps
-### 1. Calls Tab Integration Setup
+### 1. Calls Tab Integration
+
+Render `CometChatCallLogs` when the "Calls" tab is active. When a call is clicked, dispatch it to the app state so the details panel can display it.
_File: [CometChatSelector.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatSelector/CometChatSelector.tsx)_
-```tsx
-{activeTab == "calls" ? (
+```tsx lines
+{activeTab === "calls" ? (
{
@@ -60,11 +57,13 @@ _File: [CometChatSelector.tsx](https://github.com/cometchat/cometchat-uikit-reac
---
-### 2. Call Details Component Integration
+### 2. Call Details Component
+
+Guard-check that the selected item is a `CometChat.Call` instance, then render `CometChatCallDetails`. The `onBack` callback clears the selection and returns to the call list.
_File: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx)_
-```tsx
+```tsx lines
const CallDetailsView = () => {
if (!selectedItem || !(selectedItem instanceof CometChat.Call)) return null;
@@ -82,11 +81,13 @@ const CallDetailsView = () => {
---
-### 3. Call Details Main Component Implementation
+### 3. Call Details Implementation
+
+The main details screen. It shows the caller's avatar and name at the top, call info (status, duration) below, and three tabs: Participants, Recording, and History. Tab selection switches the content panel.
_File: [CometChatCallLogDetails.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogDetails.tsx)_
-```tsx
+```tsx lines
export const CometChatCallDetails = (props: { selectedItem: any, onBack?: () => void }) => {
const { selectedItem, onBack } = props;
const callDetailTabItems = [
@@ -136,11 +137,13 @@ export const CometChatCallDetails = (props: { selectedItem: any, onBack?: () =>
---
-### 4. Call Information Display Component
+### 4. Call Information Display
+
+Renders the call status line (incoming/outgoing) based on who initiated the call. Compares the initiator's UID against the logged-in user to determine direction, then maps the SDK call status to a localized label.
_File: [CometChatCallLogInfo.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogInfo.tsx)_
-```tsx
+```tsx lines
export const CometChatCallDetailsInfo = (props: { call: any }) => {
const { call } = props;
const [loggedInUser, setLoggedInUser] = useState(null);
@@ -160,7 +163,6 @@ export const CometChatCallDetailsInfo = (props: { call: any }) => {
case CometChatUIKitConstants.calls.ended: {
return isSentByMeFlag ? getLocalizedString("calls_outgoing_call") : getLocalizedString('calls_incoming_call');
}
- // ... other status cases
}
}
@@ -179,127 +181,34 @@ export const CometChatCallDetailsInfo = (props: { call: any }) => {
---
-## Implementation Flow
-
-- **Fetch Data / Call Selection**
-
-```tsx
-const onSelectorItemClicked = (e: CometChat.Conversation | CometChat.User | CometChat.Group | CometChat.Call, type: string) => {
- if (type === "updateSelectedItemCall") {
- setSelectedItem(e as CometChat.Call);
- setAppState({ type: "updateSelectedItemCall", payload: e as CometChat.Call });
- }
-}
-```
-
-- **Load Call Data / Associated Information**
-
-```tsx
-useEffect(() => {
- const loggedInUser = CometChatUIKitLoginListener.getLoggedInUser();
- const callUser = verifyCallUser(selectedItem, loggedInUser!);
-
- if (selectedItem.receiverType === CometChatUIKitConstants.MessageReceiverType.user) {
- CometChat.getUser(callUser.uid).then((response: CometChat.User) => {
- setUser(response);
- });
- }
-}, [selectedItem]);
-```
-
-- **Display Call Details / Tab Navigation**
-
-```tsx
-const [activeTab, setActiveTab] = useState("Participants");
-
-const renderTabContent = () => {
- switch (activeTab) {
- case "Participants":
- return ;
- case "Recording":
- return ;
- case "History":
- return ;
- default:
- return null;
- }
-}
-```
-
-- **Live Updates / User Status Monitoring**
-
-```tsx
-useEffect(() => {
- let isBlocked = new MessageUtils().getUserStatusVisible(user);
- const userListenerId = "users_custom" + Date.now();
-
- if (isBlocked) {
- setSubtitleText("");
- return;
- }
-
- setSubtitleText(user?.getStatus());
-
- CometChat.addUserListener(
- userListenerId,
- new CometChat.UserListener({
- onUserOnline: (onlineUser: CometChat.User) => {
- if (user?.getUid() === onlineUser.getUid()) {
- setSubtitleText(onlineUser?.getStatus());
- }
- },
- onUserOffline: (offlineUser: CometChat.User) => {
- if (user?.getUid() === offlineUser?.getUid()) {
- setSubtitleText(offlineUser?.getStatus());
- }
- },
- })
- );
-
- return () => {
- CometChat.removeUserListener(userListenerId);
- };
-}, [user]);
-```
-
----
-
-## Customization Options
-
-- Styling overrides via CSS
-- Custom tab configurations
-- Custom call status labels and icons
-- User profile customization
-- Duration and date formatting
-- Icon replacements
-
----
-
-## Filtering / Edge Cases
-
-- Different call types (audio/video/group)
-- Call status variations (missed, rejected, busy, etc.)
-- Unavailable users
-- Missing duration or recording data
-- Large call history handling
-
----
-
-## Error Handling & Data Validation
+## Feature Matrix
-- Includes try-catch blocks for duration, history, and call list fetching.
+| Feature | Component / Method | File |
+|:---|:---|:---|
+| Calls tab integration | `CometChatCallLogs` | [CometChatSelector.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatSelector/CometChatSelector.tsx) |
+| Call details display | `CometChatCallDetails` | [CometChatCallLogDetails.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogDetails.tsx) |
+| Call information | `CometChatCallDetailsInfo` | [CometChatCallLogInfo.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogInfo.tsx) |
+| Call participants | `CometChatCallDetailsParticipants` | [CometChatCallLogParticipants.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogParticipants.tsx) |
+| Call recordings | `CometChatCallDetailsRecording` | [CometChatCallLogRecordings.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogRecordings.tsx) |
+| Call history | `CometChatCallDetailsHistory` | [CometChatCallLogHistory.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogHistory.tsx) |
+| Tab navigation | `activeTab` state | [CometChatCallLogDetails.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogDetails.tsx) |
+| User status monitoring | `CometChat.addUserListener()` | [CometChatCallLogDetails.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogDetails.tsx) |
---
-## Summary / Feature Matrix
-
-| Feature | Component / Method | File Reference |
-|:----------------------|:-----------------------------------|:----------------|
-| Calls tab integration | `CometChatCallLogs` | [CometChatSelector.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatSelector/CometChatSelector.tsx) |
-| Call details display | `CometChatCallDetails` | [CometChatCallLogDetails.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogDetails.tsx) |
-| Call information | `CometChatCallDetailsInfo` | [CometChatCallLogInfo.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogInfo.tsx) |
-| Call participants | `CometChatCallDetailsParticipants`| [CometChatCallLogParticipants.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogParticipants.tsx) |
-| Call recordings | `CometChatCallDetailsRecording` | [CometChatCallLogRecordings.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogRecordings.tsx) |
-| Call history | `CometChatCallDetailsHistory` | [CometChatCallLogHistory.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogHistory.tsx) |
-| Tab navigation | `activeTab` state | [CometChatCallLogDetails.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogDetails.tsx) |
-| User status monitoring| `CometChat.addUserListener()` | [CometChatCallLogDetails.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCallLog/CometChatCallLogDetails.tsx) |
+## Next Steps
+
+
+
+ The call logs component reference.
+
+
+ Overview of calling capabilities.
+
+
+ Browse all feature and formatter guides.
+
+
+ Full working sample application on GitHub.
+
+
\ No newline at end of file
diff --git a/ui-kit/react/guide-group-chat.mdx b/ui-kit/react/guide-group-chat.mdx
index b62e735ec..eb4bd755a 100644
--- a/ui-kit/react/guide-group-chat.mdx
+++ b/ui-kit/react/guide-group-chat.mdx
@@ -1,54 +1,50 @@
---
title: "Group Chat"
sidebarTitle: "Group Chat"
+description: "Implement group management including create, join, members, roles, and ownership transfer in CometChat React UI Kit."
---
-Implement comprehensive group management functionality including creation, joining, member management, and administrative controls in your React chat app.
+
----
-
-## Overview
-
-Groups Management provides a complete set of features for creating, managing, and participating in group conversations, including member administration, permissions, and group lifecycle management.
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Key components | `CometChatGroups`, `CometChatGroupMembers`, `CometChatCreateGroup`, `CometChatJoinGroup`, `CometChatAddMembers`, `CometChatBannedMembers`, `CometChatTransferOwnership` |
+| Init | `CometChatUIKit.init(UIKitSettings)` then `CometChatUIKit.login("UID")` |
+| Features | Create public/private/password-protected groups, manage members, roles, ownership transfer |
+| Sample app | [GitHub](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app) |
+| Related | [All Guides](/ui-kit/react/guide-overview) |
-- Provides a full set of features for creating and managing group conversations, including member administration, permissions, and lifecycle management.
-- Enables users to create collaborative spaces, manage team communications, control access through different group types, and maintain group organization through administrative tools.
-- Your app will support full group lifecycle management from creation to administration, allowing users to create public/private/password-protected groups, manage members, and control group operations.
+
----
-
-## Prerequisites
+This guide covers the full group lifecycle: creating groups, joining them, managing members, changing roles, and transferring ownership.
-- React v18.2.0+
-- CometChat React UI Kit v6.1.0+
-- CometChat Chat SDK JavaScript v4.0.13+
-- Project setup with initialized CometChat credentials (App ID, Auth Key, Region)
-- TypeScript support (recommended)
-- Basic chat functionality already implemented
-- User authentication already configured
+Before starting, complete the [Getting Started](/ui-kit/react/react-js-integration) guide for your framework.
---
## Components
-| Component / Class | Role |
-|--------------------------------|------|
-| **CometChatCreateGroup** | Creates new groups with different types and settings |
-| **CometChatJoinGroup** | Handles joining public and password-protected groups |
-| **CometChatGroupMembers** | Displays and manages group member lists |
-| **CometChatAddMembers** | Adds new members to existing groups |
-| **CometChatBannedMembers** | Manages banned members and unban operations |
-| **CometChatTransferOwnership** | Transfers group ownership to other members |
+| Component / Class | Role |
+|:---|:---|
+| `CometChatCreateGroup` | Creates new groups with different types and settings |
+| `CometChatJoinGroup` | Handles joining public and password-protected groups |
+| `CometChatGroupMembers` | Displays and manages group member lists |
+| `CometChatAddMembers` | Adds new members to existing groups |
+| `CometChatBannedMembers` | Manages banned members and unban operations |
+| `CometChatTransferOwnership` | Transfers group ownership to other members |
---
## Integration Steps
-### 1. Create Group Implementation
+### 1. Create Group
+
+Build a form that collects a group name, type (public/private/password), and optional password. On submit, generate a unique GUID, call `CometChat.createGroup()`, and emit `ccGroupCreated` so the rest of the UI updates.
_File: [CometChatCreateGroup.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCreateGroup/CometChatCreateGroup.tsx)_
-```tsx
+```tsx lines
export const CometChatCreateGroup = ({ setShowCreateGroup, onGroupCreated }: CreateGroupProps) => {
const [groupType, setGroupType] = useState("public");
const [groupName, setGroupName] = useState("");
@@ -73,12 +69,14 @@ export const CometChatCreateGroup = ({ setShowCreateGroup, onGroupCreated }: Cre
---
-### 2. Join Group Implementation
+### 2. Join Group
+
+Handle joining for both public and password-protected groups. Call `CometChat.joinGroup()` with the group's GUID, type, and password (if applicable). On success, emit `ccGroupMemberJoined` to update the member list across the app.
_File: [CometChatJoinGroup.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatJoinGroup/CometChatJoinGroup.tsx)_
-```tsx
-export const CometChatJoinGroup = ({ group, onHide, onProtectedGroupJoin }) => {
+```tsx lines
+export const CometChatJoinGroup = ({ group, onProtectedGroupJoin }) => {
const [password, setPassword] = useState("");
const [error, setError] = useState(false);
const loggedInUser = CometChatUIKitLoginListener.getLoggedInUser();
@@ -86,7 +84,6 @@ export const CometChatJoinGroup = ({ group, onHide, onProtectedGroupJoin }) => {
const joinGroup = () => {
CometChat.joinGroup(group.getGuid(), group.getType(), password)
.then((res) => {
- onHide();
onProtectedGroupJoin(group);
CometChatGroupEvents.ccGroupMemberJoined.next({
joinedGroup: res,
@@ -100,11 +97,13 @@ export const CometChatJoinGroup = ({ group, onHide, onProtectedGroupJoin }) => {
---
-### 3. View Group Members Implementation
+### 3. View Group Members
+
+Render the member list for a group using `CometChatGroupMembers`. Pass `onItemClick` to handle member selection and `options` to add context-menu actions like "View Profile".
_File: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx)_
-```tsx
+```tsx lines
const GroupMembersView = ({ group }: { group: CometChat.Group }) => {
return (
@@ -127,13 +126,16 @@ const GroupMembersView = ({ group }: { group: CometChat.Group }) => {
};
```
+
---
-### 4. Add Members to Group Implementation
+### 4. Add Members
+
+Let admins select users and add them to the group. Collect selected UIDs, call `CometChat.addMembersToGroup()`, and emit `ccGroupMemberAdded` so the member list refreshes.
_File: [CometChatAddMembers.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatAddMembers/CometChatAddMembers.tsx)_
-```tsx
+```tsx lines
export const CometChatAddMembers = ({ group, onBack }: IAddMembersProps) => {
const [selectedUsers, setSelectedUsers] = useState([]);
const [isLoading, setIsLoading] = useState(false);
@@ -161,11 +163,13 @@ export const CometChatAddMembers = ({ group, onBack }: IAddMembersProps) => {
---
-### 5. Ban Member from Group Implementation
+### 5. Ban Members
+
+Fetch the list of banned members using `BannedMembersRequestBuilder`. This component displays banned users and provides unban functionality for group admins.
_File: [CometChatBannedMembers.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatBannedMembers/CometChatBannedMembers.tsx)_
-```tsx
+```tsx lines
export const CometChatBannedMembers = ({ group }: bannedMembersProp) => {
const [bannedMembers, setBannedMembers] = useState([]);
const [state, setState] = useState(States.loading);
@@ -189,13 +193,16 @@ export const CometChatBannedMembers = ({ group }: bannedMembersProp) => {
};
```
+
---
-### 6. Change Member Scope Implementation
+### 6. Change Member Scope
+
+Promote or demote a member by calling `CometChat.updateGroupMemberScope()`. Pass the member's UID, the new scope (`admin`, `moderator`, or `participant`), and the group GUID. Emit `ccGroupMemberScopeChanged` so the UI reflects the role change.
_File: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx)_
-```tsx
+```tsx lines
const changeMemberScope = async (member: CometChat.GroupMember, newScope: string) => {
try {
await CometChat.updateGroupMemberScope(member.getUid(), newScope, group.getGuid());
@@ -207,21 +214,21 @@ const changeMemberScope = async (member: CometChat.GroupMember, newScope: string
newScope: newScope,
oldScope: member.getScope()
});
- showSuccessMessage("Member scope updated successfully");
} catch (error) {
console.error("Failed to update member scope:", error);
- showErrorMessage("Failed to update member scope");
}
};
```
---
-### 7. Transfer Group Ownership Implementation
+### 7. Transfer Ownership
+
+Let the current owner select a member and transfer ownership via `CometChat.transferGroupOwnership()`. The group object is cloned and updated locally, then `ccOwnershipChanged` is emitted to sync the UI.
_File: [CometChatTransferOwnership.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatTransferOwnership/CometChatTransferOwnership.tsx)_
-```tsx
+```tsx lines
export const CometChatTransferOwnership = ({ group, onClose }: ITransferOwnershipProps) => {
const [selectedMember, setSelectedMember] = useState(null);
const [isLoading, setIsLoading] = useState(false);
@@ -252,96 +259,34 @@ export const CometChatTransferOwnership = ({ group, onClose }: ITransferOwnershi
---
-## Implementation Flow
-
-- **Fetch Data / Group Information**: Retrieve group details and member lists.
-- **Load Group Data / Member Information**: Fetch members with pagination.
-- **Execute Group Operations / Action Handlers**: Handle creation, adding, banning, etc., with proper error handling.
-- **Live Updates / Event Handling**: Subscribe to CometChatGroupEvents for member changes and update UI in real time.
-
----
-
-## Customization Options
-
-- Styling: Override CSS classes
-- Group Types: Customize available types
-- Member Permissions: Add custom roles
-- UI Components: Modify list/form elements
-- Validation Rules: Add extra checks
-- Event Handling: Custom responses
-- Search & Filtering: Add search for members
-
----
-
-## Filtering / Edge Cases
+## Feature Matrix
-- Handle group type restrictions, member limits, and permission checks
-- Manage large groups efficiently
-- Handle empty groups and network errors gracefully
-- Maintain UI consistency with concurrent actions
+| Feature | Component / Method | File |
+|:---|:---|:---|
+| Create group | `CometChatCreateGroup` | [CometChatCreateGroup.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCreateGroup/CometChatCreateGroup.tsx) |
+| Join group | `CometChatJoinGroup` | [CometChatJoinGroup.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatJoinGroup/CometChatJoinGroup.tsx) |
+| View members | `CometChatGroupMembers` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
+| Add members | `CometChatAddMembers` | [CometChatAddMembers.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatAddMembers/CometChatAddMembers.tsx) |
+| Ban members | `CometChatBannedMembers` | [CometChatBannedMembers.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatBannedMembers/CometChatBannedMembers.tsx) |
+| Change scope | `updateGroupMemberScope()` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
+| Transfer ownership | `CometChatTransferOwnership` | [CometChatTransferOwnership.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatTransferOwnership/CometChatTransferOwnership.tsx) |
+| Group events | `CometChatGroupEvents` | Multiple files |
---
-## Error Handling & Permission Management
-
-```tsx
-const handleGroupOperation = async (operation: () => Promise) => {
- try {
- if (!hasPermission(currentUser, currentGroup, 'manage_members')) {
- showErrorMessage("You don't have permission to perform this action");
- return;
- }
- const result = await operation();
- showSuccessMessage("Operation completed successfully");
- return result;
- } catch (error) {
- if (error.code === "ERR_PERMISSION_DENIED") {
- showErrorMessage("Permission denied for this operation");
- } else if (error.code === "ERR_GROUP_NOT_FOUND") {
- showErrorMessage("Group not found or no longer exists");
- } else if (error.code === "ERR_MEMBER_NOT_FOUND") {
- showErrorMessage("Member not found in this group");
- } else {
- showErrorMessage("An error occurred while performing the operation");
- }
- console.error("Group operation failed:", error);
- }
-};
-```
-
----
-
-## Context-Specific Notes
-
-- Different handling for public, private, password-protected groups
-- Different permissions for admins, moderators, participants
-- Optimize for large groups
-- Real-time updates across devices
-- Works cross-platform
-
----
-
-## Summary / Feature Matrix
-
-| Feature | Component / Method | File Reference |
-|--------------------|--------------------------------|----------------|
-| Create group | `CometChatCreateGroup` | [CometChatCreateGroup.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatCreateGroup/CometChatCreateGroup.tsx) |
-| Join group | `CometChatJoinGroup` | [CometChatJoinGroup.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatJoinGroup/CometChatJoinGroup.tsx) |
-| View members | `CometChatGroupMembers` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
-| Add members | `CometChatAddMembers` | [CometChatAddMembers.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatAddMembers/CometChatAddMembers.tsx) |
-| Ban members | `CometChatBannedMembers` | [CometChatBannedMembers.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatBannedMembers/CometChatBannedMembers.tsx) |
-| Change scope | `updateGroupMemberScope()` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
-| Transfer ownership | `CometChatTransferOwnership` | [CometChatTransferOwnership.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatTransferOwnership/CometChatTransferOwnership.tsx) |
-| Group events | `CometChatGroupEvents` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx), [CometChatAddMembers.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatAddMembers/CometChatAddMembers.tsx), [CometChatBannedMembers.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatBannedMembers/CometChatBannedMembers.tsx), [CometChatTransferOwnership.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatTransferOwnership/CometChatTransferOwnership.tsx) |
-| Member management | `CometChat.GroupMembersRequestBuilder` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx), [CometChatTransferOwnership.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatTransferOwnership/CometChatTransferOwnership.tsx) |
-
----
-
-## Next Steps & Further Reading
-
-- [CometChat React UI Kit Documentation](https://www.cometchat.com/docs/ui-kit/react/overview)
-- [Sample App Repository](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app)
-- Group Management Features
-- Advanced Customization Guide
-- Member Management Documentation
-
+## Next Steps
+
+
+
+ Display and manage group lists.
+
+
+ Display and manage group member lists.
+
+
+ Browse all feature and formatter guides.
+
+
+ Full working sample application on GitHub.
+
+
\ No newline at end of file
diff --git a/ui-kit/react/guide-message-privately.mdx b/ui-kit/react/guide-message-privately.mdx
index 1d0add7ad..71d89dde6 100644
--- a/ui-kit/react/guide-message-privately.mdx
+++ b/ui-kit/react/guide-message-privately.mdx
@@ -1,51 +1,48 @@
---
title: "Message Privately"
sidebarTitle: "Message Privately"
+description: "Launch a direct 1:1 chat from a group member profile in CometChat React UI Kit."
---
-Enable users to initiate private conversations with group members directly from group chat interfaces.
+
-## Overview
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Key components | `CometChatMessages`, `CometChatGroupMembers`, `CometChatMessageComposer`, `CometChatMessageList`, `CometChatMessageHeader` |
+| Init | `CometChatUIKit.init(UIKitSettings)` then `CometChatUIKit.login("UID")` |
+| Purpose | Launch a direct 1:1 chat from a group member profile |
+| Sample app | [GitHub](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app) |
+| Related | [All Guides](/ui-kit/react/guide-overview) |
-The Message Privately (from a Group) feature allows users to start private, one-on-one conversations with specific group members while remaining in the group context.
+
-- Allows users to start private conversations with specific group members directly from a group.
-- Enables confidential discussions, sharing sensitive information, or asking personal questions without disrupting the group conversation.
-- Your app will support initiating private messages from group contexts, allowing users to seamlessly switch between group discussions and private conversations.
+Message Privately lets users start a direct 1:1 conversation with a group member without leaving the group context. The user can return to the group after the private chat.
----
-
-## Prerequisites
-
-- React v18.2.0+
-- CometChat React UI Kit v6.1.0+
-- CometChat Chat SDK JavaScript v4.0.13+
-- Project setup with initialized CometChat credentials (App ID, Auth Key, Region)
-- TypeScript support (recommended)
-- Group chat functionality already implemented
-- User management and conversation handling already implemented
+Before starting, complete the [Getting Started](/ui-kit/react/react-js-integration) guide for your framework.
---
## Components
-| Component / Class | Role |
-|--------------------------|------|
-| **CometChatGroupMembers** | Displays group members with click handlers for private messaging |
-| **CometChatUsers** | Alternative user list component for private messaging |
-| **CometChatMessageComposer** | Input component for composing private messages |
-| **CometChatMessageList** | Displays private conversation messages |
-| **CometChatMessageHeader** | Header showing private chat information |
+| Component / Class | Role |
+|:---|:---|
+| `CometChatGroupMembers` | Displays group members with click handlers for private messaging |
+| `CometChatMessageComposer` | Input component for composing private messages |
+| `CometChatMessageList` | Displays private conversation messages |
+| `CometChatMessageHeader` | Header showing private chat information |
---
## Integration Steps
-### 1. Group Member Click Handler Setup
+### 1. Group Member Click Handler
+
+When a group member is clicked, cast them to a `User` object and initiate a private chat. The current group is saved so the user can return to it later. `CometChat.getConversation()` fetches or creates the 1:1 conversation.
_File: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx)_
-```tsx
+```tsx lines
const handleGroupMemberClick = (groupMember: CometChat.GroupMember) => {
const user = groupMember as CometChat.User;
startPrivateChatFromGroup(user, currentGroup);
@@ -62,18 +59,19 @@ const startPrivateChatFromGroup = (user: CometChat.User, group: CometChat.Group)
})
.catch((error) => {
console.error("Failed to start private chat:", error);
- showErrorMessage("Unable to start private conversation");
});
}
```
---
-### 2. Group Members Component Integration
+### 2. Group Members with Private Messaging Option
+
+Add a "Message Privately" option to the group members list. The `options` prop adds a context-menu action that triggers the private chat flow when clicked.
_File: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx)_
-```tsx
+```tsx lines
const GroupMembersWithPrivateMessaging = ({ group }: { group: CometChat.Group }) => {
return (
-```
-
-- **Load User Data / Conversation State**
-
-_File: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx)_
-
-```tsx
-const startPrivateChatFromGroup = async (user: CometChat.User, group: CometChat.Group) => {
- try {
- setAppState({ type: "updatePreviousGroup", payload: group });
- const conversation = await CometChat.getConversation(
- user.getUid(),
- CometChatUIKitConstants.MessageReceiverType.user
- );
-
- setSelectedItem(conversation);
- setAppState({ type: "updatePrivateChatUser", payload: user });
- setAppState({ type: "updateShowPrivateChat", payload: true });
-
- } catch (error) {
- console.error("Failed to start private chat:", error);
- showErrorMessage("Unable to start private conversation");
- }
-}
-```
-
-- **Send Private Message / Action Handler**
-
-_File: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx)_
-
-```tsx
-const sendPrivateMessageFromGroup = async (messageText: string, receiverId: string) => {
- const textMessage = new CometChat.TextMessage(
- receiverId,
- messageText,
- CometChatUIKitConstants.MessageReceiverType.user
- );
-
- try {
- const sentMessage = await CometChat.sendMessage(textMessage);
- console.log("Private message sent from group context:", sentMessage);
- showSuccessMessage("Private message sent");
- } catch (error) {
- console.error("Failed to send private message:", error);
- showErrorMessage("Failed to send private message");
- }
-}
-```
-
-- **Live Updates / Context Switching**
-
-_Files: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx), [appReducer.ts](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/context/appReducer.ts)_
-
-```tsx
-useEffect(() => {
- const messageListener = CometChat.addMessageListener(
- "privateMessageFromGroupListener",
- new CometChat.MessageListener({
- onTextMessageReceived: (textMessage: CometChat.TextMessage) => {
- if (textMessage.getReceiverType() === CometChatUIKitConstants.MessageReceiverType.user) {
- updatePrivateConversation(textMessage);
- if (!showPrivateChat) {
- showNotification(`Private message from ${textMessage.getSender().getName()}`);
- }
- }
- }
- })
- );
-
- return () => CometChat.removeMessageListener("privateMessageFromGroupListener");
-}, [showPrivateChat]);
-```
-
----
-
-## Customization Options
-
-- Styling: Override CSS classes for private chat from group interface
-- Member Options: Customize available actions for group members
-- Navigation: Customize return-to-group behavior and transitions
-- Message Types: Support various message types in private conversations
-- Context Display: Customize how group context is shown in private chat
-- Member Filtering: Control which group members can receive private messages
-
----
-
-## Filtering / Edge Cases
-
-- Handle permissions
-- Preserve group context
-- Manage blocked users
-- Scale for large groups
-
----
-
-## Error Handling & Context Management
-
-```tsx
-const startPrivateChatFromGroup = async (user: CometChat.User, group: CometChat.Group) => {
- try {
- if (user.getBlockedByMe()) {
- showErrorMessage("Cannot send private message to blocked user");
- return;
- }
- if (!group.getMembers().some(member => member.getUid() === user.getUid())) {
- showErrorMessage("User is no longer a member of this group");
- return;
- }
-
- setAppState({ type: "updatePreviousGroup", payload: group });
- const conversation = await CometChat.getConversation(
- user.getUid(),
- CometChatUIKitConstants.MessageReceiverType.user
- );
-
- setSelectedItem(conversation);
- setAppState({ type: "updateShowPrivateChat", payload: true });
-
- } catch (error) {
- if (error.code === "ERR_USER_NOT_FOUND") {
- showErrorMessage("User not found or unavailable");
- } else if (error.code === "ERR_CONVERSATION_CREATE_FAILED") {
- showErrorMessage("Unable to create private conversation");
- } else {
- showErrorMessage("An error occurred while starting private chat");
- }
- }
-}
-```
-
----
-
-## Summary / Feature Matrix
+## Feature Matrix
-| Feature | Component / Method | File Reference |
-|-------------------------|--------------------------------|----------------|
-| Group member selection | `CometChatGroupMembers` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
-| Private chat initiation | `startPrivateChatFromGroup()` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
-| Private chat interface | `PrivateChatFromGroupView` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
-| Context preservation | `updatePreviousGroup` | [appReducer.ts](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/context/appReducer.ts) |
-| Private message sending | `sendPrivateMessageFromGroup()`| [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
-| Return to group | `returnToGroup()` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
-| Member options | `options` in CometChatGroupMembers | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
-| State management | `updateShowPrivateChat` | [appReducer.ts](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/context/appReducer.ts) |
+| Feature | Component / Method | File |
+|:---|:---|:---|
+| Group member selection | `CometChatGroupMembers` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
+| Private chat initiation | `startPrivateChatFromGroup()` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
+| Private chat interface | `PrivateChatFromGroupView` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
+| Context preservation | `updatePreviousGroup` | [appReducer.ts](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/context/appReducer.ts) |
+| Return to group | `returnToGroup()` | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
+| Member options | `options` in CometChatGroupMembers | [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx) |
+| State management | `updateShowPrivateChat` | [appReducer.ts](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/context/appReducer.ts) |
---
-## Next Steps & Further Reading
-
-- [CometChat React UI Kit Documentation](https://www.cometchat.com/docs/ui-kit/react/overview)
-- [Sample App Repository](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app)
-- Group Management Features
-- User Management Features
-- Message Types & Features
+## Next Steps
+
+
+
+ Display and manage group member lists.
+
+
+ Render real-time message threads.
+
+
+ Browse all feature and formatter guides.
+
+
+ Full working sample application on GitHub.
+
+
diff --git a/ui-kit/react/guide-new-chat.mdx b/ui-kit/react/guide-new-chat.mdx
index 54ee2e6b2..8c4fe34ef 100644
--- a/ui-kit/react/guide-new-chat.mdx
+++ b/ui-kit/react/guide-new-chat.mdx
@@ -1,51 +1,49 @@
---
title: "New Chat"
sidebarTitle: "New Chat"
+description: "Build a unified new chat entry point for starting 1:1 or group conversations in CometChat React UI Kit."
---
-Enable users to create new conversations with individual users or join existing groups in your React chat app.
+
-## Overview
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Key components | `CometChatUsers`, `CometChatGroups`, `CometChatJoinGroup`, `CometChatSelector` |
+| Init | `CometChatUIKit.init(UIKitSettings)` then `CometChatUIKit.login("UID")` |
+| Purpose | Unified new chat entry point for starting 1:1 or group conversations |
+| Sample app | [GitHub](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app) |
+| Related | [All Guides](/ui-kit/react/guide-overview) |
-The New Chat feature allows users to initiate conversations with other users or join group conversations, providing a seamless way to start new communications.
+
-- Allows users to initiate conversations with other users or join group conversations.
-- Enables users to expand their network, join group discussions, and create new chat threads without navigating through complex menus.
-- Your app will provide an intuitive interface for users to discover and connect with other users, join groups, and start new conversations with proper navigation and state management.
+The New Chat feature lets users start conversations with other users or join group conversations from a single interface.
----
-
-## Prerequisites
-
-- React v18.2.0+
-- CometChat React UI Kit v6.1.0+
-- CometChat Chat SDK JavaScript v4.0.13+
-- Project setup with initialized CometChat credentials (App ID, Auth Key, Region)
-- TypeScript support (recommended)
-- User authentication and basic chat functionality implemented
-- User and group management components available
+Before starting, complete the [Getting Started](/ui-kit/react/react-js-integration) guide for your framework.
---
## Components
-| Component / Class | Role |
-|--------------------------|------|
-| **CometChatNewChatView** | Main container for new chat creation interface |
-| **CometChatUsers** | Displays list of available users for chat creation |
-| **CometChatGroups** | Shows available groups for joining |
-| **CometChatJoinGroup** | Handles protected group joining process |
-| **CometChatSelector** | Navigation component with new chat button |
+| Component / Class | Role |
+|:---|:---|
+| `CometChatNewChatView` | Main container for new chat creation interface |
+| `CometChatUsers` | Displays list of available users for chat creation |
+| `CometChatGroups` | Shows available groups for joining |
+| `CometChatJoinGroup` | Handles protected group joining process |
+| `CometChatSelector` | Navigation component with new chat button |
---
## Integration Steps
-### 1. New Chat State Management Setup
+### 1. New Chat State Management
+
+Track whether the new chat view is visible and which user/group was selected. When the "New Chat" button is clicked, show the view and hide any open side panels.
_File: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx)_
-```tsx
+```tsx lines
const [showNewChat, setShowNewChat] = useState(false);
const [newChat, setNewChat] = useState<{
user?: CometChat.User,
@@ -58,15 +56,15 @@ const onNewChatClicked = () => {
}
```
-Manages the new chat view visibility and resets side components when opening new chat.
-
---
-### 2. New Chat View Component Integration
+### 2. Conditional Rendering
+
+Switch between the new chat view, the messages view, or an empty state depending on the current app state. `useCallback` prevents unnecessary re-renders.
_File: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx)_
-```tsx
+```tsx lines
const InformationComponent = useCallback(() => {
return (
<>
@@ -81,15 +79,15 @@ const InformationComponent = useCallback(() => {
}, [activeTab, showNewChat, selectedItem, newChat, appState.goToMessageId]);
```
-Conditionally renders the new chat view or message view based on application state.
-
---
-### 3. New Chat View Implementation
+### 3. New Chat View
+
+The main new chat interface with a header, back button, and tabbed navigation between Users and Groups. Selecting a tab switches the list below.
_File: [CometChatHome.tsx](https://github.com/cometchat/cometchat-uikit-react/blob/v6/sample-app/src/components/CometChatHome/CometChatHome.tsx)_
-```tsx
+```tsx lines
const CometChatNewChatView: React.FC = () => {
const [selectedTab, setSelectedTab] = useState('user');
const [group, setGroup] = useState();
@@ -101,7 +99,6 @@ const CometChatNewChatView: React.FC = () => {
return (
+ );
+ };
return ;
};
-
-export default IncomingCallsDemo;
```
-
-
-
-```css
+
+```css lines
.incoming-call__itemview {
display: flex;
flex-direction: column;
@@ -927,7 +449,7 @@ export default IncomingCallsDemo;
.incoming-call__itemview .cometchat-avatar__text {
color: #FFF;
text-align: center;
- font: 700 32px Roboto
+ font: 700 32px Roboto;
}
.incoming-call__itemview-title {
@@ -941,7 +463,37 @@ export default IncomingCallsDemo;
font: 400 16px Roboto;
}
```
-
-
+
+## Theme and Styling
+
+Using CSS, customize the look and feel of the component. The root CSS class is `.cometchat-incoming-call`.
+
+
+
+
+
+```tsx lines
+
+```
+
+```css lines
+.cometchat-incoming-call {
+ border-radius: 18.5px;
+ border: 1.542px solid #aa9ee8;
+ background: #fff;
+}
+
+.cometchat-incoming-call__button-decline .cometchat-button__text {
+ color: #f44649;
+}
+
+.cometchat-incoming-call__button-accept .cometchat-button {
+ background-color: #6852d6;
+}
+
+.cometchat-incoming-call__button-accept .cometchat-button__text {
+ color: #fff;
+}
+```
\ No newline at end of file
diff --git a/ui-kit/react/link/changelog.mdx b/ui-kit/react/link/changelog.mdx
index 8c698a26d..e3acadbd7 100644
--- a/ui-kit/react/link/changelog.mdx
+++ b/ui-kit/react/link/changelog.mdx
@@ -1,4 +1,4 @@
---
title: "Changelog"
url: "https://github.com/cometchat/cometchat-uikit-react/releases?q=v6&expanded=true"
----
\ No newline at end of file
+---
diff --git a/ui-kit/react/link/figma.mdx b/ui-kit/react/link/figma.mdx
index 172dd3788..784cf16e7 100644
--- a/ui-kit/react/link/figma.mdx
+++ b/ui-kit/react/link/figma.mdx
@@ -1,4 +1,4 @@
---
title: "Figma Design"
url: "https://www.figma.com/community/file/1442863561340379957/cometchat-ui-kit-for-web"
----
\ No newline at end of file
+---
diff --git a/ui-kit/react/link/sample.mdx b/ui-kit/react/link/sample.mdx
index 3f7e45be6..d7748ae0d 100644
--- a/ui-kit/react/link/sample.mdx
+++ b/ui-kit/react/link/sample.mdx
@@ -1,4 +1,4 @@
---
title: "React Sample App"
url: "https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app"
----
\ No newline at end of file
+---
diff --git a/ui-kit/react/localize.mdx b/ui-kit/react/localize.mdx
index 45f62ad52..b1d3ea898 100644
--- a/ui-kit/react/localize.mdx
+++ b/ui-kit/react/localize.mdx
@@ -1,87 +1,79 @@
---
title: "Localization"
sidebarTitle: "Localize"
+description: "Configure multi-language localization, custom translations, and date/time formatting in CometChat React UI Kit."
---
-## **Overview**
+
-React UI Kit provides **multi-language localization** to **adapt** the UI elements based on the user's preferred language settings. The **CometChatLocalize** class allows developers to:
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatLocalize } from "@cometchat/chat-uikit-react";` |
+| Set language | `CometChatLocalize.setCurrentLanguage("fr")` |
+| Init with config | `CometChatLocalize.init({ language: "es", fallbackLanguage: "en-US", disableAutoDetection: false })` |
+| Add translations | `CometChatLocalize.addTranslation({ "en-US": { "welcome_message": "Welcome!" } })` |
+| Supported languages | 19: en-US, en-GB, nl, fr, de, hi, it, ja, ko, pt, ru, es, tr, zh, zh-TW, ms, sv, lt, hu |
+| Date formatting | Use `CalendarObject` for custom date/time patterns |
+| Source | [GitHub](https://github.com/cometchat/cometchat-uikit-react/blob/v6/src/resources/CometChatLocalize/cometchat-localize.ts) |
-* **Automatically detect and apply a language** based on browser/device settings.
-* **Manually change the UI language**.
-* **Format date and time** based on localization settings.
+
-The v6 React UI Kit expands support for **multiple languages** and allows developers to define **custom translations**.\
-The localization system now includes **language JSON files**, which store translations, and an **improved CometChatLocalize class**, which handles language detection and formatting.
+The `CometChatLocalize` class manages multi-language localization for the UI Kit. It handles automatic language detection, manual language switching, custom translations, and date/time formatting.
-***
-
-### **Supported Languages**
+---
-React UI Kit currently supports **19 languages**:
+## Supported Languages
-| Language | Code |
-| ------------------------ | ------- |
-| English (United States) | `en-US` |
+| Language | Code |
+| --- | --- |
+| English (United States) | `en-US` |
| English (United Kingdom) | `en-GB` |
-| Dutch | `nl` |
-| French | `fr` |
-| German | `de` |
-| Hindi | `hi` |
-| Italian | `it` |
-| Japanese | `ja` |
-| Korean | `ko` |
-| Portuguese | `pt` |
-| Russian | `ru` |
-| Spanish | `es` |
-| Turkish | `tr` |
-| Chinese | `zh` |
-| Chinese (Traditional) | `zh-TW` |
-| Malay | `ms` |
-| Swedish | `sv` |
-| Lithuanian | `lt` |
-| Hungarian | `hu` |
-
-🔗 **View JSON files for all supported languages** in the GitHub repository:\
-➡ [Language JSON Files](https://github.com/cometchat/cometchat-uikit-react/tree/v6/src/resources/CometChatLocalize/resources)
-
-***
-
-## **CometChatLocalize**
-
-The `CometChatLocalize` class provides methods for managing localization in the UI Kit.
-
-🔗 **View full class file in the GitHub repository:**\
-➡ [CometChatLocalize](https://github.com/cometchat/cometchat-uikit-react/blob/v6/src/resources/CometChatLocalize/cometchat-localize.ts)
-
-***
-
-### **LocalizationSettings**
-
-The `LocalizationSettings` interface defines various **localization settings** for an application or component. It allows developers to configure the language, translations, time zone, and calendar formatting while providing options for automatic detection and missing key handling.
-
-| Property | Type | Description |
-| ----------------------------- | ------------------------- | --------------------------------------------------------------------------------------------------- |
-| `language` | `string` | The language code (e.g., `"en"`, `"fr"`) for the current localization. |
-| `translationsForLanguage` | `{ [key: string]: any }` | An object containing key-value pairs for translations in the current language. |
-| `disableAutoDetection` | `boolean` | Disables automatic language detection based on the browser or device settings. |
-| `fallbackLanguage` | `string` | The **fallback language code** to use if the primary language is not available. |
-| `disableDateTimeLocalization` | `boolean` | Disables localization for **date and time values**, forcing the default format. |
-| `timezone` | `string` | The **timezone** used for date and time formatting (e.g., `"America/New_York"`, `"Europe/London"`). |
-| `calendarObject` | `CalendarObject` | A **custom calendar format** using `CalendarObject` to define localized date and time formatting. |
-| `missingKeyHandler` | `(key: string) => string` | A function that **handles missing translation keys**, allowing custom error handling or fallbacks. |
-
-***
-
-**Example**
-
-```javascript
+| Dutch | `nl` |
+| French | `fr` |
+| German | `de` |
+| Hindi | `hi` |
+| Italian | `it` |
+| Japanese | `ja` |
+| Korean | `ko` |
+| Portuguese | `pt` |
+| Russian | `ru` |
+| Spanish | `es` |
+| Turkish | `tr` |
+| Chinese | `zh` |
+| Chinese (Traditional) | `zh-TW` |
+| Malay | `ms` |
+| Swedish | `sv` |
+| Lithuanian | `lt` |
+| Hungarian | `hu` |
+
+[Language JSON files on GitHub](https://github.com/cometchat/cometchat-uikit-react/tree/v6/src/resources/CometChatLocalize/resources)
+
+---
+
+## LocalizationSettings
+
+Configuration interface for `CometChatLocalize.init()`.
+
+| Property | Type | Description |
+| --- | --- | --- |
+| `language` | `string` | Language code (e.g., `"en"`, `"fr"`) for the current localization |
+| `translationsForLanguage` | `{ [key: string]: any }` | Key-value pairs for translations in the current language |
+| `disableAutoDetection` | `boolean` | Disables automatic language detection based on browser/device settings |
+| `fallbackLanguage` | `string` | Fallback language code if the primary language is not available |
+| `disableDateTimeLocalization` | `boolean` | Disables localization for date and time values, forcing the default format |
+| `timezone` | `string` | Timezone for date and time formatting (e.g., `"America/New_York"`, `"Europe/London"`) |
+| `calendarObject` | `CalendarObject` | Custom calendar format for localized date and time formatting |
+| `missingKeyHandler` | `(key: string) => void` | Handles missing translation keys with custom error handling or fallbacks |
+
+
+```javascript lines
import { CometChatLocalize } from "@cometchat/chat-uikit-react";
import { CalendarObject } from "./CalendarObject";
CometChatLocalize.init({
- language: "es", // Default language set to Spanish
- fallbackLanguage: "en-US", // Use English if the preferred language is not available
+ language: "es",
+ fallbackLanguage: "en-US",
translationsForLanguage: {
"es": {
"welcome_message": "¡Bienvenido a CometChat!",
@@ -92,9 +84,9 @@ CometChatLocalize.init({
"logout_message": "Vous vous êtes déconnecté avec succès."
}
},
- disableAutoDetection: false, // Allow automatic detection of browser/device language
- disableDateTimeLocalization: false, // Enable localization for date and time
- timezone: "Europe/Madrid", // Set time zone for date and time formatting
+ disableAutoDetection: false,
+ disableDateTimeLocalization: false,
+ timezone: "Europe/Madrid",
calendarObject: new CalendarObject({
today: "[Hoy a las] hh:mm A",
yesterday: "[Ayer a las] hh:mm A",
@@ -107,83 +99,62 @@ CometChatLocalize.init({
hours: "%d horas atrás",
}
}),
- missingKeyHandler: (key) => `🔍 Missing translation for: ${key}`, // Custom handler for missing translations
+ missingKeyHandler: (key) => `Missing translation for: ${key}`,
});
```
-***
+---
-### **CalendarObject**
+## CalendarObject
-The `CalendarObject` class defines customizable formatting for date and time representation. It allows you to format dates based on whether they are today, yesterday, last week, or other days. It also supports relative time formatting for minutes and hours.
+Defines customizable formatting for date and time representation. Supports relative time formatting for minutes and hours.
-Notice
-
-Changing this format will **globally update** the date and time representation wherever it is used in the component.\
-However, if a **component-specific** `CalendarObject` is provided, it will take **higher precedence** over the global settings.
-
+Changing this format globally updates the date and time representation wherever it is used. If a component-specific `CalendarObject` is provided, it takes higher precedence over the global settings.
-| Property | Type | Description |
-| ---------------------- | -------- | ----------------------------------------------------------------------------------------------- |
-| `today` | `string` | Custom formatting for dates that fall on the same day. Example: `"Today at hh:mm A"` |
-| `yesterday` | `string` | Custom formatting for dates that fall on the previous day. Example: `"Yesterday at hh:mm A"` |
-| `lastWeek` | `string` | Custom formatting for dates within the last 7 days. Example: `"Last week on dddd"` |
-| `otherDays` | `string` | Custom formatting for dates that do not fit other categories. Example: `"DD MMM YYYY, hh:mm A"` |
-| `relativeTime` | `object` | Custom formatting for relative time expressions (e.g., "2 hours ago"). |
-| `relativeTime.minute` | `string` | Formatting for a single minute. Example: `"%d minute ago"` |
-| `relativeTime.minutes` | `string` | Formatting for multiple minutes. Example: `"%d minutes ago"` |
-| `relativeTime.hour` | `string` | Formatting for a single hour. Example: `"%d hour ago"` |
-| `relativeTime.hours` | `string` | Formatting for multiple hours. Example: `"%d hours ago"` |
-
-***
-
-**Example**
-
-```javascript
-import { CometChatLocalize } from "@cometchat/chat-uikit-react";
-import { CalendarObject } from "./CalendarObject";
-
+| Property | Type | Description |
+| --- | --- | --- |
+| `today` | `string` | Format for dates on the same day. Example: `"Today at hh:mm A"` |
+| `yesterday` | `string` | Format for dates on the previous day. Example: `"Yesterday at hh:mm A"` |
+| `lastWeek` | `string` | Format for dates within the last 7 days. Example: `"Last week on dddd"` |
+| `otherDays` | `string` | Format for dates that do not fit other categories. Example: `"DD MMM YYYY, hh:mm A"` |
+| `relativeTime` | `object` | Custom formatting for relative time expressions |
+| `relativeTime.minute` | `string` | Single minute format. Example: `"%d minute ago"` |
+| `relativeTime.minutes` | `string` | Multiple minutes format. Example: `"%d minutes ago"` |
+| `relativeTime.hour` | `string` | Single hour format. Example: `"%d hour ago"` |
+| `relativeTime.hours` | `string` | Multiple hours format. Example: `"%d hours ago"` |
+
+```javascript lines
new CalendarObject({
- today: "[Hoy a las] hh:mm A",
- yesterday: "[Ayer a las] hh:mm A",
- lastWeek: "[Última semana el] dddd",
- otherDays: "DD MMM YYYY, hh:mm A",
- relativeTime: {
- minute: "%d minuto atrás",
- minutes: "%d minutos atrás",
- hour: "%d hora atrás",
- hours: "%d horas atrás",
- }
- })
+ today: "[Hoy a las] hh:mm A",
+ yesterday: "[Ayer a las] hh:mm A",
+ lastWeek: "[Última semana el] dddd",
+ otherDays: "DD MMM YYYY, hh:mm A",
+ relativeTime: {
+ minute: "%d minuto atrás",
+ minutes: "%d minutos atrás",
+ hour: "%d hora atrás",
+ hours: "%d horas atrás",
+ }
+})
```
-***
+---
-### **Component Guide**
+## Component Guide
-Note
-
-The translation configurations mentioned in this section are to be defined inside the
-ComeChat's init() method callback.
+The translation configurations in this section are to be defined inside the [CometChat's init() method callback](/ui-kit/react/react-js-integration#step-3:-initialize-cometchat-ui-kit).
-#### Report Message
+### Report Message
-To add translations for any flag reason, a key in the form of `flag_message_reason_id_{reason_id}` is to be defined with the translated strings to be displayed for that `reason_id` in the UI. The translations for `flag_message_reason_id_spam`, `flag_message_reason_id_sexual`, `flag_message_reason_id_harassment` are present by default.
+To add translations for any flag reason, define a key in the form `flag_message_reason_id_{reason_id}` with the translated strings. Translations for `flag_message_reason_id_spam`, `flag_message_reason_id_sexual`, `flag_message_reason_id_harassment` are present by default. The reason name is displayed when the required translation is not found.
-**Usage**
-* Define translations for custom flag message reasons.
-* The reason name would be displayed when the required translation is not found.
-
-**Example**
-
-```javascript
+```javascript lines
import { CometChatLocalize } from "@cometchat/chat-uikit-react";
-// Add translations for flag reason keys for the required languages
CometChatLocalize.addTranslation({
"en-GB": {
"flag_message_reason_id_dislike": "I just don't like it",
@@ -194,20 +165,13 @@ CometChatLocalize.addTranslation({
});
```
-#### Mention All
-
-To add translations for a custom `mentionAllLabel`, a key in the form of `message_composer_mention_{label}` is to be defined with the translated strings to be displayed for that label in the UI. The translations for `message_composer_mention_all` is present by default.
-
-**Usage**
-* Define translations for custom mentionAllLabel.
-* Helps customize the `@all` label used in the app while mentioning all group members.
+### Mention All
-**Example**
+To add translations for a custom `mentionAllLabel`, define a key in the form `message_composer_mention_{label}`. The translation for `message_composer_mention_all` is present by default.
-```javascript
+```javascript lines
import { CometChatLocalize } from "@cometchat/chat-uikit-react";
-// Add translations for mentionAllLabel for the required languages
CometChatLocalize.addTranslation({
"en-GB": {
"message_composer_mention_channel": "channel",
@@ -218,169 +182,131 @@ CometChatLocalize.addTranslation({
});
```
-***
-
-### **Methods**
-
-#### Initialize CometChatLocalize
-
-This method initializes the localization system with default values and optional configurations.
+---
-**Usage**
+## Methods
-* Set the default language, timezone, and fallback settings.
-* Define a custom calendar format if required.
-* Customize how missing keys are handled.
+### init
-**Example**
+Initializes the localization system with default values and optional configurations.
-```javascript
+```javascript lines
import { CometChatLocalize } from "@cometchat/chat-uikit-react";
-// Initialize localization settings
CometChatLocalize.init({
- language: "es", // Default language: Spanish
- fallbackLanguage: "en-US", // Fallback if translation is missing
- disableAutoDetection: false, // Enable browser language detection
+ language: "es",
+ fallbackLanguage: "en-US",
+ disableAutoDetection: false,
timezone: "Europe/Madrid",
missingKeyHandler: (key) => `Missing translation: ${key}`,
});
```
-***
-
-#### Get Browser Language
+### getBrowserLanguage
-This method detects the language set in the user's browser or device settings.
+Detects the language set in the user's browser or device settings.
-**Usage**
-
-* Automatically set the app’s language based on the user’s browser settings.
-* Helps in making the UI multilingual without requiring user input.
-
-**Example**
-
-```javascript
+```javascript lines
const userLang = CometChatLocalize.getBrowserLanguage();
console.log(userLang);
```
-***
-
-#### Get Localized String
+### getLocalizedString
-This method fetches localized text based on the current language.
+Fetches localized text based on the current language.
-**Usage**
-
-* Retrieve translations dynamically without hardcoding values in multiple languages.
-* Useful for UI elements, buttons, alerts, and system messages.
-
-**Example**
-
-```javascript
+```javascript lines
const translatedText = CometChatLocalize.getLocalizedString("welcome_message");
```
-***
-
-#### Get Current Language
-
-This method returns the currently set language for the UI Kit.
+### getCurrentLanguage
-**Usage**
+Returns the currently set language for the UI Kit.
-* Useful to debug and display the currently active language.
-* Helps when dynamically switching between languages.
-
-**Example**
-
-```javascript
+```javascript lines
console.log(CometChatLocalize.getCurrentLanguage());
```
-***
-
-#### Get Default Language
-
-This method returns the system-preferred language.
+### getDefaultLanguage
-**Usage**
+Returns the system-preferred language. If `disableAutoDetection` is enabled, returns the fallback language. Otherwise returns the browser's preferred language.
-* If disableAutoDetection is enabled, the method returns the fallback language.
-* If auto-detection is enabled, it returns the browser's preferred language.
-
-**Example**
-
-```javascript
+```javascript lines
console.log(CometChatLocalize.getDefaultLanguage());
```
-***
-
-#### Set Current Language
-
-This method updates the language at runtime without reloading the application.
-
-**Usage**
+### setCurrentLanguage
-* Allow users to change the language via a settings menu.
-* Ensure that UI elements are updated instantly after changing the language.
+Updates the language at runtime without reloading the application.
-**Example**
-
-```javascript
+```javascript lines
CometChatLocalize.setCurrentLanguage("fr");
```
-***
+### addTranslation
+
+Adds custom translations to the existing ones dynamically. New translations are merged into the existing localization data.
-#### Add Custom Translations
+```javascript lines
+CometChatLocalize.addTranslation({
+ "en-US": { "welcome_message": "Welcome to CometChat!" }
+});
+```
-This method allows you to add custom translations to the existing ones dynamically. It ensures that new translations are merged into the existing localization data.
+### formatDate
-**Usage**
+Formats a Unix timestamp (seconds) based on a `CalendarObject` configuration. Uses the timezone set via `init()`.
-* You can define custom translation keys and override the existing translations.
-* You can add new languages to the existing translations.
-* Useful when you want to support additional words or phrases not present in the default language files.
+| Parameter | Type | Description |
+| --- | --- | --- |
+| `timestamp` | `number` | Unix timestamp in seconds |
+| `calendarObject` | `CalendarObject` | Calendar configuration for formatting |
-**Example**
+Returns a formatted date `string`.
-```javascript
-CometChatLocalize.addTranslation({
- "en-US": { "welcome_message": "Welcome to CometChat!" }
-});
+```javascript lines
+import { CometChatLocalize } from "@cometchat/chat-uikit-react";
+import { CalendarObject } from "@cometchat/chat-uikit-react";
+
+const formatted = CometChatLocalize.formatDate(1700000000, new CalendarObject({
+ today: "hh:mm A",
+ yesterday: "[Yesterday]",
+ lastWeek: "dddd",
+ otherDays: "DD MMM YYYY, hh:mm A"
+}));
```
-***
+### getDateLocaleLanguage
+
+Returns the language code used for date localization. If `disableDateTimeLocalization` is `true`, returns `"en-US"`. Otherwise returns the current language.
-#### **Customisation**
+```javascript lines
+const dateLang = CometChatLocalize.getDateLocaleLanguage();
+```
-CometChat UI Kit provides **flexible customization options** for date/time format. Users can configure **global settings** using `CometChatLocalize.init()` or pass a `CalendarObject` directly to individual components for **component-specific** customization.
+---
-* **Global Configuration:** When settings are provided in `CometChatLocalize.init()`, all UI components will automatically use the configured date/time formats.
-* **Component-Specific Configuration:** If a `CalendarObject` is passed to a component, it **overrides** the global settings and applies only to that specific instance.
+## Customization
-**Global Configuration Example**
+### Global Configuration
-To apply a **custom date format** globally across the whole UI Kit.
+Apply a custom date format globally across the whole UI Kit via `CometChatLocalize.init()`:
-```php
+```javascript lines
CometChatLocalize.init({
- calendarObject:new CalendarObject({
- today: " hh:mm A",
- yesterday: "[Yesterday],
+ calendarObject: new CalendarObject({
+ today: "hh:mm A",
+ yesterday: "[Yesterday]",
otherDays: "DD MMM YYYY, hh:mm A"
})
});
```
-**Component-Specific Customization Example**
+### Component-Specific Configuration
-To apply a **custom date format** only within a specific component.
+Apply a custom date format only within a specific component. Component-level `CalendarObject` overrides the global settings.
-```csharp
+```tsx lines
```
-***
\ No newline at end of file
diff --git a/ui-kit/react/mentions-formatter-guide.mdx b/ui-kit/react/mentions-formatter-guide.mdx
index f5e8d6860..6de30fcf4 100644
--- a/ui-kit/react/mentions-formatter-guide.mdx
+++ b/ui-kit/react/mentions-formatter-guide.mdx
@@ -1,7 +1,22 @@
---
title: "Mentions Formatter"
+description: "Add @mentions with styled tokens, suggestion list, and click handling in CometChat React UI Kit."
---
+
+
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Key class | `CometChatMentionsFormatter` (extends `CometChatTextFormatter`) |
+| Init | `CometChatUIKit.init(UIKitSettings)` then `CometChatUIKit.login("UID")` |
+| Purpose | Format @mentions with styled tokens, suggestion list, and click handling for users and group members |
+| Sample app | [GitHub](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app) |
+| Related | [Custom Text Formatter](/ui-kit/react/custom-text-formatter-guide) · [All Guides](/ui-kit/react/guide-overview) |
+
+
+
+
## Overview
The `CometChatMentionsFormatter` class is a part of the CometChat UI Kit, a ready-to-use chat UI component library for integrating CometChat into your React applications. This class provides functionality to format mentions within text messages displayed in the chat interface. Mentions allow users to reference other users within a conversation, providing a convenient way to direct messages or involve specific participants.
@@ -20,7 +35,7 @@ To integrate the `CometChatMentionsFormatter` class into your application:
1. **Initialization**: Create an instance of the `CometChatMentionsFormatter` class and configure it with desired settings, such as mention text styles and limit settings.
-```javascript
+```javascript lines
import { CometChatMentionsFormatter } from "path-to-your-file";
// Initialize the formatter
@@ -48,3 +63,22 @@ mentionsFormatter.setCometChatUserGroupMembers(userList);
The `formattedMessage` now contains HTML with styled mentions, ready to be inserted into your message component for display.
Below is an example demonstrating how to use the `CometChatMentionsFormatter` class in components such as [CometChatConversations](/ui-kit/react/conversations), [CometChatMessageList](/ui-kit/react/message-list), [CometChatMessageComposer](/ui-kit/react/message-composer).
+
+## Next Steps
+
+
+
+ Build custom inline text patterns.
+
+
+ Render real-time message threads.
+
+
+ Browse all feature and formatter guides.
+
+
+ Full working sample application on GitHub.
+
+
+
+***
diff --git a/ui-kit/react/message-composer.mdx b/ui-kit/react/message-composer.mdx
index 67249e000..cf57797d8 100644
--- a/ui-kit/react/message-composer.mdx
+++ b/ui-kit/react/message-composer.mdx
@@ -1,26 +1,35 @@
---
title: "Message Composer"
+description: "CometChatMessageComposer component provides a rich text input for composing and sending messages including text, media, attachments, reactions, mentions, and voice notes. Supports custom actions, AI features, and CSS styling."
---
-## Overview
-
-MessageComposer is a Component that enables users to write and send a variety of messages, including text, image, video, and custom messages.
-
-Features such as **Attachments**, and **Message Editing** are also supported by it.
-
-## Usage
+
+
+| Field | Value |
+| --- | --- |
+| Purpose | Rich text input for composing and sending text, media, attachments, mentions, voice notes, and custom messages in user or group conversations |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatMessageComposer } from "@cometchat/chat-uikit-react";` |
+| Used in experiences | Chat view, threaded conversations, message reply panel |
+| Copy-paste base | See [Base Code](#base-code--stylesheet) below |
+| Primary output | Sent messages via `onSendButtonClick`, text changes via `onTextChange` |
+| Primary hook points | `onSendButtonClick`, `onError`, `onTextChange`, view slots (`attachmentOptions`, `auxiliaryButtonView`, `sendButtonView`, `headerView`, `textFormatters`) |
+| CSS root class | `.cometchat-message-composer` |
+| Real-time events | `CometChatMessageEvents.ccMessageSent`, `CometChatMessageEvents.ccMessageEdited`, `CometChatMessageEvents.ccReplyToMessage` |
-### Integration
+
-The following code snippet illustrates how you can directly incorporate the MessageComposer component into your app.
+## Base Code and Stylesheet
+
+Renders a rich text input with attachment, emoji, voice recording, and send controls for a user or group conversation.
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageComposer } from "@cometchat/chat-uikit-react";
@@ -40,39 +49,102 @@ export function MessageComposerDemo() {
) : null;
}
```
-
-
-```tsx
+```tsx lines
import { MessageComposerDemo } from "./MessageComposerDemo";
export default function App() {
return (
-
-
-
+
);
}
```
-
-
-### Actions
+Root CSS class for style overrides:
-[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.
+```css lines
+.cometchat-message-composer {
+ /* overrides here */
+}
+```
-##### 1. OnSendButtonClick
+## Functionality
-The `OnSendButtonClick` event gets activated when the send message button is clicked. It has a predefined function of sending messages entered in the composer `EditText`. However, you can overide this action with the following code snippet.
+Props that control component behavior, grouped by surface area.
-
-
-```tsx
+### Data
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `user` | `CometChat.User` | `undefined` | Sets the recipient user for the composer | Pass either `user` or `group`, not both |
+| `group` | `CometChat.Group` | `undefined` | Sets the recipient group for the composer | Pass either `user` or `group`, not both |
+| `parentMessageId` | `number` | `undefined` | Targets a thread; messages sent as replies to this parent | — |
+| `initialComposerText` | `string` | `""` | Pre-fills the text input when the component mounts | — |
+
+### UI Visibility Toggles
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `hideImageAttachmentOption` | `boolean` | `false` | Hides the image attachment option | — |
+| `hideVideoAttachmentOption` | `boolean` | `false` | Hides the video attachment option | — |
+| `hideAudioAttachmentOption` | `boolean` | `false` | Hides the audio attachment option | — |
+| `hideFileAttachmentOption` | `boolean` | `false` | Hides the file attachment option | — |
+| `hidePollsOption` | `boolean` | `false` | Hides the polls option | — |
+| `hideCollaborativeDocumentOption` | `boolean` | `false` | Hides the collaborative document option | — |
+| `hideCollaborativeWhiteboardOption` | `boolean` | `false` | Hides the collaborative whiteboard option | — |
+| `hideAttachmentButton` | `boolean` | `false` | Hides the entire attachment button | — |
+| `hideVoiceRecordingButton` | `boolean` | `false` | Hides the voice recording button | — |
+| `hideEmojiKeyboardButton` | `boolean` | `false` | Hides the emoji keyboard button | — |
+| `hideStickersButton` | `boolean` | `false` | Hides the stickers button | — |
+| `hideSendButton` | `boolean` | `false` | Hides the send button | — |
+| `showScrollbar` | `boolean` | `false` | Shows the scrollbar in the composer input | — |
+
+### Behavior
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `disableTypingEvents` | `boolean` | `false` | Disables the typing indicator for this composer | — |
+| `disableMentions` | `boolean` | `false` | Disables the mentions functionality | — |
+| `disableMentionAll` | `boolean` | `false` | Controls whether group mentions like @all appear in suggestions | — |
+| `mentionAllLabel` | `string` | `"all"` | Custom alias label for group mentions (@channel, @everyone, etc.) | — |
+| `enterKeyBehavior` | `EnterKeyBehavior` | `EnterKeyBehavior.SendMessage` | Determines Enter key behavior (send message or add new line) | — |
+| `disableSoundForMessage` | `boolean` | `false` | Disables sound for outgoing messages | — |
+| `customSoundForMessage` | `string` | `undefined` | Custom audio sound URL for outgoing messages | — |
+| `placeholderText` | `string` | `""` | Placeholder text displayed in the message input field when empty | — |
+
+### Mentions
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `mentionsUsersRequestBuilder` | `CometChat.UsersRequestBuilder` | SDK default | Custom builder to control how mentioned users are fetched | — |
+| `mentionsGroupMembersRequestBuilder` | `CometChat.GroupMembersRequestBuilder` | SDK default | Custom builder to control how mentioned group members are fetched | — |
+
+## Actions
+
+[Actions](/ui-kit/react/components-overview#actions) split into predefined (built-in triggers) and user-defined (callbacks).
+
+### Predefined Actions
+
+The send button has a built-in action that sends the composed message. Override it with `onSendButtonClick`.
+
+### User-Defined Actions
+
+#### onSendButtonClick
+
+Fires when the send button is clicked. Overrides the default send behavior.
+
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks the send button |
+| Payload type | `(message: CometChat.BaseMessage) => void` |
+| What devs typically do next | Custom send logic, message preprocessing |
+
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageComposer } from "@cometchat/chat-uikit-react";
@@ -98,17 +170,17 @@ export function MessageComposerDemo() {
}
```
-
+#### onError
-
+Fires when the component encounters an error.
-##### 2. onError
+| Detail | Value |
+| --- | --- |
+| When it fires | Any internal error during rendering or message sending |
+| Payload type | `(error: CometChat.CometChatException) => void` |
+| What devs typically do next | Log to error tracking service |
-This action doesn't change the behavior of the component but rather listens for any errors that occur in the MessageList component.
-
-
-
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageComposer } from "@cometchat/chat-uikit-react";
@@ -134,17 +206,17 @@ export function MessageComposerDemo() {
}
```
-
-
-
+#### onTextChange
-##### 3. onTextChange
+Fires as the user types in the composer input.
-This event is triggered as the user starts typing in the Message Composer.
+| Detail | Value |
+| --- | --- |
+| When it fires | Text content changes in the input |
+| Payload type | `(text: string) => void` |
+| What devs typically do next | Track input state, trigger custom suggestions |
-
-
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageComposer } from "@cometchat/chat-uikit-react";
@@ -173,95 +245,25 @@ export function MessageComposerDemo() {
}
```
-
+## Filters
-
+The MessageComposer component does not have any exposed filters. It provides a text input and attachment interface and does not fetch paginated lists.
-##### 4. Custom Mentions Request Builders
+## Events
-You can customize how mentioned users and group members are fetched by providing custom request builders.
+### UI Events
-
-
-```tsx
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatMessageComposer } from "@cometchat/chat-uikit-react";
+Events emitted by the MessageComposer component:
-export function MessageComposerDemo() {
- const [chatUser, setChatUser] = React.useState();
- const [chatGroup, setChatGroup] = React.useState();
+| Event | Source | When it fires |
+| --- | --- | --- |
+| `ccMessageSent` | `CometChatMessageEvents` | A message is sent (inProgress, success, error) |
+| `ccMessageEdited` | `CometChatMessageEvents` | A message is edited (inProgress, success, error) |
+| `ccReplyToMessage` | `CometChatMessageEvents` | User replies to a message |
- React.useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
- }, []);
-
- // Custom Users Request Builder for mentions
- const mentionsUsersRequestBuilder = new CometChat.UsersRequestBuilder()
- .setLimit(10)
- .setSearchKeyword("")
- .setRoles(["default", "moderator"]);
-
- // Custom Group Members Request Builder for group mentions
- const mentionsGroupMembersRequestBuilder = new CometChat.GroupMembersRequestBuilder("guid")
- .setLimit(15)
- .setSearchKeyword("")
- .setScopes(["admin", "moderator", "participant"]);
-
- return chatUser ? (
-
- {/* For user chat with custom users mentions */}
-
-
- {/* For group chat with custom group members mentions */}
- {chatGroup && (
-
- )}
-
- ) : null;
-}
-```
-
-
-
-
-
-***
-
-### Filters
-
-MessageComposer component does not have any available filters.
-
-***
+#### Subscribe
-### Events
-
-[Events](/ui-kit/react/components-overview#events) are emitted by a `Component`. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
-
-The list of events emitted by the Messages component is as follows.
-
-| Event | Description |
-| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
-| **ccMessageEdited** | Triggers whenever a loggedIn user edits any message from the list of messages .it will have three states such as: inProgress, success and error. |
-| **ccReplyToMessage** | Triggers whenever a loggedIn user replies to any message from the list of messages .it will have three states such as: inProgress, success and error. |
-| **ccMessageSent** | Triggers whenever a loggedIn user sends any message, it will have three states such as: inProgress, success and error. |
-
-Adding `CometChatMessageEvents` Listener's
-
-
-
-```js
+```js lines
import { CometChatMessageEvents } from "@cometchat/chat-uikit-react";
const ccMessageEdited = CometChatMessageEvents.ccMessageEdited.subscribe(() => {
@@ -277,153 +279,49 @@ const ccMessageSent = CometChatMessageEvents.ccMessageSent.subscribe(() => {
});
```
-
-
-
+#### Unsubscribe
-***
-
-Removing `CometChatMessageEvents` Listener's
-
-
-
-```js
+```js lines
ccMessageEdited?.unsubscribe();
ccReplyToMessage?.unsubscribe();
ccMessageSent?.unsubscribe();
```
-
+### SDK Events (Real-Time)
-
+The component internally listens to SDK events for real-time updates. No manual attachment needed.
-***
+## Advanced: Custom View Slots
-## Customization
+Customization override points for the message composer UI.
-To fit your app's design requirements, you can customize the appearance of the MessageComposer component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.
+### Slot Catalog
-### Style
+| Slot | Params | What it replaces | Section |
+| --- | --- | --- | --- |
+| `attachmentOptions` | `CometChatMessageComposerAction[]` | Default attachment options list | Attachment menu |
+| `auxiliaryButtonView` | `JSX.Element` | Sticker and AI button area | Sub-section (auxiliary) |
+| `sendButtonView` | `JSX.Element` | Send button | Sub-section (send) |
+| `headerView` | `JSX.Element` | Area above the composer input | Whole section |
+| `textFormatters` | `CometChatTextFormatter[]` | Text formatting in the input | Text content |
-To modify the styling, you can customise the css of MessageComposer Component.
+### attachmentOptions
-**Example**
-
-
-
-
-
-
-
-```tsx
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatMessageComposer } from "@cometchat/chat-uikit-react";
-
-;
-```
-
-
-
-
-```css
-.cometchat-message-composer .cometchat-message-composer__input {
- font-family: "SF Pro";
-}
-
-.cometchat-message-composer .cometchat-button .cometchat-button__icon {
- background: #f19fa1;
-}
-
-.cometchat-message-composer .cometchat-message-composer__send-button {
- background: #e5484d;
-}
-```
-
-
-
-
-
-***
-
-### 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.
-
-
-
-```tsx
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatMessageComposer } from "@cometchat/chat-uikit-react";
-
-;
-```
-
-
-
-
-
-Below is a list of customizations along with corresponding code snippets
-
-| Property | Description | Code |
-| --------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------- |
-| **Initial Composer Text** | The initial text pre-filled in the message input when the component mounts. | `initialComposerText="Hello"` |
-| **Disable Typing Events** | Disables the typing indicator for the current message composer. | `disableTypingEvents={true}` |
-| **Disable Mentions** | Disables the mentions functionality in the message composer. | `disableMentions={true}` |
-| **Disable Mention All** | Controls whether group mentions like @all appear in suggestions. | `disableMentionAll={true}` |
-| **Mention All Label** | Allows setting a custom alias label for group mentions (@channel, @everyone, etc.). | `mentionAllLabel="all"` |
-| **Mentions Users Request Builder** | Provides a custom UsersRequestBuilder to control how the mentioned users list is fetched. | `mentionsUsersRequestBuilder={usersRequestBuilder}` |
-| **Mentions Group Members Request Builder** | Provides a custom GroupMembersRequestBuilder to customize how mentioned group members are retrieved. | `mentionsGroupMembersRequestBuilder={groupMembersRequestBuilder}` |
-| **Hide Image Attachment Option** | Hides the image attachment option in the message composer. | `hideImageAttachmentOption={true}` |
-| **Hide Video Attachment Option** | Hides the video attachment option in the message composer. | `hideVideoAttachmentOption={true}` |
-| **Hide Audio Attachment Option** | Hides the audio attachment option in the message composer. | `hideAudioAttachmentOption={true}` |
-| **Hide File Attachment Option** | Hides the file attachment option in the message composer. | `hideFileAttachmentOption={true}` |
-| **Hide Polls Option** | Hides the polls option in the message composer. | `hidePollsOption={true}` |
-| **Hide Collaborative Document** | Hides the collaborative document option in the message composer. | `hideCollaborativeDocumentOption={true}` |
-| **Hide Collaborative Whiteboard** | Hides the collaborative whiteboard option in the message composer. | `hideCollaborativeWhiteboardOption={true}` |
-| **Hide Attachment Button** | Hides the attachment button in the message composer. | `hideAttachmentButton={true}` |
-| **Hide Voice Recording Button** | Hides the voice recording button in the message composer. | `hideVoiceRecordingButton={true}` |
-| **Hide Emoji Keyboard Button** | Hides the emoji keyboard button in the message composer. | `hideEmojiKeyboardButton={true}` |
-| **Hide Stickers Button** | Hides the stickers button in the message composer. | `hideStickersButton={true}` |
-| **Hide Send Button** | Hides the send button in the message composer. | `hideSendButton={true}` |
-| **Show Scrollbar** | Controls the visibility of the scrollbar in the composer. | `showScrollbar={true}` |
-| **User** | Specifies the recipient of the message (user object). | `user={chatUser}` |
-| **Group** | Specifies the group to send messages to. Used if the `user` prop is not provided. | `group={chatGroup}` |
-| **Parent Message ID** | Specifies the ID of the parent message for threading or replying to a specific message. | `parentMessageId={12345}` |
-| **Enter Key Behavior** | Determines the behavior of the Enter key (e.g., send message or add a new line). | `enterKeyBehavior={EnterKeyBehavior.SendMessage}` |
-| **Disable Sound for Message** | Disables sound for incoming messages. | `disableSoundForMessage={true}` |
-| **Custom Sound for Message** | Specifies a custom audio sound for incoming messages. | `customSoundForMessage="sound.mp3"` |
-
-***
-
-### 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 `attachmentOptions`, you can set a list of custom `MessageComposerActions` for the MessageComposer Component. This will override the existing list of `MessageComposerActions`.
-
-Shown below is the default chat interface.
+Override the default attachment options with a custom list of `CometChatMessageComposerAction` items.
-The customized chat interface is displayed below.
+or
-Use the following code to achieve the customization shown above.
-
-
-```tsx
+
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import {
@@ -461,11 +359,9 @@ function getAttachments() {
user={userObj}
/>;
```
-
-
-
-```css
+
+```css lines
.cometchat-message-composer__secondary-button-view-attachment-button
.cometchat-action-sheet {
border: none;
@@ -491,41 +387,26 @@ function getAttachments() {
background: #141414;
}
```
-
-
-***
+### auxiliaryButtonView
-#### AuxiliaryButtonView
-
-You can insert a custom view into the MessageComposer component to add additional functionality using the following method.
-
-Please note that the MessageComposer Component utilizes the AuxiliaryButton to provide sticker and AI functionality. Overriding the AuxiliaryButton will subsequently replace the sticker functionality.
-
-Shown below is the default chat interface.
+Replace the sticker and AI button area. Overriding this replaces the sticker functionality.
-The customized chat interface is displayed below.
-
-Use the following code to achieve the customization shown above.
-
-
-
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import {
CometChatMessageComposer,
- IconStyle,
CometChatButton,
} from "@cometchat/chat-uikit-react";
@@ -544,33 +425,21 @@ const auxiliaryButtonView = (
/>;
```
-
-
-
-
-***
-
-#### SendButtonView
-
-You can set a custom view in place of the already existing send button view.
+### sendButtonView
-Shown below is the default chat interface.
+Replace the send button with a custom view.
-The customized chat interface is displayed below.
-
-Use the following code to achieve the customization shown above.
-
-
-```tsx
+
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import {
@@ -589,11 +458,9 @@ const sendButtonView = (
;
```
-
-
-
-```css
+
+```css lines
.cometchat-message-composer
div:not([class])
.message-composer__send-button
@@ -608,34 +475,24 @@ const sendButtonView = (
background: #6852d6;
}
```
-
-
-***
-
-#### HeaderView
-
-You can set custom headerView to the MessageComposer component using the following method.
+### headerView
-Shown below is the default chat interface.
+Custom view above the composer input.
-The customized chat interface is displayed below.
-
-Use the following code to achieve the customization shown above.
-
-
-```tsx
+
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageComposer } from "@cometchat/chat-uikit-react";
@@ -653,11 +510,9 @@ const getHeaderView = () => {
;
```
-
-
-
-```css
+
+```css lines
.cometchat-message-composer .message-composer__header-view {
display: flex;
align-items: center;
@@ -698,20 +553,16 @@ const getHeaderView = () => {
mask-size: contain;
}
```
-
-
-***
-
-#### TextFormatters
+### textFormatters
-Assigns the list of text formatters. If the provided list is not null, it sets the list. Otherwise, it assigns the default text formatters retrieved from the data source. To configure the existing Mentions look and feel check out [CometChatMentionsFormatter](/ui-kit/react/mentions-formatter-guide)
+Custom text formatters for the composer input. To configure mentions, see [CometChatMentionsFormatter](/ui-kit/react/mentions-formatter-guide).
-```ts
+```ts lines
import { CometChatTextFormatter } from "@cometchat/chat-uikit-react";
import DialogHelper from "./Dialog";
import { CometChat } from "@cometchat/chat-sdk-javascript";
@@ -720,7 +571,7 @@ class ShortcutFormatter extends CometChatTextFormatter {
private shortcuts: { [key: string]: string } = {};
private dialogIsOpen: boolean = false;
private dialogHelper = new DialogHelper();
- private currentShortcut: string | null = null; // Track the currently open shortcut
+ private currentShortcut: string | null = null;
constructor() {
super();
@@ -746,7 +597,6 @@ class ShortcutFormatter extends CometChatTextFormatter {
const shortcut = match[0];
const replacement = this.shortcuts[shortcut];
if (replacement) {
- // Close the currently open dialog, if any
if (this.dialogIsOpen && this.currentShortcut !== shortcut) {
this.closeDialog();
}
@@ -775,14 +625,13 @@ class ShortcutFormatter extends CometChatTextFormatter {
}
closeDialog() {
- this.dialogHelper.closeDialog(); // Use DialogHelper to close the dialog
+ this.dialogHelper.closeDialog();
this.dialogIsOpen = false;
this.currentShortcut = null;
}
handleButtonClick = (buttonText: string) => {
if (this.currentCaretPosition && this.currentRange) {
- // Inserting the replacement text corresponding to the shortcut
const shortcut = Object.keys(this.shortcuts).find(
(key) => this.shortcuts[key] === buttonText
);
@@ -821,11 +670,9 @@ class ShortcutFormatter extends CometChatTextFormatter {
export default ShortcutFormatter;
```
-
-
-```tsx
+```tsx lines
import React from "react";
import ReactDOM from "react-dom";
@@ -886,11 +733,9 @@ export default class DialogHelper {
}
}
```
-
-
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageComposer } from "@cometchat/chat-uikit-react";
@@ -914,9 +759,31 @@ export function MessageComposerDemo() {
) : null;
}
```
-
-
-***
+## Theme and Styling
+
+Using CSS, customize the look and feel of the component. The root CSS class is `.cometchat-message-composer`.
+
+
+
+
+
+```tsx lines
+
+```
+
+```css lines
+.cometchat-message-composer .cometchat-message-composer__input {
+ font-family: "SF Pro";
+}
+
+.cometchat-message-composer .cometchat-button .cometchat-button__icon {
+ background: #f19fa1;
+}
+
+.cometchat-message-composer .cometchat-message-composer__send-button {
+ background: #e5484d;
+}
+```
\ No newline at end of file
diff --git a/ui-kit/react/message-header.mdx b/ui-kit/react/message-header.mdx
index 28d7d0c85..f5d2ccf71 100644
--- a/ui-kit/react/message-header.mdx
+++ b/ui-kit/react/message-header.mdx
@@ -1,29 +1,35 @@
---
title: "Message Header"
+description: "CometChatMessageHeader component displays user or group details in the toolbar including avatar, name, status, typing indicator, and back navigation. Supports custom views and CSS styling."
---
-## Overview
-
-`MessageHeader` is a Component that showcases the [User](/sdk/javascript/users-overview) or [Group](/sdk/javascript/groups-overview) details in the toolbar. Furthermore, it also presents a typing indicator and a back navigation button for ease of use.
-
-The `MessageHeader` is comprised of the following components:
+
+
+| Field | Value |
+| --- | --- |
+| Purpose | Toolbar displaying user/group avatar, name, status, typing indicator, back button, and call controls for a single conversation |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatMessageHeader } from "@cometchat/chat-uikit-react";` |
+| Used in experiences | Chat view header, message detail toolbar, conversation screen top bar |
+| Copy-paste base | See [Base Code](#base-code--stylesheet) below |
+| Primary output | Navigation callback (from `onBack`), item click (from `onItemClick`) |
+| Primary hook points | `onBack`, `onError`, `onItemClick`, `onSearchOptionClicked`, view slots (`itemView`, `titleView`, `subtitleView`, `leadingView`, `trailingView`, `auxiliaryButtonView`) |
+| CSS root class | `.cometchat-message-header` |
+| Real-time events | None emitted; internally listens for typing indicators and user presence |
-| 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
+## Base Code and Stylesheet
-### Integration
+Renders a toolbar with avatar, name, status, and typing indicator for a user or group conversation.
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageHeader } from "@cometchat/chat-uikit-react";
@@ -41,43 +47,105 @@ export function MessageHeaderDemo() {
) : null;
}
```
-
-
-```tsx
+```tsx lines
import { MessageHeaderDemo } from "./MessageHeaderDemo";
export default function App() {
return (
-
-
-
+
);
}
```
-
-
-### Actions
+Root CSS class for style overrides:
-[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.
+```css lines
+.cometchat-message-header {
+ /* overrides here */
+}
+```
-#### 1. OnBack
+## Functionality
-`OnBack` is triggered when you click on the back button of the Message Header component. You can override this action using the following code snippet.
+Props that control component behavior, grouped by surface area.
-**Example**
+### Data
-In this example, we are employing the `onBack` action.
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `user` | `CometChat.User` | `undefined` | Displays user details (avatar, name, status) in the header | Pass either `user` or `group`, not both |
+| `group` | `CometChat.Group` | `undefined` | Displays group details (icon, name, member count) in the header | Pass either `user` or `group`, not both |
-
-
-```tsx
+### UI Visibility Toggles
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `showBackButton` | `boolean` | `false` | Shows the back navigation button | — |
+| `hideVideoCallButton` | `boolean` | `false` | Hides the video call button | — |
+| `hideVoiceCallButton` | `boolean` | `false` | Hides the voice call button | — |
+| `hideUserStatus` | `boolean` | `false` | Hides the user's online/offline status indicator | — |
+| `showConversationSummaryButton` | `boolean` | `false` | Shows the AI conversation summary button | Requires AI features to be enabled |
+| `showSearchOption` | `boolean` | `false` | Shows the search option in the header | — |
+
+### AI / Summary
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `summaryGenerationMessageCount` | `number` | `1000` | Number of messages used for AI summary generation | Higher values may increase latency |
+| `enableAutoSummaryGeneration` | `boolean` | `false` | Enables automatic conversation summary generation | — |
+
+### Date Formatting
+
+| Property | Type | Default | Effect |
+| --- | --- | --- | --- |
+| `lastActiveAtDateTimeFormat` | `CalendarObject` | See default below | Customizes the "last seen" timestamp format |
+
+Default `lastActiveAtDateTimeFormat`:
+
+```ruby lines
+new CalendarObject({
+ today: `[Last seen DD MMM at] hh:mm A`,
+ yesterday: `[Last seen DD MMM at] hh:mm A`,
+ otherDays: `[Last seen DD MMM at] hh:mm A`,
+ relativeTime: {
+ hour: `Last seen %d hour ago`,
+ minute: `Last seen %d minute ago`,
+ minutes: `Last seen %d minutes ago`,
+ },
+});
+```
+
+
+If a property is not passed in the CalendarObject, the component checks the [global configuration](/ui-kit/react/localize#customisation) first, then falls back to the component's default formatting.
+
+
+## Actions
+
+[Actions](/ui-kit/react/components-overview#actions) split into predefined (built-in triggers) and user-defined (callbacks).
+
+### Predefined Actions
+
+The component has no built-in navigation behavior. The back button fires `onBack` but does not navigate automatically.
+
+### User-Defined Actions
+
+#### onBack
+
+Fires when the back button is clicked. Requires `showBackButton={true}`.
+
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks the back button |
+| Payload type | `() => void` |
+| What devs typically do next | Navigate back to conversation list |
+
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageHeader } from "@cometchat/chat-uikit-react";
@@ -104,23 +172,17 @@ export function MessageHeaderDemo() {
}
```
-
-
-
-
-***
-
-#### 2. OnError
-
-This action doesn't change the behavior of the component but rather listens for any errors that occur in the Message Header component.
+#### onError
-**Example**
+Fires when the component encounters an error.
-In this example, we are employing the `onError` action.
+| Detail | Value |
+| --- | --- |
+| When it fires | Any internal error during rendering |
+| Payload type | `(error: CometChat.CometChatException) => void` |
+| What devs typically do next | Log to error tracking service |
-
-
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageHeader } from "@cometchat/chat-uikit-react";
@@ -146,19 +208,17 @@ export function MessageHeaderDemo() {
}
```
-
-
-
+#### onSearchOptionClicked
-***
+Fires when the search option is clicked. Requires `showSearchOption={true}`.
-##### 3. onSearchOptionClicked
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks the search option |
+| Payload type | `() => void` |
+| What devs typically do next | Open search UI, filter messages |
-The `onSearchOptionClicked` event is triggered when the user clicks the search option. It does not have a default behavior. However, you can override its behavior using the following code snippet.
-
-
-
-```tsx
+```tsx lines
import { CometChatMessageHeader } from "@cometchat/chat-uikit-react";
const handleSearchClick = () => {
@@ -168,138 +228,72 @@ const handleSearchClick = () => {
;
```
-
-
-
+#### onItemClick
-***
+Fires when the list item area (avatar + name) is clicked.
-#### 4. OnItemClick
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks the header list item |
+| Payload type | `() => void` |
+| What devs typically do next | Open user/group detail panel |
-`OnItemClick` is triggered when you click on a ListItem of the `CometChatMessageHeader` component. The `OnItemClick` action doesn't have a predefined behavior. You can override this action using the following code snippet.
-
-
-
-```tsx
-import { MessageHeaderDemo } from "@cometchat/chat-uikit-react";
+```tsx lines
+import { CometChatMessageHeader } from "@cometchat/chat-uikit-react";
const getOnItemClick = () => {
console.log("List item clicked");
};
-;
-```
-
-
-
-
-
-***
-
-### Filters
-
-**Filters** allow you to customize the data displayed in a list within a `Component`. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using `RequestBuilders` of Chat SDK.
-
-The `MessageHeader` component does not have any exposed filters.
-
-### Events
-
-[Events](/ui-kit/react/components-overview#events) are emitted by a `Component`. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
-
-The `MessageHeader` component does not produce any events.
-
-## Customization
-
-To fit your app's design requirements, you can customize the appearance of the Message Header component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.
-
-### Style
-
-To customize the appearance, you can customise css of `CometChatMessageHeader`
-
-**Example**
-
-
-
-
-
-
-
-```ts
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatMessageHeader } from "@cometchat/chat-uikit-react";
-
-// Assuming groupObj is defined elsewhere in your code
-;
-```
-
-
-
-
-```css
-.cometchat-message-header .cometchat-list-item .cometchat-avatar {
- background: #f0999b;
- border-radius: 8px;
-}
-.cometchat-message-header .cometchat-avatar__text {
- font-family: "SF Pro";
-}
+;
```
-
-
-
+## Filters
-### Functionality
+The MessageHeader component does not have any exposed filters. It displays details for a single user or group and does not fetch paginated lists.
-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.
+## Events
-Here is a code snippet demonstrating how you can customize the functionality of the Message Header component.
+### UI Events
-
-
-```ts
-import { CometChatMessageHeader } from "@cometchat/chat-uikit-react";
+The MessageHeader component does not emit any custom UI events.
-;
-```
+### SDK Events (Real-Time)
-
+The component internally listens to SDK events for real-time updates. No manual attachment needed.
-
+| SDK Listener | What it does inside the component |
+| --- | --- |
+| `onUserOnline` / `onUserOffline` | Updates the user's online/offline status indicator |
+| `onTypingStarted` / `onTypingEnded` | Shows/hides the typing indicator in the subtitle area |
+| Group member events | Updates group member count when members join/leave |
-Following is a list of customizations along with their corresponding code snippets:
+## Advanced: Custom View Slots
-| Property | Description | Code |
-| ------------------------------------ | --------------------------------------------------------------------------------------------------- | -------------------------------------- |
-| **Show Back Button** | Shows the back button. | `showBackButton={true}` |
-| **Hide Video Call Button** | Hides the video call button. | `hideVideoCallButton={true}` |
-| **Hide Voice Call Button** | Hides the voice call button. | `hideVoiceCallButton={true}` |
-| **Show Conversation Summary Button** | Shows the conversation summary button. | `showConversationSummaryButton={true}` |
-| **Hide User Status** | Hides the user's online/offline status indicator. | `hideUserStatus={true}` |
-| **Show Search Option** | Shows the search option. | `showSearchOption={true}` |
-| **User** | A `CometChat.User` object representing the user whose information (e.g., status) is displayed. | `user={chatUser}` |
-| **Group** | A `CometChat.Group` object representing the group whose details (e.g., member count) are displayed. | `group={chatGroup}` |
-| **Summary Generation Message Count** | Number of messages for which the summary should be shown. | `summaryGenerationMessageCount={1000}` |
-| **Disable Auto Summary Generation** | Disables the auto generation of conversation summary. | `disableAutoSummaryGeneration={true}` |
+Customization override points for the message header UI.
-### Advanced
+### Slot Catalog
-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.
+| Slot | Params | What it replaces | Section |
+| --- | --- | --- | --- |
+| `itemView` | `JSX.Element` | Entire list item (avatar + name + subtitle) | Whole item |
+| `leadingView` | `JSX.Element` | Avatar / left section | Sub-section (leading) |
+| `trailingView` | `JSX.Element` | Right section (call buttons area) | Sub-section (trailing) |
+| `titleView` | `JSX.Element` | Name / title text | Sub-section (title) |
+| `subtitleView` | `JSX.Element` | Subtitle text (status / typing indicator) | Sub-section (subtitle) |
+| `auxiliaryButtonView` | `JSX.Element` | Auxiliary button area (next to call buttons) | Sub-section (auxiliary) |
-#### ItemView
+### itemView
-The customized chat interface is displayed below.
+Replace the entire list item (avatar + name + subtitle).
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import {
@@ -307,7 +301,6 @@ import {
CometChatListItem,
} from "@cometchat/chat-uikit-react";
-// Custom list item view definition
const CustomItemView = (
<>
;
```
-
-
-
-```css
+
+```css lines
.cometchat-message-header .cometchat-list-item .cometchat-avatar {
border-radius: 8px;
}
```
-
-
-***
-
-#### TitleView
+### titleView
-The customized chat interface is displayed below.
+Replace the name / title text.
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageHeader } from "@cometchat/chat-uikit-react";
-// Custom title view component
function CustomTitleView() {
return (
@@ -374,57 +358,43 @@ function CustomTitleView() {
;
```
-
-
-
-```css
+
+```css lines
.cometchat-message-header .message-header__title-view {
display: flex;
gap: 4px;
width: 100%;
}
-.cometchat-message-header
- .message-header__title-view
- .message-header__title-view-name {
+.cometchat-message-header .message-header__title-view .message-header__title-view-name {
color: #141414;
font: 500 16px/19.2px Roboto;
text-align: left;
}
-.cometchat-message-header
- .message-header__title-view
- .message-header__title-view-status {
+
+.cometchat-message-header .message-header__title-view .message-header__title-view-status {
color: #6852d6;
font: 400 16px/19.2px Roboto;
text-align: left;
}
```
-
-
-***
-
-#### SubtitleView
+### subtitleView
-The customized chat interface is displayed below.
+Replace the subtitle text (status / typing indicator area).
-Use the following code to achieve the customization shown above.
-
-
-
-```ts
+```ts lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageHeader } from "@cometchat/chat-uikit-react";
-// Custom subtitle view component
function CustomSubtitleView() {
return <>{group?.getMembersCount() + " • " + group?.getDescription()}>;
}
@@ -432,25 +402,17 @@ function CustomSubtitleView() {
;
```
-
-
-
-
-***
+### leadingView
-#### LeadingView
-
-The customized chat interface is displayed below.
+Replace the avatar / left section.
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import {
@@ -458,7 +420,6 @@ import {
CometChatAvatar,
} from "@cometchat/chat-uikit-react";
-// Custom title view component
function CustomLeadingView() {
return (
@@ -472,19 +433,11 @@ function CustomLeadingView() {
;
```
-
-
-
-```css
-.cometchat-message-header
- .cometchat-list-item
- .message-header__leading-view
- .cometchat-avatar__image,
-.cometchat-message-header
- .cometchat-list-item
- .message-header__leading-view
- .cometchat-avatar {
+
+```css lines
+.cometchat-message-header .cometchat-list-item .message-header__leading-view .cometchat-avatar__image,
+.cometchat-message-header .cometchat-list-item .message-header__leading-view .cometchat-avatar {
border-radius: 8px;
height: 48px;
width: 48px;
@@ -503,30 +456,25 @@ function CustomLeadingView() {
position: absolute;
bottom: -2px;
}
+
.message-header__leading-view {
position: relative;
}
```
-
-
-***
-
-#### TrailingView
+### trailingView
-The customized chat interface is displayed below.
+Replace the right section (call buttons area).
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import {
@@ -534,7 +482,6 @@ import {
CometChatButton,
} from "@cometchat/chat-uikit-react";
-// Custom trailing view component
function CustomTrailingButtonView() {
return (
<>
@@ -542,7 +489,7 @@ function CustomTrailingButtonView() {
onClick={() => {
// Your logic here
}}
- iconURL={icon} // Ensure `icon` is defined or passed as a prop
+ iconURL={icon}
/>
>
);
@@ -553,46 +500,34 @@ function CustomTrailingButtonView() {
trailingView={CustomTrailingButtonView()}
/>;
```
-
-
-
-```css
-.cometchat-message-header
- .cometchat-list-item__trailing-view
- .cometchat-button {
+
+```css lines
+.cometchat-message-header .cometchat-list-item__trailing-view .cometchat-button {
background: transparent;
height: 24px;
width: 24px;
padding: 0;
}
-.cometchat-message-header
- .cometchat-list-item__trailing-view
- .cometchat-button__icon {
+.cometchat-message-header .cometchat-list-item__trailing-view .cometchat-button__icon {
background: black;
}
```
-
-
-***
-
-#### AuxiliaryButtonView
+### auxiliaryButtonView
-The customized chat interface is displayed below.
+Replace the auxiliary button area (next to call buttons).
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import {
@@ -600,7 +535,6 @@ import {
CometChatButton,
} from "@cometchat/chat-uikit-react";
-// Custom auxiliary view component
function CustomAuxiliaryButtonView() {
return (
<>
@@ -608,7 +542,7 @@ function CustomAuxiliaryButtonView() {
onClick={() => {
// Your logic here
}}
- iconURL={icon} // Ensure `icon` is defined or passed as a prop
+ iconURL={icon}
/>
>
);
@@ -619,87 +553,70 @@ function CustomAuxiliaryButtonView() {
auxiliaryButtonView={CustomAuxiliaryButtonView()}
/>;
```
-
-
-
-```css
-.cometchat-message-header
- .cometchat-message-header__auxiliary-view
- .cometchat-button {
+
+```css lines
+.cometchat-message-header .cometchat-message-header__auxiliary-view .cometchat-button {
background: transparent;
height: 24px;
width: 24px;
padding: 0;
}
-.cometchat-message-header
- .cometchat-message-header__auxiliary-view
- .cometchat-button__icon {
+.cometchat-message-header .cometchat-message-header__auxiliary-view .cometchat-button__icon {
background: black;
}
```
-
-
-#### LastActiveAt Date Time Format
-
-The `lastActiveAtDateTimeFormat` property allows you to customize the **last active** timestamp displayed in the message header.
-
-Default Date Time Format:
-
-```ruby
-new CalendarObject({
- today: `[Last seen DD MMM at] hh:mm A`, // Example: "today at 10:30 AM"
- yesterday: `[Last seen DD MMM at] hh:mm A`, // Example: "yesterday at 08:15 PM"
- otherDays: `[Last seen DD MMM at] hh:mm A`, // Example: "25, Jan 05:45 PM"
- relativeTime: {
- hour: `Last seen %d hour ago`, // Example: "1 hour ago"
- minute: `Last seen %d minute ago`, // Example: "1 minute ago"
- minutes: `Last seen %d minutes ago`, // Example: "5 minutes ago"
- },
-});
-```
+### lastActiveAtDateTimeFormat
-The following example demonstrates how to modify the **last active** timestamp format using a custom [`CalendarObject`](/ui-kit/react/localize#calendarobject).
+Customize the "last seen" timestamp format using a `CalendarObject`.
-
-
-```ts
+```ts lines
import {
CometChatMessageHeader,
CalendarObject,
} from "@cometchat/chat-uikit-react";
-// 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"
+ today: `hh:mm A`,
+ yesterday: `[yesterday]`,
+ otherDays: `DD MM YYYY`,
});
return dateFormat;
}
-// Apply the custom format to the CometChatMessageHeader component
;
```
-
-
-
-
+If a property is not passed in the CalendarObject, the component checks the [global configuration](/ui-kit/react/localize#customisation) first, then falls back to the component's default formatting.
+
-**Fallback Mechanism**
+## Theme and Styling
-* If you **do not** pass any property in the [**CalendarObject**](/ui-kit/react/localize#calendarobject), the component will first check the [**global configuration**](/ui-kit/react/localize#customisation). If the property is **also missing in the global configuration**, it will **fallback to the component's default formatting**.
+Using CSS, customize the look and feel of the component. The root CSS class is `.cometchat-message-header`.
-
+
+
+
-***
+```tsx lines
+
+```
+
+```css lines
+.cometchat-message-header .cometchat-list-item .cometchat-avatar {
+ background: #f0999b;
+ border-radius: 8px;
+}
+.cometchat-message-header .cometchat-avatar__text {
+ font-family: "SF Pro";
+}
+```
diff --git a/ui-kit/react/message-list.mdx b/ui-kit/react/message-list.mdx
index e2300b1d1..297b86e45 100644
--- a/ui-kit/react/message-list.mdx
+++ b/ui-kit/react/message-list.mdx
@@ -1,26 +1,35 @@
---
title: "Message List"
+description: "CometChatMessageList component renders a scrollable list of sent and received messages including text, media, reactions, read receipts, and threaded replies. Supports custom message templates, date separators, and CSS styling."
---
-## Overview
-
-`MessageList` is a composite component that displays a list of messages and effectively manages real-time operations. It includes various types of messages such as Text Messages, Media Messages, Stickers, and more.
-
-***
+
-## Usage
+| Field | Value |
+| --- | --- |
+| Purpose | Scrollable list of sent and received messages with text, media, reactions, read receipts, threaded replies, date separators, and AI features |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatMessageList } from "@cometchat/chat-uikit-react";` |
+| Used in experiences | Chat view, threaded conversations, message detail panel |
+| Copy-paste base | See [Base Code](#base-code--stylesheet) below |
+| Primary output | Message interactions (thread replies, reactions, edits, deletes) |
+| Primary hook points | `onThreadRepliesClick`, `onError`, `onReactionClick`, `onReactionListItemClick`, `messagesRequestBuilder`, `templates`, view slots (`headerView`, `footerView`) |
+| CSS root class | `.cometchat-message-list` |
+| Real-time events | `CometChatMessageEvents.ccMessageEdited`, `CometChatMessageEvents.ccMessageDeleted`, `CometChatMessageEvents.ccMessageRead`, `CometChatMessageEvents.ccReplyToMessage` |
-### Integration
+
-The following code snippet illustrates how you can directly incorporate the MessageList component into your Application.
+## Base Code and Stylesheet
+
+Renders a scrollable list of messages for a user or group conversation.
-```tsx
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
@@ -40,85 +49,145 @@ export function MessageListDemo() {
) : null;
}
```
-
-
-```tsx
+```tsx lines
import { MessageListDemo } from "./MessageListDemo";
export default function App() {
return (
-
-
-
+
);
}
```
-
-
-
+Root CSS class for style overrides:
+
+```css lines
+.cometchat-message-list {
+ /* overrides here */
+}
+```
+
+## Functionality
+
+Props that control component behavior, grouped by surface area.
+
+### Data
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `user` | `CometChat.User` | `undefined` | Displays messages for a 1-on-1 conversation | Pass either `user` or `group`, not both |
+| `group` | `CometChat.Group` | `undefined` | Displays messages for a group conversation | Pass either `user` or `group`, not both |
+| `messagesRequestBuilder` | `CometChat.MessagesRequestBuilder` | SDK default | Controls which messages load and in what order | UID/GUID are always overridden internally |
+| `reactionsRequestBuilder` | `CometChat.ReactionsRequestBuilder` | SDK default | Controls how reactions are fetched for messages | — |
+| `parentMessageId` | `number` | `undefined` | Displays threaded conversation for the specified parent message | — |
+| `templates` | `CometChatMessageTemplate[]` | SDK defaults | Custom message bubble templates | Template `type`/`category` must match the message |
+| `goToMessageId` | `string` | `undefined` | Scrolls to the specified message on initial load | — |
+
+### UI Visibility Toggles
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `hideDateSeparator` | `boolean` | `false` | Hides date separator between message groups | — |
+| `hideStickyDate` | `boolean` | `false` | Hides the sticky date header | — |
+| `hideReceipts` | `boolean` | `false` | Hides read/delivery receipts | — |
+| `hideError` | `boolean` | `false` | Hides the default and custom error views | Also suppresses `errorView` if set |
+| `hideReplyInThreadOption` | `boolean` | `false` | Hides the "Reply in Thread" option | — |
+| `hideTranslateMessageOption` | `boolean` | `false` | Hides the translate message option | — |
+| `hideEditMessageOption` | `boolean` | `false` | Hides the edit message option | — |
+| `hideDeleteMessageOption` | `boolean` | `false` | Hides the delete message option | — |
+| `hideReactionOption` | `boolean` | `false` | Hides the reaction option | — |
+| `hideMessagePrivatelyOption` | `boolean` | `false` | Hides the "Message Privately" option | — |
+| `hideCopyMessageOption` | `boolean` | `false` | Hides the copy message option | — |
+| `hideMessageInfoOption` | `boolean` | `false` | Hides the message info option | — |
+| `hideReplyOption` | `boolean` | `false` | Hides the reply option | — |
+| `hideAvatar` | `boolean` | `false` | Hides avatars on messages | — |
+| `hideGroupActionMessages` | `boolean` | `false` | Hides group action messages (join, leave, etc.) | — |
+| `showConversationStarters` | `boolean` | `false` | Shows AI conversation starters | — |
+| `showSmartReplies` | `boolean` | `false` | Shows AI smart replies | — |
+| `hideModerationView` | `boolean` | `false` | Hides the moderation view below moderated messages | — |
+| `hideFlagMessageOption` | `boolean` | `false` | Hides the "Report Message" option | — |
+| `hideFlagRemarkField` | `boolean` | `false` | Hides the remark text area in the flag message dialog | — |
+
+### Behavior
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `messageAlignment` | `MessageListAlignment` | `MessageListAlignment.standard` | Controls message alignment (left, right, standard) | — |
+| `scrollToBottomOnNewMessages` | `boolean` | `false` | Auto-scrolls to bottom when new messages arrive | — |
+| `quickOptionsCount` | `number` | `2` | Number of message options visible in the main menu | — |
+| `disableSoundForMessages` | `boolean` | `false` | Disables the sound effect for new messages | — |
+| `customSoundForMessages` | `string` | `undefined` | Custom sound file URL for new messages | — |
+| `startFromUnreadMessages` | `boolean` | `false` | Loads from the first unread message if available | Falls back to latest messages if no unreads |
+| `showMarkAsUnreadOption` | `boolean` | `false` | Shows "Mark Unread" option in message actions | Only appears for received messages |
+| `isAgentChat` | `boolean` | `false` | Toggles AI Agent functionality for the message list | — |
+| `loadLastAgentConversation` | `boolean` | `false` | Loads the most recent existing agent conversation on mount | — |
+
+### AI / Smart Replies
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `smartRepliesKeywords` | `string[]` | `undefined` | Keywords that trigger smart replies | — |
+| `smartRepliesDelayDuration` | `number` | `undefined` | Delay (ms) before smart replies appear | — |
+
+### Date Formatting
+
+| Property | Type | Default | Effect |
+| --- | --- | --- | --- |
+| `separatorDateTimeFormat` | `CalendarObject` | `today/yesterday/DD MMM, YYYY` | Customizes date separator timestamps |
+| `stickyDateTimeFormat` | `CalendarObject` | `today/yesterday/DD MMM, YYYY` | Customizes sticky date header timestamps |
+| `messageSentAtDateTimeFormat` | `CalendarObject` | `hh:mm A` | Customizes message sent-at timestamps |
+| `messageInfoDateTimeFormat` | `CalendarObject` | `DD MMM, hh:mm A` | Customizes message info timestamps |
-To fetch messages for a specific entity, you need to supplement it with `User` or `Group` Object.
+
+If a property is not passed in the CalendarObject, the component checks the [global configuration](/ui-kit/react/localize#customisation) first, then falls back to the component's default formatting.
+
-
+### Custom Views (Render Props)
-***
+These replace sections of the default UI. See [Custom View Slots](#custom-view-slots) for full examples.
-### Actions
+| Property | Type | Effect |
+| --- | --- | --- |
+| `headerView` | `JSX.Element` | Shown above the message list |
+| `footerView` | `JSX.Element` | Shown below the message list |
+| `loadingView` | `JSX.Element` | Shown while messages are loading |
+| `emptyView` | `JSX.Element` | Shown when there are no messages |
+| `errorView` | `JSX.Element` | Shown when an error occurs |
+| `textFormatters` | `CometChatTextFormatter[]` | Custom text formatters for message content |
-[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.
+## Actions
-##### 1. onThreadRepliesClick
+[Actions](/ui-kit/react/components-overview#actions) split into predefined (built-in triggers) and user-defined (callbacks).
-`onThreadRepliesClick` is triggered when you click on the threaded message bubble. The `onThreadRepliesClick` action doesn't have a predefined behavior. You can override this action using the following code snippet.
+### Predefined Actions
-
-
-```ts
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatMessageList } from "@cometchat/chat-uikit-react";
+The component handles message rendering, scrolling, and real-time updates internally. Thread replies, reactions, edits, and deletes are built-in.
-export function MessageListDemo() {
- const [chatUser, setChatUser] = React.useState();
- React.useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
- }, []);
+### User-Defined Actions
- const getOnThreadRepliesClick = () => {
- //your custom actions
- };
+#### onThreadRepliesClick
- return chatUser ? (
-
-
-
- ) : null;
-}
-```
+Fires when the threaded message bubble is clicked.
-
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks on a threaded message reply count |
+| Payload type | `(message: CometChat.BaseMessage, view: () => void) => void` |
+| What devs typically do next | Open thread panel, navigate to thread view |
-
-```js
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
- const [chatUser, setChatUser] = React.useState(null);
-
+ const [chatUser, setChatUser] = React.useState();
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
@@ -140,17 +209,17 @@ export function MessageListDemo() {
}
```
-
-
-
+#### onError
-##### 2. onError
+Fires when the component encounters an error.
-This action doesn't change the behavior of the component but rather listens for any errors that occur in the MessageList component.
+| Detail | Value |
+| --- | --- |
+| When it fires | Any internal error during data fetching or rendering |
+| Payload type | `(error: CometChat.CometChatException) => void` |
+| What devs typically do next | Log to error tracking service |
-
-
-```ts
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
@@ -175,46 +244,17 @@ export function MessageListDemo() {
}
```
-
-
-
-```js
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatMessageList } from "@cometchat/chat-uikit-react";
-
-export function MessageListDemo() {
- const [chatUser, setChatUser] = React.useState(null);
-
- React.useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
- }, []);
-
- const handleError = (error) => {
- throw new Error("your custom error action");
- };
-
- return chatUser ? (
-
-
-
- ) : null;
-}
-```
-
-
-
-
+#### onReactionClick
-##### 3. onReactionClick
+Fires when a reaction item on a message bubble is clicked.
-`onReactionClick` is triggered when you click on the reaction item of the message bubble. The `onReactionClick` action doesn't have a predefined behavior. You can override this action using the following code snippet.
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks a reaction on a message |
+| Payload type | `(reaction: CometChat.ReactionCount, message: CometChat.BaseMessage) => void` |
+| What devs typically do next | Toggle reaction, show reaction details |
-
-
-```ts
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
@@ -242,46 +282,17 @@ export function MessageListDemo() {
}
```
-
-
-
-```js
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatMessageList } from "@cometchat/chat-uikit-react";
-
-export function MessageListDemo() {
- const [chatUser, setChatUser] = React.useState(null);
-
- React.useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
- }, []);
-
- const onReactionClick = (reaction, message) => {
- //your custom action
- };
-
- return chatUser ? (
-
-
-
- ) : null;
-}
-```
-
-
-
-
+#### onReactionListItemClick
-##### 4. onReactionListItemClick
+Fires when a reaction list item is clicked (in the reaction detail view).
-`onReactionListItemClick` is triggered when you click on the reaction list item of the reaction list. The `onReactionListItemClick` action doesn't have a predefined behavior. You can override this action using the following code snippet.
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks a specific reaction in the reaction list |
+| Payload type | `(reaction: CometChat.Reaction, message: CometChat.BaseMessage) => void` |
+| What devs typically do next | Show who reacted, navigate to user profile |
-
-
-```ts
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
@@ -312,128 +323,19 @@ export function MessageListDemo() {
}
```
-
-
-
-```js
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatMessageList } from "@cometchat/chat-uikit-react";
-
-export function MessageListDemo() {
- const [chatUser, setChatUser] = React.useState(null);
-
- React.useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
- }, []);
-
- const onReactionListItemClick = (reaction, message) => {
- //your custom action
- };
-
- return chatUser ? (
-
-
-
- ) : null;
-}
-```
-
-
-
-
-
-### Filters
-
-##### 1. Messages Request Builder
-
-You can adjust the `MessagesRequestBuilder` in the MessageList Component to customize your message list. Numerous options are available to alter the builder to meet your specific needs. For additional details on `MessagesRequestBuilder`, please visit [MessagesRequestBuilder](/sdk/javascript/additional-message-filtering).
-
-In the example below, we are applying a filter to the messages based on a search substring and for a specific user. This means that only messages that contain the search term and are associated with the specified user will be displayed
-
-
-
-```ts
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatMessageList } from "@cometchat/chat-uikit-react";
-
-export function MessageListDemo() {
- const [chatUser, setChatUser] = React.useState();
- React.useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
- }, []);
-
- return chatUser ? (
-
- ) : null;
-}
-```
+## Filters
-
+Control which messages appear using `MessagesRequestBuilder`. Pass the builder to the `messagesRequestBuilder` prop.
-
+Refer to [MessagesRequestBuilder](/sdk/javascript/additional-message-filtering) for the full API.
-
-The following parameters in messageRequestBuilder will always be altered inside the message list
-
-1. UID
-2. GUID
-
+The `UID` and `GUID` parameters in `messagesRequestBuilder` are always overridden internally by the component based on the `user` or `group` prop.
-##### 2. Reactions Request Builder
-
-You can adjust the `ReactionsRequestBuilder` in the MessageList Component to customize and fetch the reactions for the messages. Numerous options are available to alter the builder to meet your specific needs.
+### Messages Request Builder
-
-
-```ts
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
@@ -450,7 +352,7 @@ export function MessageListDemo() {
@@ -459,17 +361,15 @@ export function MessageListDemo() {
}
```
-
+### Reactions Request Builder
-
-```js
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
export function MessageListDemo() {
- const [chatUser, setChatUser] = React.useState(null);
-
+ const [chatUser, setChatUser] = React.useState();
React.useEffect(() => {
CometChat.getUser("uid").then((user) => {
setChatUser(user);
@@ -489,61 +389,24 @@ export function MessageListDemo() {
}
```
-
-
-
-
-### Events
-
-[Events](/ui-kit/react/components-overview#events) are emitted by a `Component`. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
-
-The list of events emitted by the Message List component is as follows.
-
-| Event | Description |
-| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
-| **ccOpenChat** | this event alerts the listeners if the logged-in user has opened a user or a group chat. |
-| **ccMessageEdited** | Triggers whenever a loggedIn user edits any message from the list of messages .it will have three states such as: inProgress, success and error. |
-| **ccReplyToMessage** | Triggers whenever a loggedIn user replies to any message from the list of messages .it will have three states such as: inProgress, success and error. |
-| **ccMessageDeleted** | Triggers whenever a loggedIn user deletes any message from the list of messages. |
-| **ccActiveChatChanged** | This event is triggered when the user navigates to a particular chat window. |
-| **ccMessageRead** | Triggers whenever a loggedIn user reads any message. |
-
-Adding `CometChatMessageEvents` Listener's
-
-
-
-```ts
-import { CometChatMessageEvents, CometChatUIEvents } from "@cometchat/chat-uikit-react";
-
-const ccOpenChat = CometChatUIEvents.ccOpenChat.subscribe(() => {
- // Your Code
-});
-
-const ccMessageEdited = CometChatMessageEvents.ccMessageEdited.subscribe(() => {
- // Your Code
-});
-
-const ccReplyToMessage = CometChatMessageEvents.ccReplyToMessage.subscribe(() => {
- // Your Code
-});
+## Events
-const ccMessageDeleted = CometChatMessageEvents.ccMessageDeleted.subscribe(() => {
- // Your Code
-});
+### UI Events
-const ccActiveChatChanged = CometChatUIEvents.ccActiveChatChanged.subscribe(() => {
- // Your Code
-});
+Events emitted by the MessageList component:
-const ccMessageRead = CometChatMessageEvents.ccMessageRead.subscribe(() => {
- // Your Code
-});
-```
+| Event | Source | When it fires |
+| --- | --- | --- |
+| `ccOpenChat` | `CometChatUIEvents` | User opens a user or group chat |
+| `ccMessageEdited` | `CometChatMessageEvents` | A message is edited (inProgress, success, error) |
+| `ccReplyToMessage` | `CometChatMessageEvents` | User replies to a message |
+| `ccMessageDeleted` | `CometChatMessageEvents` | A message is deleted |
+| `ccActiveChatChanged` | `CometChatUIEvents` | User navigates to a different chat |
+| `ccMessageRead` | `CometChatMessageEvents` | A message is read |
-
+#### Subscribe
-
-```js
+```tsx lines
import { CometChatMessageEvents, CometChatUIEvents } from "@cometchat/chat-uikit-react";
const ccOpenChat = CometChatUIEvents.ccOpenChat.subscribe(() => {
@@ -571,198 +434,42 @@ const ccMessageRead = CometChatMessageEvents.ccMessageRead.subscribe(() => {
});
```
-
-
-
-
-***
-
-Removing `CometChatMessageEvents` Listener's
-
-
-
-```ts
-ccMessageEdited?.unsubscribe();
-ccReplyToMessage?.unsubscribe();
-ccActiveChatChanged?.unsubscribe();
-```
+#### Unsubscribe
-
-
-
-```js
+```tsx lines
+ccOpenChat?.unsubscribe();
ccMessageEdited?.unsubscribe();
ccReplyToMessage?.unsubscribe();
+ccMessageDeleted?.unsubscribe();
ccActiveChatChanged?.unsubscribe();
+ccMessageRead?.unsubscribe();
```
-
+### SDK Events (Real-Time)
-
+The component automatically listens to SDK message events internally for real-time updates. No manual attachment needed unless additional side effects are required.
-***
+## Advanced: Custom View Slots
-## Customization
+Customization override points for the message list UI.
-To fit your app's design requirements, you can customize the appearance of the Message List component. We provide exposed properties that allow you to modify the experience and behavior according to your specific needs.
+### Slot Catalog
-### Style
+| Slot | Params | What it replaces | Section |
+| --- | --- | --- | --- |
+| `headerView` | `JSX.Element` | Area above the message list | Whole section |
+| `footerView` | `JSX.Element` | Area below the message list | Whole section |
+| `loadingView` | `JSX.Element` | Loading spinner | Empty/loading/error |
+| `emptyView` | `JSX.Element` | Empty state | Empty/loading/error |
+| `errorView` | `JSX.Element` | Error state | Empty/loading/error |
+| `templates` | `CometChatMessageTemplate[]` | Message bubble rendering | Whole item |
+| `textFormatters` | `CometChatTextFormatter[]` | Text formatting in messages | Text content |
-You can set the css to the MessageList Component Component to customize the styling.
+### templates
-**Example**
+[CometChatMessageTemplate](/ui-kit/react/message-template) is a pre-defined structure for creating message views (message bubbles). Refer to [CometChatMessageTemplate](/ui-kit/react/message-template) for details.
-
-
-
-
-
-
-```ts
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatMessageList } from "@cometchat/chat-uikit-react";
-
-;
-```
-
-
-
-
-```css
-.cometchat-message-bubble__body
- .cometchat-text-bubble.cometchat-text-bubble-incoming
- .cometchat-text-bubble__body-text {
- font-family: "SF Pro";
-}
-```
-
-
-
-
-
-### 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.
-
-
-
-```ts
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatMessageList } from "@cometchat/chat-uikit-react";
-
-export function MessageListDemo() {
- const [chatUser, setChatUser] = React.useState();
- React.useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
- }, []);
-
- return chatUser ? (
-
- ) : null;
-}
-```
-
-
-
-
-
-***
-
-Below is a list of customizations along with corresponding code snippets
-
-| Property | Description | Code |
-| ------------------------------------ | ------------------------------------------------------------------------------------------- | ---------------------------------------------- |
-| **Hide Date Separator** | Hides the visibility of the date separator in the message list. | `hideDateSeparator={true}` |
-| **Hide Sticky Date** | Hides the sticky date header in the message list. | `hideStickyDate={true}` |
-| **Hide Receipts** | Hides the visibility of receipts in the message list. | `hideReceipts={true}` |
-| **Hide Error** | Hides the default & custom error view passed in the `errorView` prop. | `hideError={true}` |
-| **Hide Reply In Thread Option** | Hides the option to reply to messages in a thread. | `hideReplyInThreadOption={true}` |
-| **Hide Translate Message Option** | Hides the option to translate messages. | `hideTranslateMessageOption={true}` |
-| **Hide Edit Message Option** | Hides the option to edit messages. | `hideEditMessageOption={true}` |
-| **Hide Delete Message Option** | Hides the option to delete messages. | `hideDeleteMessageOption={true}` |
-| **Hide Reaction Option** | Hides the option to react to messages. | `hideReactionOption={true}` |
-| **Hide Message Privately Option** | Hides the option to message a user privately. | `hideMessagePrivatelyOption={true}` |
-| **Hide Copy Message Option** | Hides the option to copy messages. | `hideCopyMessageOption={true}` |
-| **Hide Message Info Option** | Hides the option to view message information. | `hideMessageInfoOption={true}` |
-| **Hide Reply Option** | Hides the reply option for a message. | `hideReplyOption={true}` |
-| **Hide Avatar** | Hides avatars for messages. | `hideAvatar={true}` |
-| **Hide Group Action Messages** | Hides group action messages. | `hideGroupActionMessages={true}` |
-| **Hide Conversation Starters** | Hides the visibility of the conversation starters in the message list. | `hideConversationStarters={true}` |
-| **Hide Smart Replies** | Hides the visibility of the smart replies in the message list. | `hideSmartReplies={true}` |
-| **Hide Moderation View** | Hides the moderation view shown below the message bubble in the bottom view when a message is moderated. | `hideModerationView={true}` |
-| **Hide Flag Message Option** | Hides the "Report Message" option from message actions menu. | `hideFlagMessageOption={true}` |
-| **Hide Flag Remark Field** | Hides the remark text area in the flag message dialog. | `hideFlagRemarkField={true}` |
-| **Parent Message ID** | Unique identifier of the parent message for displaying threaded conversations. | `parentMessageId={1234}` |
-| **User** | A `CometChat.User` object representing the participant of the chat. | `user={chatUser}` |
-| **Group** | A `CometChat.Group` object representing the group whose chat messages are displayed. | `group={chatGroup}` |
-| **Message Alignment** | Specifies the alignment of messages in the list (e.g., left, right). | `messageAlignment={MessageListAlignment.left}` |
-| **Scroll To Bottom On New Messages** | Automatically scrolls the message list to the bottom when a new message arrives. | `scrollToBottomOnNewMessages={true}` |
-| **Quick Options Count** | Specifies how many message options are visible in the main menu by default. | `quickOptionsCount={3}` |
-| **Disable Sound For Messages** | Disables the sound effect when new messages arrive. | `disableSoundForMessages={true}` |
-| **Custom Sound For Messages** | Specifies a custom sound file to play when new messages arrive. | `customSoundForMessages="sound.mp3"` |
-| **Smart Replies Keywords** | Sets the keywords on which the smart replies should be triggered in the message list. | `smartRepliesKeywords={['why', 'how']}` |
-| **Smart Replies Delay Duration** | Sets the delay duration (in milliseconds) before smart replies are shown. | `smartRepliesDelayDuration={5000}` |
-| **Start From Unread Messages** | When set to true, the chat will load from the first unread message if unread messages exist, otherwise loads from the latest messages. Default is false. | `startFromUnreadMessages={true}` |
-| **Show Mark Unread Option** | When set to true, shows the "Mark Unread" option in the message actions menu. This option will only appear for received messages, not for the user's own messages. Default is false. | `showMarkAsUnreadOption={true}` |
-| **Empty View** | Custom empty state view to display when there are no messages. | `emptyView={}` |
-| **Error View** | A custom view displayed when there are no messages. | `errorView={}` |
-| **Loading View** | A custom view displayed while messages are being fetched. | `loadingView={}` |
-| **Go To MessageId** | The ID of the message that the list should automatically scroll to when it is first loaded. | `goToMessageId={1}` |
-
-***
-
-### 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.
-
-#### Templates
-
-[CometChatMessageTemplate](/ui-kit/react/message-template) is a pre-defined structure for creating message views that can be used as a starting point or blueprint for creating message views often known as message bubbles. For more information, you can refer to [CometChatMessageTemplate](/ui-kit/react/message-template).
-
-You can set message Templates to MessageList by using the following code snippet.
-
-
-
-```ts
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import {
@@ -820,300 +527,17 @@ export function MessageListDemo() {
}
```
-
+### headerView
-
-```js
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import {
- CometChatMessageList,
- ChatConfigurator,
- CometChatActionsIcon,
-} from "@cometchat/chat-uikit-react";
-
-export function MessageListDemo() {
- const [chatUser, setChatUser] = React.useState(null);
-
- React.useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
- }, []);
-
- const getCustomOptions = (loggedInUser, message, theme, group) => {
- const defaultOptions = ChatConfigurator.getDataSource().getMessageOptions(
- loggedInUser,
- message,
- group
- );
- const myView = new CometChatActionsIcon({
- id: "custom id",
- title: "your custom title for options",
- iconURL: "your custom icon url for options",
- onClick: () => console.log("custom action"),
- });
- defaultOptions.push(myView);
- return defaultOptions;
- };
-
- const getTemplates = () => {
- let templates = ChatConfigurator.getDataSource().getAllMessageTemplates();
- templates.map((data) => {
- data.options = (loggedInUser, message, group) =>
- getCustomOptions(loggedInUser, message, group);
- });
- return templates;
- };
-
- return chatUser ? (
-
-
-
- ) : null;
-}
-```
-
-
-
-
-
-***
-
-#### Separator DateTime Format
-
-The `separatorDateTimeFormat` property allows you to customize the **Date Separator** timestamp displayed in the Message List.
-
-Default Date Time Format:
-
-```javascript
-new CalendarObject({
- today: "today" // Example: "today"
- yesterday: "yesterday", // Example: "yesterday"
- otherDays: `DD MMM, YYYY`, // Example: "25 Jan, 2025"
-});
-```
-
-The following example demonstrates how to modify the **Date Separator** timestamp format using a custom [`CalendarObject`](/ui-kit/react/localize#calendarobject).
-
-
-
-```ts
-import {
- CometChatMessageList,
- CalendarObject,
-} from "@cometchat/chat-uikit-react";
-
-// 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/05/2025"
- });
- return dateFormat;
-}
-
-// Apply the custom format to the CometChatMessageList component
-;
-```
-
-
-
-
-
-
-
-**Fallback Mechanism**
-
-* If you **do not** pass any property in the [**CalendarObject**](/ui-kit/react/localize#calendarobject), the component will first check the [**global configuration**](/ui-kit/react/localize#customisation). If the property is **also missing in the global configuration**, it will **fallback to the component's default formatting**.
-
-
-
-***
-
-#### Sticky DateTime Format
-
-The `stickyDateTimeFormat` property allows you to customize the **Sticky Date** timestamp displayed in the Message List.
-
-!\[]\(Screenshot HERE)
-
-Default Date Time Format:
-
-```javascript
-new CalendarObject({
- today: "today" // Example: "today"
- yesterday: "yesterday", // Example: "yesterday"
- otherDays: `DD MMM, YYYY`, // Example: "25 Jan, 2025"
-});
-```
-
-The following example demonstrates how to modify the **Sticky Date** timestamp format using a custom [`CalendarObject`](/ui-kit/react/localize#calendarobject).
-
-
-
-```ts
-import {
- CometChatMessageList,
- CalendarObject,
-} from "@cometchat/chat-uikit-react";
-
-// 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/05/2025"
- });
- return dateFormat;
-}
-
-// Apply the custom format to the CometChatMessageList component
-;
-```
-
-
-
-
-
-
-
-**Fallback Mechanism**
-
-* If you **do not** pass any property in the [**CalendarObject**](/ui-kit/react/localize#calendarobject), the component will first check the [**global configuration**](/ui-kit/react/localize#customisation). If the property is **also missing in the global configuration**, it will **fallback to the component's default formatting**.
-
-
-
-***
-
-#### Message SentAt DateTime Format
-
-The `messageSentAtDateTimeFormat` property allows you to customize the **Message SentAt** timestamp displayed in the Message List.
-
-Default Date Time Format:
-
-```javascript
-new CalendarObject({
- today: "hh:mm A" // Example: "12:00 PM"
- yesterday: "hh:mm A", // Example: "01:00 AM"
- otherDays: `hh:mm A`, // Example: "09:30 PM"
-});
-```
-
-The following example demonstrates how to modify the **Message SentAt** timestamp format using a custom [`CalendarObject`](/ui-kit/react/localize#calendarobject).
-
-
-
-```ts
-import {
- CometChatMessageList,
- CalendarObject,
-} from "@cometchat/chat-uikit-react";
-
-// 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/05/2025"
- });
- return dateFormat;
-}
-
-// Apply the custom format to the CometChatMessageList component
-;
-```
-
-
-
-
-
-
-
-**Fallback Mechanism**
-
-* If you **do not** pass any property in the [**CalendarObject**](/ui-kit/react/localize#calendarobject), the component will first check the [**global configuration**](/ui-kit/react/localize#customisation). If the property is **also missing in the global configuration**, it will **fallback to the component's default formatting**.
-
-
-
-***
-
-#### Message Info DateTime Format
-
-The `messageInfoDateTimeFormat` property allows you to customize the **Message Info** timestamp displayed in the Message List.
-
-Default Date Time Format:
-
-```ruby
-new CalendarObject({
- today: `DD MMM, hh:mm A`, // Example: "29 Jan, 04:34 AM"
- yesterday: `DD MMM, hh:mm A`, // Example: "29 Jan, 04:34 AM"
- otherDays: `DD MMM, hh:mm A`, // Example: "29 Jan, 04:34 AM"
-});
-```
-
-The following example demonstrates how to modify the **Message Info** timestamp format using a custom [`CalendarObject`](/ui-kit/react/localize#calendarobject).
-
-
-
-```ts
-import {
- CometChatMessageList,
- CalendarObject,
-} from "@cometchat/chat-uikit-react";
-
-// 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/05/2025"
- });
- return dateFormat;
-}
-
-// Apply the custom format to the CometChatMessageList component
-;
-```
-
-
-
-
-
-
-
-**Fallback Mechanism**
-
-* If you **do not** pass any property in the [**CalendarObject**](/ui-kit/react/localize#calendarobject), the component will first check the [**global configuration**](/ui-kit/react/localize#customisation). If the property is **also missing in the global configuration**, it will **fallback to the component's default formatting**.
-
-
-
-***
-
-#### Headerview
-
-You can set custom headerView to the Message List component using the following method.
-
-The customized chat interface is displayed below.
+Custom view above the message list.
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
@@ -1147,49 +571,9 @@ export function MessageListDemo() {
) : null;
}
```
-
-
-
-```js
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatMessageList } from "@cometchat/chat-uikit-react";
-import notesIcon from "../../assets/notesIcon.svg";
-import pinnedIcon from "../../assets/pinnedIcon.svg";
-import savedIcon from "../../assets/savedIcon.svg";
-
-export function MessageListDemo() {
- const [chatUser, setChatUser] = React.useState(null);
-
- React.useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
- }, []);
-
- const getHeaderView = () => {
- return (
-
-
-
-
-
- );
- };
-
- return chatUser ? (
-
-
-
- ) : null;
-}
-```
-
-
-
-
-```css
+
+```css lines
.header-view {
display: flex;
width: 100%;
@@ -1223,28 +607,20 @@ export function MessageListDemo() {
align-items: center;
}
```
-
-
-***
-
-#### FooterView
-
-You can set custom footerview to the Message List component using the following method.
+### footerView
-The customized chat interface is displayed below.
+Custom view below the message list.
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
@@ -1280,51 +656,9 @@ export function MessageListDemo() {
) : null;
}
```
-
-
-
-
-```js
-import React from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatMessageList } from "@cometchat/chat-uikit-react";
-import iceBreakersIcon from "../../assets/iceBreakersIcon.svg";
-import callIcon from "../../assets/callIcon.svg";
-import instagramIcon from "../../assets/instagramIcon.svg";
-import snapchatIcon from "../../assets/snapchatIcon.svg";
-
-export function MessageListDemo() {
- const [chatUser, setChatUser] = React.useState(null);
-
- React.useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatUser(user);
- });
- }, []);
-
- const getFooterView = () => {
- return (
-
-
-
-
-
-
- );
- };
-
- return chatUser ? (
-
-
-
- ) : null;
-}
-```
-
-
-
-```css
+
+```css lines
.footer-view {
display: flex;
width: 100%;
@@ -1358,202 +692,105 @@ export function MessageListDemo() {
align-items: center;
}
```
-
-
-***
-
-#### TextFormatters
+### Date Time Format Customization
-Assigns the list of text formatters. If the provided list is not null, it sets the list. Otherwise, it assigns the default text formatters retrieved from the data source. To configure the existing Mentions look and feel check out [CometChatMentionsFormatter](/ui-kit/react/mentions-formatter-guide)
-
-
-
-```ts
-import { CometChatTextFormatter } from "@cometchat/chat-uikit-react";
-import DialogHelper from "./Dialog";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-
-class ShortcutFormatter extends CometChatTextFormatter {
- private shortcuts: { [key: string]: string } = {};
- private dialogIsOpen: boolean = false;
- private dialogHelper = new DialogHelper();
- private currentShortcut: string | null = null; // Track the currently open shortcut
-
- constructor() {
- super();
- this.setTrackingCharacter("!");
- CometChat.callExtension("message-shortcuts", "GET", "v1/fetch", undefined)
- .then((data: any) => {
- if (data && data.shortcuts) {
- this.shortcuts = data.shortcuts;
- }
- })
- .catch((error) => console.log("error fetching shortcuts", error));
- }
-
- onKeyDown(event: KeyboardEvent) {
- const caretPosition =
- this.currentCaretPosition instanceof Selection
- ? this.currentCaretPosition.anchorOffset
- : 0;
- const textBeforeCaret = this.getTextBeforeCaret(caretPosition);
-
- const match = textBeforeCaret.match(/!([a-zA-Z]+)$/);
- if (match) {
- const shortcut = match[0];
- const replacement = this.shortcuts[shortcut];
- if (replacement) {
- // Close the currently open dialog, if any
- if (this.dialogIsOpen && this.currentShortcut !== shortcut) {
- this.closeDialog();
- }
- this.openDialog(replacement, shortcut);
- }
- }
- }
+#### separatorDateTimeFormat
- getCaretPosition() {
- if (!this.currentCaretPosition?.rangeCount) return { x: 0, y: 0 };
- const range = this.currentCaretPosition?.getRangeAt(0);
- const rect = range.getBoundingClientRect();
- return {
- x: rect.left,
- y: rect.top,
- };
- }
+```ts lines
+import {
+ CometChatMessageList,
+ CalendarObject,
+} from "@cometchat/chat-uikit-react";
- openDialog(buttonText: string, shortcut: string) {
- this.dialogHelper.createDialog(
- () => this.handleButtonClick(buttonText),
- buttonText
- );
- this.dialogIsOpen = true;
- this.currentShortcut = shortcut;
- }
+function getDateFormat() {
+ const dateFormat = new CalendarObject({
+ today: `hh:mm A`,
+ yesterday: `[yesterday]`,
+ otherDays: `DD/MM/YYYY`,
+ });
+ return dateFormat;
+}
- closeDialog() {
- this.dialogHelper.closeDialog(); // Use DialogHelper to close the dialog
- this.dialogIsOpen = false;
- this.currentShortcut = null;
- }
+;
+```
- handleButtonClick = (buttonText: string) => {
- if (this.currentCaretPosition && this.currentRange) {
- // Inserting the replacement text corresponding to the shortcut
- const shortcut = Object.keys(this.shortcuts).find(
- (key) => this.shortcuts[key] === buttonText
- );
- if (shortcut) {
- const replacement = this.shortcuts[shortcut];
- this.addAtCaretPosition(
- replacement,
- this.currentCaretPosition,
- this.currentRange
- );
- }
- }
- if (this.dialogIsOpen) {
- this.closeDialog();
- }
- };
+#### stickyDateTimeFormat
- getFormattedText(text: string): string {
- return text;
- }
+```ts lines
+import {
+ CometChatMessageList,
+ CalendarObject,
+} from "@cometchat/chat-uikit-react";
- private getTextBeforeCaret(caretPosition: number): string {
- if (
- this.currentRange &&
- this.currentRange.startContainer &&
- typeof this.currentRange.startContainer.textContent === "string"
- ) {
- const textContent = this.currentRange.startContainer.textContent;
- if (textContent.length >= caretPosition) {
- return textContent.substring(0, caretPosition);
- }
- }
- return "";
- }
+function getDateFormat() {
+ const dateFormat = new CalendarObject({
+ today: `hh:mm A`,
+ yesterday: `[yesterday]`,
+ otherDays: `DD/MM/YYYY`,
+ });
+ return dateFormat;
}
-export default ShortcutFormatter;
+;
```
-
+#### messageSentAtDateTimeFormat
-
-```tsx
-import React from "react";
-import ReactDOM from "react-dom";
+```ts lines
+import {
+ CometChatMessageList,
+ CalendarObject,
+} from "@cometchat/chat-uikit-react";
-interface DialogProps {
- onClick: () => void;
- buttonText: string;
+function getDateFormat() {
+ const dateFormat = new CalendarObject({
+ today: `hh:mm A`,
+ yesterday: `[yesterday]`,
+ otherDays: `DD/MM/YYYY`,
+ });
+ return dateFormat;
}
-const Dialog: React.FC = ({ onClick, buttonText }) => {
- console.log("buttonText", buttonText);
-
- return (
-
-
-
- );
-};
-
-export default class DialogHelper {
- private dialogContainer: HTMLDivElement | null = null;
+;
+```
- createDialog(onClick: () => void, buttonText: string) {
- this.dialogContainer = document.createElement("div");
- document.body.appendChild(this.dialogContainer);
+#### messageInfoDateTimeFormat
- ReactDOM.render(
- ,
- this.dialogContainer
- );
- }
+```ts lines
+import {
+ CometChatMessageList,
+ CalendarObject,
+} from "@cometchat/chat-uikit-react";
- closeDialog() {
- if (this.dialogContainer) {
- ReactDOM.unmountComponentAtNode(this.dialogContainer);
- this.dialogContainer.remove();
- this.dialogContainer = null;
- }
- }
+function getDateFormat() {
+ const dateFormat = new CalendarObject({
+ today: `hh:mm A`,
+ yesterday: `[yesterday]`,
+ otherDays: `DD/MM/YYYY`,
+ });
+ return dateFormat;
}
+
+;
```
-
+### textFormatters
-
-```tsx
+Custom text formatters for message content. To configure mentions, see [CometChatMentionsFormatter](/ui-kit/react/mentions-formatter-guide).
+
+```tsx lines
import React from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatMessageList } from "@cometchat/chat-uikit-react";
@@ -1578,8 +815,22 @@ export function MessageListDemo() {
}
```
-
+## Theme and Styling
-
+Using CSS, customize the look and feel of the component. The root CSS class is `.cometchat-message-list`.
+
+
+
+
+
+```tsx lines
+
+```
-***
+```css lines
+.cometchat-message-bubble__body
+ .cometchat-text-bubble.cometchat-text-bubble-incoming
+ .cometchat-text-bubble__body-text {
+ font-family: "SF Pro";
+}
+```
diff --git a/ui-kit/react/message-template.mdx b/ui-kit/react/message-template.mdx
index 7659b7286..91e2cdc8c 100644
--- a/ui-kit/react/message-template.mdx
+++ b/ui-kit/react/message-template.mdx
@@ -1,102 +1,63 @@
---
title: "Message Template"
+description: "CometChatMessageTemplate provides a structure for defining custom message types and their rendering in the message list. Use templates to customize how different message categories and types are displayed."
---
-## Overview
-
-MessageTemplate provides you with the capability to define and customize both the structure and the behavior of the Message Bubble. It acts as a schema or design blueprint for the creation of a variety of Message Bubble components, allowing you to manage the appearance and interactions of Message Bubble within your application effectively and consistently.
-
-### Structure
-
-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.
+| Field | Value |
+| --- | --- |
+| Purpose | Data structure defining how message bubbles render in the message list — controls header, content, footer, bottom, status info, reply, and bubble views per message type/category |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatMessageTemplate } from "@cometchat/chat-uikit-react";` |
+| Used in experiences | Passed to `CometChatMessageList` via the `templates` prop |
+| Copy-paste base | See [Base Code](#base-code--stylesheet) below |
+| Primary output | Custom message bubble rendering |
+| Primary hook points | `headerView`, `contentView`, `footerView`, `bottomView`, `bubbleView`, `statusInfoView`, `replyView`, `options` |
+| CSS root class | N/A (renders inside `.cometchat-message-bubble`) |
+| Real-time events | None (rendering blueprint only) |
-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.
+## Base Code and Stylesheet
-4. **Content view**: This is the core of the Message Bubble where the message content (text, images, videos, etc.) is displayed.
+MessageTemplate is a data structure, not a standalone rendered component. It defines how message bubbles appear inside `CometChatMessageList`.
-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.
+### Structure
-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.
+The message bubble structure breaks down into these views:
-***
+1. **Leading view** — Sender's avatar
+2. **Header view** — Sender's name (useful in group chats)
+3. **Reply view** — Preview of the replied message
+4. **Content view** — Core message content (text, images, videos, etc.)
+5. **Bottom view** — Link previews or "load more" button for long messages
+6. **Thread view** — Thread reply icon and reply counts
+7. **Footer view** — Reactions display
+8. **Status Info view** — Timestamp and delivery/read status
### 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**
-
- 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.
-
-8. **statusInfoView**
-
- The `statusInfoView` method allows you to assign a custom status info view to the Message Bubble. By default, it displays the receipt and timestamp.
-
-9. **replyView**
-
- The `replyView` method allows you to assign a custom reply view to the Message Bubble. By default, it displays the preview of the replied message.
-
-10. **options**
-
- The `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.
-
-***
-
-## 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/react/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.
-
-```javascript
-let definedTemplates = CometChatUIKit.getDataSource().getAllMessageTemplates();
-```
-
-### Existing Templates
-
-You will need to first get the MessageTemplate object for the type of message you want to customize. You will be customizing the text message bubble here. The code snippet to get the Text MessageTemplate is as follows.
-
-
-
-```ts
+| Property | Type | Description |
+| --- | --- | --- |
+| `type` | `string` | Maps the template to a CometChat message type |
+| `category` | `string` | Maps the template to a CometChat message category |
+| `headerView` | `(message: CometChat.BaseMessage) => JSX.Element` | Custom header (default: sender name) |
+| `contentView` | `(message: CometChat.BaseMessage) => JSX.Element` | Custom content (default: text/image/video/audio/file bubble) |
+| `footerView` | `(message: CometChat.BaseMessage) => JSX.Element` | Custom footer (default: reactions) |
+| `bottomView` | `(message: CometChat.BaseMessage) => JSX.Element` | Custom bottom section (default: link previews) |
+| `bubbleView` | `(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment) => JSX.Element` | Replaces the entire bubble |
+| `statusInfoView` | `(message: CometChat.BaseMessage) => JSX.Element` | Custom status info (default: receipt + timestamp) |
+| `replyView` | `(message: CometChat.BaseMessage) => JSX.Element` | Custom reply preview |
+| `options` | `(loggedInUser: CometChat.User, message: CometChat.BaseMessage, group?: CometChat.Group) => CometChatActionsIcon[]` | Custom action sheet options |
+
+### Fetching Existing Templates
+
+```ts lines
import {
CometChatUIKit,
CometChatUIKitConstants,
@@ -111,62 +72,57 @@ for (let i = 0; i < allTemplates.length; i++) {
}
```
-
+### Passing Templates to MessageList
-
-```js
-import {
- CometChatUIKit,
- CometChatUIKitConstants,
-} from "@cometchat/chat-uikit-react";
+```ts lines
+import { CometChatMessageList } from "@cometchat/chat-uikit-react";
-let allTemplates = CometChatUIKit.getDataSource().getAllMessageTemplates();
-for (let i = 0; i < allTemplates.length; i++) {
- if (allTemplates[i].type === CometChatUIKitConstants.MessageTypes.text) {
- //customize allTemplates[i]
- }
-}
+;
```
-
+## Functionality
-
+MessageTemplate is a configuration object, not a rendered component. It does not accept props directly — instead, its properties are set when constructing or modifying template instances. See the [Properties](#properties) table above for the full API.
-You will be using [Message List](/ui-kit/react/message-list) component using the `templates` prop of `CometChatMessageList` component.
+## Actions
-
-
-```ts
-import { CometChatMessageList } from "@cometchat/uikit-react";
+MessageTemplate does not expose callback props. Message interactions (thread replies, reactions, edits, deletes) are handled by the [Message List](/ui-kit/react/message-list) component. The `options` property controls the action sheet items for long-press on a message bubble.
-;
-```
+## Filters
-
+MessageTemplate does not have filters. To control which messages appear, use `messagesRequestBuilder` on the [Message List](/ui-kit/react/message-list) component.
-
-```js
-import { CometChatMessageList } from "@cometchat/uikit-react";
+## Events
-;
-```
+MessageTemplate does not emit events. It is a rendering blueprint. For message-related events, see the [Message List](/ui-kit/react/message-list) component.
-
+## Advanced: Custom View Slots
-
+Each view slot on a MessageTemplate can be overridden to customize how message bubbles render.
+
+### Slot Catalog
-#### HeaderView
+| Slot | Params | What it replaces | Section |
+| --- | --- | --- | --- |
+| `headerView` | `(message: CometChat.BaseMessage) => JSX.Element` | Sender name area | Header |
+| `contentView` | `(message: CometChat.BaseMessage) => JSX.Element` | Message content (text/image/video/audio/file bubble) | Content |
+| `footerView` | `(message: CometChat.BaseMessage) => JSX.Element` | Reactions area | Footer |
+| `bottomView` | `(message: CometChat.BaseMessage) => JSX.Element` | Link previews / load more | Bottom |
+| `bubbleView` | `(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment) => JSX.Element` | Entire message bubble | Whole item |
+| `statusInfoView` | `(message: CometChat.BaseMessage) => JSX.Element` | Timestamp + receipt | Status info |
+| `replyView` | `(message: CometChat.BaseMessage) => JSX.Element` | Reply preview | Reply |
+| `options` | `(loggedInUser, message, group?) => CometChatActionsIcon[]` | Long-press action sheet | Options |
-The `headerView` method of MessageTemplate allows you to add custom views to the header of your message bubbles. In the example below, we will add a custom header view of every text message in the MessageList.
+### headerView
+
+Custom header for message bubbles. Default displays sender name.
-
-
-```ts
-import React, { useEffect, useState } from "react";
+```ts lines
+import React, { useEffect } from "react";
import {
CometChatMessageList,
CometChatUIKit,
@@ -175,9 +131,7 @@ import {
import { CometChat } from "@cometchat/chat-sdk-javascript";
const CustomMessageTemplate = () => {
- const [templates, setTemplates] = React.useState(
- []
- );
+ const [templates, setTemplates] = React.useState([]);
const [chatGroup, setChatGroup] = React.useState();
useEffect(() => {
@@ -217,66 +171,9 @@ const CustomMessageTemplate = () => {
export { CustomMessageTemplate };
```
-
-
-
-```js
-import React, { useEffect, useState } from "react";
-import {
- CometChatMessageList,
- CometChatUIKit,
- CometChatUIKitConstants,
-} from "@cometchat/chat-uikit-react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-
-const CustomMessageTemplate = () => {
- const [templates, setTemplates] = useState([]);
- const [chatGroup, setChatGroup] = useState(null);
-
- useEffect(() => {
- CometChat.getGroup("guid").then((group) => {
- setChatGroup(group);
- });
-
- let definedTemplates =
- CometChatUIKit.getDataSource().getAllMessageTemplates();
- const template = definedTemplates.map((templates) => {
- if (
- templates.type === CometChatUIKitConstants.MessageTypes.text &&
- templates.category === CometChatUIKitConstants.MessageCategory.message
- ) {
- templates.headerView = (message: CometChat.BaseMessage) =>
- getHeaderView(message);
- return templates;
- }
- return templates;
- });
- setTemplates(template);
- }, []);
-
- const getHeaderView = (message: CometChat.BaseMessage) => {
- return <> {message.getSender().getName()} • 🗓️ In meeting>;
- };
-
- return (
-
- {chatGroup && (
-
- )}
-
- );
-};
-
-export { CustomMessageTemplate };
-```
-
-
+### contentView
-
-
-#### Contentview
-
-The `contentview` method of MessageTemplate allows you to add a custom view to the content of your message bubbles. In the example below, we will add a custom layout to the content view of every text message in the MessageList.
+Custom content for message bubbles. Default displays text/image/video/audio/file bubble depending on message type.
@@ -284,7 +181,7 @@ The `contentview` method of MessageTemplate allows you to add a custom view to t
-```ts
+```ts lines
import React from "react";
import {
CometChatMessageList,
@@ -296,9 +193,7 @@ import { CometChat } from "@cometchat/chat-sdk-javascript";
import bannerImage from "../../assets/banner.svg";
const CustomMessageTemplate = () => {
- const [templates, setTemplates] = React.useState(
- []
- );
+ const [templates, setTemplates] = React.useState([]);
const [chatGroup, setChatGroup] = React.useState();
React.useEffect(() => {
@@ -322,107 +217,7 @@ const CustomMessageTemplate = () => {
return (
- );
-};
-
-export { CustomMessageTemplate };
-```
-
-
-
-```css
+
+```css lines
.content-view {
display: flex;
flex-direction: column;
@@ -1869,7 +1122,6 @@ export { CustomMessageTemplate };
color: #f9f8fd;
text-overflow: ellipsis;
font: 500 14px/16.8px roboto;
- font-style: normal;
}
.cometchat-message-bubble-incoming .cometchat-list-item__body-title,
@@ -1894,7 +1146,6 @@ export { CustomMessageTemplate };
color: #f9f8fd;
text-align: right;
font: 400 10px/12px roboto;
- font-style: normal;
}
.content-view__footer {
@@ -1915,7 +1166,6 @@ export { CustomMessageTemplate };
justify-content: center;
color: #f9f8fd;
font: 500 14px/16.8px roboto;
- font-style: normal;
}
.content-view__footer-message {
@@ -1926,10 +1176,25 @@ export { CustomMessageTemplate };
justify-content: center;
color: #f9f8fd;
font: 500 14px/16.8px roboto;
- font-style: normal;
}
```
-
-
+
+## Theme and Styling
+
+MessageTemplate renders inside `.cometchat-message-bubble`. Style individual bubble sections using CSS.
+
+```css lines
+.cometchat .cometchat-message-bubble__body {
+ /* content area overrides */
+}
+
+.cometchat .cometchat-message-bubble__body-footer-view {
+ /* footer area overrides */
+}
+
+.cometchat .cometchat-message-bubble__body-header-view {
+ /* header area overrides */
+}
+```
\ No newline at end of file
diff --git a/ui-kit/react/methods.mdx b/ui-kit/react/methods.mdx
index 0be19fef4..fbc1f8f9a 100644
--- a/ui-kit/react/methods.mdx
+++ b/ui-kit/react/methods.mdx
@@ -1,33 +1,51 @@
---
title: "Methods"
+description: "Reference for CometChat React UI Kit methods including init, login, logout, and message-sending wrappers."
---
+
+
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatUIKit } from "@cometchat/chat-uikit-react";` |
+| Init | `CometChatUIKit.init(UIKitSettings)` |
+| Login (dev) | `CometChatUIKit.login("UID")` |
+| Login (prod) | `CometChatUIKit.loginWithAuthToken("AUTH_TOKEN")` |
+| Other methods | `CometChatUIKit.logout()`, `CometChatUIKit.getLoggedinUser()`, `CometChatUIKit.createUser(user)`, `CometChatUIKit.updateUser(user)` |
+| Send messages | `CometChatUIKit.sendTextMessage()`, `CometChatUIKit.sendMediaMessage()`, `CometChatUIKit.sendCustomMessage()` |
+| Note | Use these wrapper methods instead of raw SDK calls — they manage internal UI Kit eventing |
+
+
+
## Overview
-The UI Kit's core function is to extend the [Chat SDK](/sdk/javascript/overview), essentially translating the raw data and functionality provided by the underlying methods into visually appealing and easy-to-use UI components.
+The UI Kit wraps the [Chat SDK](/sdk/javascript/overview) methods to manage internal eventing and keep UI components synchronized. Use these wrapper methods instead of raw SDK calls.
-To effectively manage and synchronize the UI elements and data across all components in the UI Kit, we utilize internal events. These internal events enable us to keep track of changes in real time and ensure that the UI reflects the most current state of data.
+
+`CometChatUIKit.init(UIKitSettings)` must be called before rendering any UI Kit components or calling any SDK methods. Initialization must complete before login.
+
-The CometChat UI Kit has thoughtfully encapsulated the critical [Chat SDK](/sdk/javascript/overview) methods within its wrapper to efficiently manage internal eventing. This layer of abstraction simplifies interaction with the underlying CometChat SDK, making it more user-friendly for developers.
+
+Auth Key is for development/testing only. In production, generate Auth Tokens on the server using the REST API and pass them to the client via `loginWithAuthToken()`. Never expose Auth Keys in production client code.
+
## Methods
-You can access the methods using the `CometChatUIKit` class. This class provides access to all the public methods exposed by the CometChat UI Kit.
+All methods are accessed via the `CometChatUIKit` class.
### Init
-This method initializes the settings required for [CometChat JavaScript SDK](/sdk/javascript/overview). First, ensure UIKitSettings is set and then call the `init()` method on the app startup.
+Initializes the [CometChat JavaScript SDK](/sdk/javascript/overview). Must be called on app startup before any other UI Kit method.
-
-Make sure you replace the **APP\_ID**, **REGION** and **AUTH\_KEY** with your CometChat App ID, Region and Auth Key in the below code. The `Auth Key` is an optional property of the `UIKitSettings` Class. It is intended for use primarily during proof-of-concept (POC) development or in the early stages of application development. You can use the [Auth Token](#login-using-auth-token) method to log in securely.
-
+Replace `APP_ID`, `REGION`, and `AUTH_KEY` with values from the CometChat Dashboard. `Auth Key` is optional — use [Auth Token](#login-using-auth-token) for production.
-```js
-import { UIKitSettingsBuilder } from "@cometchat/uikit-shared"; //import shared package
+```js lines highlight={4-6}
+import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
const COMETCHAT_CONSTANTS = {
APP_ID: "APP_ID", // Replace with your App ID
@@ -57,11 +75,11 @@ CometChatUIKit.init(UIKitSettings)?.then(() => {
### Setting Session Storage Mode
-If you want to use session storage instead of the default local storage, you can configure it during initialization:
+To use session storage instead of the default local storage, configure it during initialization:
-```js
+```js lines highlight={5-7}
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
@@ -89,7 +107,7 @@ CometChatUIKit.init(UIKitSettings)?.then(() => {
-```ts
+```ts lines highlight={5-7}
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
@@ -119,11 +137,11 @@ CometChatUIKit.init(UIKitSettings)?.then(() => {
### Get Logged In User
-You can use this method to check if there is any existing session in the SDK. This method should return the details of the logged-in user.
+Checks for an existing session in the SDK. Returns the logged-in user details or `null`.
-```js
+```js lines
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
CometChatUIKit.getLoggedinUser()
@@ -141,11 +159,11 @@ CometChatUIKit.getLoggedinUser()
### Login using Auth Key
-This simple authentication procedure is useful when you are creating a POC or if you are in the development phase. For production apps, we suggest you use [AuthToken](#login-using-auth-token) instead of Auth Key.
+Simple authentication for development/POC. For production, use [Auth Token](#login-using-auth-token).
-```js
+```js lines highlight={3}
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
const UID = "UID";
@@ -170,7 +188,7 @@ CometChatUIKit.getLoggedinUser()
-```ts
+```ts lines highlight={3}
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
const UID: string = "UID";
@@ -200,7 +218,7 @@ CometChatUIKit.getLoggedinUser()
### Login using Auth Token
-This advanced authentication procedure does not use the Auth Key directly in your client code thus ensuring safety.
+Production-safe authentication that does not expose the Auth Key in client code.
1. [Create a User](https://api-explorer.cometchat.com/reference/creates-user) via the CometChat API when the user signs up in your app.
2. [Create an Auth Token](https://api-explorer.cometchat.com/reference/create-authtoken) via the CometChat API for the new user and save the token in your database.
@@ -208,7 +226,7 @@ This advanced authentication procedure does not use the Auth Key directly in you
-```js
+```js lines highlight={3}
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
const authToken = "AUTH_TOKEN";
@@ -234,12 +252,12 @@ CometChatUIKit.getLoggedinUser()
-```ts
+```ts lines highlight={3}
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
const authToken: string = "AUTH_TOKEN";
-CometChat.getLoggedinUser()
+CometChatUIKit.getLoggedinUser()
.then((user: CometChat.User) => {
if (!user) {
//Login user
@@ -262,11 +280,11 @@ CometChat.getLoggedinUser()
### Logout
-This method is used to end the user session of the logged-in user
+Ends the current user session.
-```js
+```js lines
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
CometChatUIKit.logout();
@@ -280,11 +298,11 @@ CometChatUIKit.logout();
### Create user
-This method takes a `User` object and the `Auth Key` as input parameters and returns the created `User` object if the request is successful.
+Takes a `User` object and Auth Key, returns the created `User` object.
-```js
+```js lines highlight={4-6}
import { CometChat } from "@cometchat/chat-sdk-javascript"; //import sdk package
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
@@ -311,7 +329,7 @@ CometChatUIKit.createUser(user, authKey)
-```ts
+```ts lines highlight={4-6}
import { CometChat } from "@cometchat/chat-sdk-javascript"; //import sdk package
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
@@ -343,11 +361,11 @@ CometChatUIKit.createUser(user, authKey)
### Update user
-This method takes a `User` object and the `Auth Key` as inputs and returns the updated `User` object on the successful execution of the request.
+Takes a `User` object and Auth Key, returns the updated `User` object.
-```js
+```js lines highlight={4-6}
import { CometChat } from "@cometchat/chat-sdk-javascript"; //import sdk package
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
@@ -367,7 +385,7 @@ CometChatUIKit.updateUser(user, authKey)
-```ts
+```ts lines highlight={4-6}
import { CometChat } from "@cometchat/chat-sdk-javascript"; //import sdk package
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
@@ -394,11 +412,11 @@ CometChatUIKit.updateUser(user, authKey)
#### Text message
-This method sends a text message in a 1:1 or group chat. You need to pass a `TextMessage` object to it.
+Sends a text message in a 1:1 or group chat. Takes a `TextMessage` object.
-```tsx
+```tsx lines highlight={5-6}
import { CometChat } from "@cometchat/chat-sdk-javascript"; //import sdk package
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
import { CometChatUIKitConstants } from "@cometchat/uikit-resources"; //import shared package
@@ -422,7 +440,7 @@ CometChatUIKit.sendTextMessage(textMessage)
-```tsx
+```tsx lines highlight={5-6}
import { CometChat } from "@cometchat/chat-sdk-javascript"; //import sdk package
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
import { CometChatUIKitConstants } from "@cometchat/uikit-resources"; //import shared package
@@ -451,17 +469,15 @@ CometChatUIKit.sendMessage(textMessage)
#### Media message
-This method sends a media message in a 1:1 or group chat. You need to pass a `MediaMessage` object to it.
+Sends a media message in a 1:1 or group chat. Takes a `MediaMessage` object.
-
-Make sure you replace the `INPUT FILE OBJECT` with the actual [file](https://developer.mozilla.org/en-US/docs/Web/API/File).
-
+Replace `INPUT FILE OBJECT` with the actual [File](https://developer.mozilla.org/en-US/docs/Web/API/File) object.
-```tsx
+```tsx lines highlight={5}
import { CometChat } from "@cometchat/chat-sdk-javascript"; //import sdk package
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
import { CometChatUIKitConstants } from "@cometchat/uikit-resources"; //import shared package
@@ -486,7 +502,7 @@ CometChatUIKit.sendMediaMessage(mediaMessage)
-```tsx
+```tsx lines highlight={5}
import { CometChat } from "@cometchat/chat-sdk-javascript"; //import sdk package
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
import { CometChatUIKitConstants } from "@cometchat/uikit-resources"; //import shared package
@@ -516,11 +532,11 @@ CometChatUIKit.sendMediaMessage(mediaMessage)
#### Custom message
-This method allows you to send custom messages which are neither text nor media messages.
+Sends a custom message (neither text nor media) in a 1:1 or group chat. Takes a `CustomMessage` object.
-```tsx
+```tsx lines highlight={5,7,8}
import { CometChat } from "@cometchat/chat-sdk-javascript"; //import sdk package
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
import { CometChatUIKitConstants } from "@cometchat/uikit-resources"; //import shared package
@@ -549,7 +565,7 @@ CometChatUIKit.sendCustomMessage(customMessage)
-```tsx
+```tsx lines highlight={5,7,8}
import { CometChat } from "@cometchat/chat-sdk-javascript"; //import sdk package
import { CometChatUIKit } from "@cometchat/chat-uikit-react"; //import uikit package
import { CometChatUIKitConstants } from "@cometchat/uikit-resources"; //import shared package
diff --git a/ui-kit/react/next-conversation.mdx b/ui-kit/react/next-conversation.mdx
index 1d8800f66..c1e3d00c6 100644
--- a/ui-kit/react/next-conversation.mdx
+++ b/ui-kit/react/next-conversation.mdx
@@ -1,227 +1,212 @@
---
-title: "Building A Conversation List + Message View"
+title: "Conversation List + Message View"
sidebarTitle: "Conversation List + Message View"
+description: "Build a two-panel conversation list + message view layout in Next.js with CometChat UI Kit."
---
-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**.
+
-This design enables users to switch between conversations effortlessly while keeping the chat window open, ensuring a **smooth, real-time messaging experience**.
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Framework | Next.js |
+| Components | `CometChatConversations`, `CometChatMessageHeader`, `CometChatMessageList`, `CometChatMessageComposer` |
+| Layout | Two-panel — conversation list (left) + message view (right) |
+| Prerequisite | Complete [Next.js Integration](/ui-kit/react/next-js-integration) Steps 1–5 first |
+| SSR | Dynamic import with `ssr: false` — CometChat requires browser APIs |
+| Pattern | WhatsApp Web, Slack, Microsoft Teams |
-[](https://link.cometchat.com/next-conversation-list-message)
-
-> **Tip:** You can **fork** the sandbox, insert your **CometChat credentials** (App ID, Region, Auth Key.) in the code, and immediately preview how the UI and messages respond in real time.
+
-***
+This guide builds a two-panel chat layout — conversation list on the left, messages on the right. Users tap a conversation to open it.
-## **User Interface Overview**
+This assumes you've already completed [Next.js Integration](/ui-kit/react/next-js-integration) (project created, UI Kit installed, CSS imported).
-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.
-
-***
+[](https://link.cometchat.com/next-conversation-list-message)
-## **Step-by-Step Guide**
+> Fork the sandbox, insert your CometChat credentials (App ID, Region, Auth Key), and preview the UI in real time.
-### **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)
+
+
+
+
+
+
+
+
+
+
-```tsx CometChatSelector.tsx
+```tsx title="CometChatSelector.tsx" lines
import { useEffect, useState } from "react";
-import { Conversation, Group, User } from "@cometchat/chat-sdk-javascript";
+import { Conversation, Group, User, CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatConversations, CometChatUIKitLoginListener } from "@cometchat/chat-uikit-react";
-import { CometChat } from '@cometchat/chat-sdk-javascript';
import "./CometChatSelector.css";
-// Define props interface for component
interface SelectorProps {
- onSelectorItemClicked?: (input: User | Group | Conversation, type: string) => void;
+ onSelectorItemClicked?: (input: User | Group | Conversation, type: string) => void;
}
-// CometChatSelector component definition
export const CometChatSelector = (props: SelectorProps) => {
- const {
- onSelectorItemClicked = () => { }, // Default function if no prop is provided
- } = props;
-
- // State to store the currently logged-in user
- const [loggedInUser, setLoggedInUser] = useState();
-
- // State to track the currently selected item (conversation, user, group, or call)
- const [activeItem, setActiveItem] = useState<
- CometChat.Conversation | CometChat.User | CometChat.Group | CometChat.Call | undefined
- >();
-
- useEffect(() => {
- // Retrieve the logged-in user from CometChat's login listener
- let loggedInUser = CometChatUIKitLoginListener.getLoggedInUser();
- setLoggedInUser(loggedInUser);
- }, [CometChatUIKitLoginListener?.getLoggedInUser()]); // Dependency array to trigger effect when user changes
-
- return (
- <>
- {/* Render CometChatConversations only if a user is logged in */}
- {loggedInUser && (
- <>
- {
- setActiveItem(e); // Update the selected item state
- onSelectorItemClicked(e, "updateSelectedItem"); // Trigger callback with selected item
- }}
- />
- >
- )}
- >
- );
-};
+ const { onSelectorItemClicked = () => {} } = props;
+ const [loggedInUser, setLoggedInUser] = useState();
+ const [activeItem, setActiveItem] = useState<
+ CometChat.Conversation | CometChat.User | CometChat.Group | undefined
+ >();
+
+ useEffect(() => {
+ const user = CometChatUIKitLoginListener.getLoggedInUser();
+ setLoggedInUser(user);
+ }, []);
+
+ return (
+ <>
+ {loggedInUser && (
+ {
+ setActiveItem(e);
+ onSelectorItemClicked(e, "updateSelectedItem");
+ }}
+ />
+ )}
+ >
+ );
+};
```
-
-```css CometChatSelector.css
-/* Style for the icon in the header menu of the conversation list */
+```css title="CometChatSelector.css" lines
.selector-wrapper .cometchat-conversations .cometchat-list__header-menu .cometchat-button__icon {
- background: var(--cometchat-icon-color-primary);
+ background: var(--cometchat-icon-color-primary);
}
-/* Change background color of icon on hover */
.cometchat-conversations .cometchat-list__header-menu .cometchat-button__icon:hover {
- background: var(--cometchat-icon-color-highlight);
+ background: var(--cometchat-icon-color-highlight);
}
-/* Remove the right border from the search bar */
.cometchat-list__header-search-bar {
- border-right: none;
+ border-right: none;
}
-/* Align submenu items to the left */
.cometchat .cometchat-menu-list__sub-menu-list-item {
- text-align: left;
+ text-align: left;
}
-/* Set specific width and positioning for submenu list */
.cometchat .cometchat-conversations .cometchat-menu-list__sub-menu-list {
- width: 212px;
- top: 40px !important;
- left: 172px !important;
+ width: 212px;
+ top: 40px !important;
+ left: 172px !important;
}
-/* Style the logged-in user section with a bottom border */
#logged-in-user {
- border-bottom: 2px solid var(--cometchat-border-color-default, #E8E8E8);
+ border-bottom: 2px solid var(--cometchat-border-color-default, #E8E8E8);
}
-/* Prevent cursor interaction on logged-in user menu items */
#logged-in-user .cometchat-menu-list__sub-menu-item-title,
#logged-in-user .cometchat-menu-list__sub-menu-list-item {
- cursor: default;
+ cursor: default;
}
-/* Style for logout icon with error color */
.cometchat-menu-list__sub-menu-list-item-icon-log-out {
- background-color: var(--cometchat-error-color, #F44649);
+ background-color: var(--cometchat-error-color, #F44649);
}
-/* Style for logout text with error color */
.cometchat-menu-list__sub-menu-item-title-log-out {
- color: var(--cometchat-error-color, #F44649);
+ color: var(--cometchat-error-color, #F44649);
}
-/* Allow pointer interaction on submenu items inside chat menu */
.chat-menu .cometchat .cometchat-menu-list__sub-menu-item-title {
- cursor: pointer;
+ cursor: pointer;
}
-/* Remove shadow from submenu inside chat menu */
.chat-menu .cometchat .cometchat-menu-list__sub-menu {
- box-shadow: none;
+ box-shadow: none;
}
-/* Style for submenu icons inside chat menu */
.chat-menu .cometchat .cometchat-menu-list__sub-menu-icon {
- background-color: var(--cometchat-icon-color-primary, #141414);
- width: 24px;
- height: 24px;
+ background-color: var(--cometchat-icon-color-primary, #141414);
+ width: 24px;
+ height: 24px;
}
```
-
-### **Step 2: Render Experience**
+---
-Now we will create the `CometChatNoSSR.tsx` & `CometChatNoSSR.css` files. Here, we will initialize the CometChat UI Kit, log in a user, and build the messaging experience using `CometChatMessageHeader`, `CometChatMessageList`, and `CometChatMessageComposer` components.
+## Step 2 — Create the CometChatNoSSR Component
-```
-src/
-│── CometChatNoSSR/
-│ ├── CometChatNoSSR.tsx
-│ ├── CometChatNoSSR.css
-```
+This component handles init, login, and renders the full chat experience. It runs client-side only.
+
+
+
+
+
+
+
+
+
+
+
-```tsx CometChatNoSSR.tsx
+```tsx title="CometChatNoSSR.tsx" lines highlight={15-17, 20}
import React, { useEffect, useState } from "react";
-import {
- CometChatMessageComposer,
- CometChatMessageHeader,
- CometChatMessageList,
- CometChatUIKit,
- UIKitSettingsBuilder
+import {
+ CometChatMessageComposer,
+ CometChatMessageHeader,
+ CometChatMessageList,
+ CometChatUIKit,
+ UIKitSettingsBuilder,
} from "@cometchat/chat-uikit-react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatSelector } from "../CometChatSelector/CometChatSelector";
import "./CometChatNoSSR.css";
-// Constants for CometChat configuration
+// Replace with your actual credentials
const COMETCHAT_CONSTANTS = {
- APP_ID: "",
- REGION: "",
- AUTH_KEY: "",
+ APP_ID: "", // Replace with your App ID
+ REGION: "", // Replace with your Region
+ AUTH_KEY: "", // Replace with your Auth Key (dev only)
};
-// Functional Component
+const UID = "cometchat-uid-1"; // Replace with your actual UID
+
const CometChatNoSSR: React.FC = () => {
- // State to store the logged-in user
const [user, setUser] = useState(undefined);
- // State to store selected user or group
const [selectedUser, setSelectedUser] = useState(undefined);
const [selectedGroup, setSelectedGroup] = useState(undefined);
useEffect(() => {
- // Initialize UIKit settings
const UIKitSettings = new UIKitSettingsBuilder()
.setAppId(COMETCHAT_CONSTANTS.APP_ID)
.setRegion(COMETCHAT_CONSTANTS.REGION)
@@ -229,15 +214,12 @@ const CometChatNoSSR: React.FC = () => {
.subscribePresenceForAllUsers()
.build();
- // Initialize CometChat UIKit
CometChatUIKit.init(UIKitSettings)
?.then(() => {
console.log("Initialization completed successfully");
- // Check if user is already logged in
CometChatUIKit.getLoggedinUser().then((loggedInUser) => {
if (!loggedInUser) {
- // Perform login if no user is logged in
- CometChatUIKit.login("cometchat-uid-1")
+ CometChatUIKit.login(UID)
.then((user) => {
console.log("Login Successful", { user });
setUser(user);
@@ -254,16 +236,13 @@ const CometChatNoSSR: React.FC = () => {
return user ? (
- {/* Sidebar with conversation list */}
- {
let item = activeItem;
- // Extract the conversation participant
if (activeItem instanceof CometChat.Conversation) {
item = activeItem.getConversationWith();
}
- // Update states based on the type of selected item
if (item instanceof CometChat.User) {
setSelectedUser(item as CometChat.User);
setSelectedGroup(undefined);
@@ -274,11 +253,10 @@ const CometChatNoSSR: React.FC = () => {
setSelectedUser(undefined);
setSelectedGroup(undefined);
}
- }}
+ }}
/>
) : undefined;
@@ -296,169 +274,115 @@ export default CometChatNoSSR;
```
-
-```css CometChatNoSSR.css
-/* Layout for the main conversations and messages container */
+```css title="CometChatNoSSR.css" lines
.conversations-with-messages {
- display: flex;
- height: 100%;
- width: 100%;
+ display: flex;
+ height: 100%;
+ width: 100%;
}
-/* Sidebar wrapper for conversations */
.conversations-wrapper {
- height: 100%;
- width: 480px; /* Fixed width for conversation list */
- overflow: hidden;
- display: flex;
- flex-direction: column;
- height: inherit;
+ height: 100%;
+ width: 480px;
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+ height: inherit;
}
-/* Hide overflow for the conversation list */
.conversations-wrapper > .cometchat {
- overflow: hidden;
+ overflow: hidden;
}
-/* Message section layout */
.messages-wrapper {
- width: calc(100% - 480px); /* Take remaining space */
- height: 100%;
- display: flex;
- flex-direction: column;
+ width: calc(100% - 480px);
+ height: 100%;
+ display: flex;
+ flex-direction: column;
}
-/* Display styling for when no conversation is selected */
.empty-conversation {
- height: 100%;
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- background: white;
- color: var(--cometchat-text-color-secondary, #727272);
- font: var(--cometchat-font-body-regular, 400 14px Roboto);
+ height: 100%;
+ width: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ background: white;
+ color: var(--cometchat-text-color-secondary, #727272);
+ font: var(--cometchat-font-body-regular, 400 14px Roboto);
}
-/* Ensure message composer does not have rounded corners */
.cometchat .cometchat-message-composer {
- border-radius: 0px;
+ border-radius: 0px;
}
```
-
-### **Step 3: Disabling SSR for `CometChatNoSSR.tsx` in Next.js**
-
-In this update, we will **disable Server-Side Rendering (SSR) for `CometChatNoSSR.tsx`** while keeping the rest of the application’s SSR functionality intact. This ensures that the **CometChat UI Kit components load only on the client-side**, preventing SSR-related issues.
+---
-#### **Disabling SSR in `index.tsx`**
+## Step 3 — Disable SSR in Your Page
-Modify your `index.tsx` file to dynamically import the `CometChatNoSSR.tsx` component with `{ ssr: false }`.
+Dynamically import `CometChatNoSSR` with `ssr: false` so it only loads client-side.
-```tsx index.tsx
-import { Inter } from "next/font/google";
+```tsx title="index.tsx" lines
import dynamic from "next/dynamic";
+import "@cometchat/chat-uikit-react/css-variables.css";
-import '@cometchat/chat-uikit-react/css-variables.css';
-
-const inter = Inter({ subsets: ["latin"] });
-
-// Dynamically import CometChat component with SSR disabled
-const CometChatComponent = dynamic(() => import("../CometChatNoSSR/CometChatNoSSR"), {
- ssr: false,
-});
+const CometChatComponent = dynamic(
+ () => import("../CometChatNoSSR/CometChatNoSSR"),
+ { ssr: false }
+);
export default function Home() {
return ;
}
```
-#### **Why disable SSR?**
-
-* The CometChat UI Kit depends on browser APIs (window, document, WebSockets).
-* Next.js pre-renders components on the server, which can cause errors with browser-specific features.
-* By setting `{ ssr: false }`, we ensure that CometChatNoSSR.tsx only loads on the client.
+CometChat depends on browser APIs (`window`, `WebSocket`, `document`). Setting `ssr: false` ensures the component only renders on the client, avoiding hydration errors.
-### **Step 4: Update Global CSS**
-
-Next, add the following styles to global.css to ensure CometChat UI Kit is properly styled.
-
-```css global.css
-:root {
- --background: #ffffff;
- --foreground: #171717;
-}
-
-@media (prefers-color-scheme: dark) {
- :root {
- --background: #0a0a0a;
- --foreground: #ededed;
- }
-}
-
-/** Give your App a height of `100%`. Keep other CSS properties in the below selector as it is. */
-.root {
- height: 100%;
-}
-
-#__next {
- height: 100%;
-}
-
-html,
-body {
- height: 100%;
-}
-
-html,
-body {
- max-width: 100vw;
- overflow-x: hidden;
-}
-
-body {
- color: var(--foreground);
- background: var(--background);
- font-family: Arial, Helvetica, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
+---
-* {
- box-sizing: border-box;
- padding: 0;
- margin: 0;
-}
+## Step 4 — Run the Project
-a {
- color: inherit;
- text-decoration: none;
-}
-
-@media (prefers-color-scheme: dark) {
- html {
- color-scheme: dark;
- }
-}
+
+
+```bash lines
+npm run dev
```
-
-### **Step 5: Run the project**
-
+
+
+```bash lines
+pnpm dev
```
-npm run dev
+
+
+```bash lines
+yarn dev
```
+
+
-***
-
-## **Next Steps**
-
-### **Enhance the User Experience**
+You should see the conversation list on the left. Tap any conversation to load messages on the right.
-* **[Advanced Customizations](/ui-kit/react/theme)** – Personalize the chat UI to align with your brand.
+---
-***
+## Next Steps
+
+
+
+ Customize colors, fonts, and styles to match your brand
+
+
+ Browse all prebuilt UI components
+
+ } href="/ui-kit/react/next-js-integration">
+ Back to the main setup guide
+
+
+ Chat features included out of the box
+
+
diff --git a/ui-kit/react/next-js-integration.mdx b/ui-kit/react/next-js-integration.mdx
index 0d4c40aac..740b4d7c3 100644
--- a/ui-kit/react/next-js-integration.mdx
+++ b/ui-kit/react/next-js-integration.mdx
@@ -1,138 +1,96 @@
---
-title: "Getting Started With CometChat React UI Kit For Next.js"
+title: "Next.js Integration"
sidebarTitle: "Integration"
+description: "Add CometChat to a Next.js app in 5 steps: create project, install, init, login, render."
---
-The **CometChat UI Kit for React** streamlines the integration of in-app chat functionality by providing a **comprehensive set of prebuilt UI components**. It offers seamless **theming options**, including **light and dark modes**, customizable fonts, colors, and extensive styling capabilities.
+
-With built-in support for **one-to-one and group conversations**, developers can efficiently enable chat features within their applications. Follow this guide to **quickly integrate chat functionality** using the CometChat React UI Kit.
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Peer deps | `react` >=18, `react-dom` >=18, `rxjs` ^7.8.1 |
+| Init | `CometChatUIKit.init(UIKitSettings)` — must resolve before `login()` |
+| Login | `CometChatUIKit.login("UID")` — must resolve before rendering components |
+| Order | `init()` → `login()` → render. Breaking this order = blank screen |
+| Auth Key | Dev/testing only. Use Auth Token in production |
+| SSR | CometChat requires browser APIs — use dynamic import with `ssr: false` |
+| CSS | `@import url("@cometchat/chat-uikit-react/css-variables.css");` in global CSS |
+| Calling | Optional. Install `@cometchat/calls-sdk-javascript` to enable |
+| Other frameworks | [React.js](/ui-kit/react/react-js-integration) · [React Router](/ui-kit/react/react-router-integration) · [Astro](/ui-kit/react/astro-integration) |
-{/*
-
- */}
+
+
+This guide walks you through adding CometChat to a Next.js app. By the end you'll have a working chat UI.
-***
-
-## **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**.
-
-🔗 **[Click here to Sign Up](https://app.cometchat.com/login)**
-
-### **Step 2: Get Your Application Keys**
-
-After registering, create a **new app** and retrieve your **authentication details**:
+
+CometChat UI Kit requires browser APIs (`window`, `WebSocket`, `document`). In Next.js, always load CometChat components client-side using dynamic imports with `ssr: false`.
+
-1. Navigate to **Application**, then select the **Credentials** section.
-
-2. Note down the following keys:
-
- * **App ID**
- * **Auth Key**
- * **Region**
-
-
-
-Each CometChat application can be integrated with a **single client app**. Users within the same application can communicate across multiple platforms, including **web and mobile**.
-
-
-
-### **Step 3: Set Up Your Development Environment**
-
-Ensure your system meets the following **prerequisites** before proceeding with integration.
+---
-**System Requirements:**
+## Prerequisites
-* **Node.js** installed on your machine.
-* A code editor like **[Visual Studio Code](https://code.visualstudio.com/)** or **[Cursor](https://www.cursor.com/)**.
-* **npm** or **Yarn** package manager installed.
+You need three things from the [CometChat Dashboard](https://app.cometchat.com/):
-***
+| Credential | Where to find it |
+| --- | --- |
+| App ID | Dashboard → Your App → Credentials |
+| Auth Key | Dashboard → Your App → Credentials |
+| Region | Dashboard → Your App → Credentials (e.g. `us`, `eu`, `in`) |
-## **Built With**
+You also need Node.js (v16+) and npm/yarn installed.
-The CometChat UI Kit for React relies on the following technologies:
+
+Auth Key is for development only. In production, generate Auth Tokens server-side via the [REST API](https://api-explorer.cometchat.com/) and use [`loginWithAuthToken()`](/ui-kit/react/methods#login-using-auth-token). Never ship Auth Keys in client code.
+
-| Technology | Description |
-| ---------------------------------------------------- | ------------------------------------- |
-| [Node.js](https://nodejs.org/) | JavaScript runtime environment |
-| [npm](https://www.npmjs.com/get-npm) | Node Package Manager |
-| [React](https://www.npmjs.com/package/react) | JavaScript library for UI development |
-| [React DOM](https://www.npmjs.com/package/react-dom) | React package for rendering UI |
+---
-***
+## Step 1 — Create a Next.js Project
-## **Getting Started**
+```bash lines
+npx create-next-app@latest my-app --typescript
+cd my-app
+```
-### **Step 1: Create a Next.js Project**
+---
-1. **Open your code editor** (e.g., **VS Code**, **Cursor**).
-2. **Initialize a new Next.js project** using one of the following methods:
+## Step 2 — Install the UI Kit
-
-**Using Create Next App**
-
+
+```bash lines
+npm install @cometchat/chat-uikit-react
```
-npx create-next-app@latest my-app --typescript
-cd my-app
+
+
+```bash lines
+yarn add @cometchat/chat-uikit-react
```
-
-
-3. **Open the project directory in your code editor**.
-4. **Begin developing your Next.js application in the "app" directory.**.
-5. **Install additional dependencies as needed**.
-
-***
-
-### **Step 2: Install Dependencies**
+This installs the UI Kit and its dependency `@cometchat/chat-sdk-javascript` automatically.
-The **CometChat UI Kit for React** is an **extension** of the **CometChat JavaScript SDK**.\
-Installing it will **automatically** include the core **Chat SDK**, enabling **seamless integration**.
+If you want voice/video calling, also install:
-```java
-npm install @cometchat/chat-uikit-react
+```bash lines
+npm install @cometchat/calls-sdk-javascript
```
-***
+---
-### **Step 3: Initialize CometChat UI Kit**
+## Step 3 — Initialize CometChat
-Before using any features of the **CometChat UI Kit** or **CometChat SDK**, you must **initialize** the required settings.
-```ts
+```ts lines highlight={7-9}
import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
/**
@@ -144,35 +102,24 @@ const COMETCHAT_CONSTANTS = {
AUTH_KEY: "AUTH_KEY", // Replace with your Auth Key (leave blank if using Auth Token)
};
-/**
- * Configure the CometChat UI Kit using the UIKitSettingsBuilder.
- * This setup determines how the chat UI behaves.
- */
const UIKitSettings = new UIKitSettingsBuilder()
- .setAppId(COMETCHAT_CONSTANTS.APP_ID) // Assign the App ID
- .setRegion(COMETCHAT_CONSTANTS.REGION) // Assign the App's Region
- .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY) // Assign the Authentication Key (if applicable)
- .subscribePresenceForAllUsers() // Enable real-time presence updates for all users
- .build(); // Build the final configuration
+ .setAppId(COMETCHAT_CONSTANTS.APP_ID)
+ .setRegion(COMETCHAT_CONSTANTS.REGION)
+ .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
+ .subscribePresenceForAllUsers()
+ .build();
-/**
- * Initialize the CometChat UI Kit with the configured settings.
- * Once initialized successfully, you can proceed with user authentication and chat features.
- */
-CometChatUIKit.init(UIKitSettings)!
- .then(() => {
+CometChatUIKit.init(UIKitSettings)
+ ?.then(() => {
console.log("CometChat UI Kit initialized successfully.");
- // You can now call login function to authenticate users
})
.catch((error) => {
- console.error("CometChat UI Kit initialization failed:", error); // Log errors if initialization fails
+ console.error("CometChat UI Kit initialization failed:", error);
});
```
-
-
-```js
+```js lines highlight={7-9}
import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
/**
@@ -184,80 +131,45 @@ const COMETCHAT_CONSTANTS = {
AUTH_KEY: "AUTH_KEY", // Replace with your Auth Key (leave blank if using Auth Token)
};
-/**
- * Configure the CometChat UI Kit using the UIKitSettingsBuilder.
- * This setup determines how the chat UI behaves.
- */
const UIKitSettings = new UIKitSettingsBuilder()
- .setAppId(COMETCHAT_CONSTANTS.APP_ID) // Assign the App ID
- .setRegion(COMETCHAT_CONSTANTS.REGION) // Assign the App's Region
- .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY) // Assign the Authentication Key (if applicable)
- .subscribePresenceForAllUsers() // Enable real-time presence updates for all users
- .build(); // Build the final configuration
+ .setAppId(COMETCHAT_CONSTANTS.APP_ID)
+ .setRegion(COMETCHAT_CONSTANTS.REGION)
+ .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
+ .subscribePresenceForAllUsers()
+ .build();
-/**
- * Initialize the CometChat UI Kit with the configured settings.
- * Once initialized successfully, you can proceed with user authentication and chat features.
- */
CometChatUIKit.init(UIKitSettings)
.then(() => {
console.log("CometChat UI Kit initialized successfully.");
- // You can now call login function to authenticate users
})
.catch((error) => {
- console.error("CometChat UI Kit initialization failed:", error); // Log errors if initialization fails
+ console.error("CometChat UI Kit initialization failed:", error);
});
```
-
-
-
-
-Ensure you replace the placeholders with your actual CometChat credentials.
-
-
-
-***
-
-### **Step 4: User Login**
-
-To authenticate a user, you need a **`UID`**. You can either:
-
-1. **Create new users** on the **[CometChat Dashboard](https://app.cometchat.com)**, **[CometChat SDK Method](/ui-kit/react/methods#create-user)** or **[via the API](https://api-explorer.cometchat.com/reference/creates-user)**.
+
+`init()` must resolve before you call `login()`. If you call `login()` before init completes, it will fail silently. Note the `?.then()` — in Next.js, `init()` may return `undefined` if settings are invalid.
+
-2. **Use pre-generated test users**:
-
- * `cometchat-uid-1`
- * `cometchat-uid-2`
- * `cometchat-uid-3`
- * `cometchat-uid-4`
- * `cometchat-uid-5`
-
-The **Login** method returns a **User object** containing all relevant details of the logged-in user.
-
-***
+---
-
+## Step 4 — Login
-**Security Best Practices**
+After init resolves, log the user in. For development, use one of the pre-created test UIDs:
-* The **Auth Key** method is recommended for **proof-of-concept (POC) development** and early-stage testing.
-* For **production environments**, it is strongly advised to use an **[Auth Token](/ui-kit/react/methods#login-using-auth-token)** instead of an **Auth Key** to enhance security and prevent unauthorized access.
-
-
+`cometchat-uid-1` · `cometchat-uid-2` · `cometchat-uid-3` · `cometchat-uid-4` · `cometchat-uid-5`
-```ts
+```ts lines highlight={3}
import { CometChatUIKit } from "@cometchat/chat-uikit-react";
const UID = "UID"; // Replace with your actual UID
CometChatUIKit.getLoggedinUser().then((user: CometChat.User | null) => {
if (!user) {
- // If no user is logged in, proceed with login
CometChatUIKit.login(UID)
.then((user: CometChat.User) => {
console.log("Login Successful:", { user });
@@ -265,22 +177,19 @@ CometChatUIKit.getLoggedinUser().then((user: CometChat.User | null) => {
})
.catch(console.log);
} else {
- // If user is already logged in, mount your app
+ // Already logged in — mount your app
}
});
```
-
-
-```js
+```js lines highlight={3}
import { CometChatUIKit } from "@cometchat/chat-uikit-react";
const UID = "UID"; // Replace with your actual UID
CometChatUIKit.getLoggedinUser().then((user) => {
if (!user) {
- // If no user is logged in, proceed with login
CometChatUIKit.login(UID)
.then((user) => {
console.log("Login Successful:", { user });
@@ -288,147 +197,147 @@ CometChatUIKit.getLoggedinUser().then((user) => {
})
.catch(console.log);
} else {
- // If user is already logged in, mount your app
+ // Already logged in — mount your app
}
});
```
-
-
-***
-
-### **Step 5: Choose a Chat Experience**
+Key points:
+- `getLoggedinUser()` checks for an existing session so you don't re-login unnecessarily.
+- `login(uid)` skips the API call if a session already exists and returns the cached user.
+- Components must not render until login resolves — use a state flag to gate rendering.
-Integrate a conversation view that suits your application's **UX requirements**. Below are the available options:
-
-***
-
-#### **1️⃣ Conversation List + Message View**
+
+For production, use [`loginWithAuthToken()`](/ui-kit/react/methods#login-using-auth-token) instead of Auth Key. Generate tokens server-side via the REST API.
+
-**Best for:** Applications that need a **two-panel layout**, such as web-based chat interfaces (e.g., WhatsApp Web, Slack).
+---
-**Features:**
+## Step 5 — Add the CSS Import
-* **Two-panel layout** – Displays the conversation list on the left and the active chat window on the right.
-* **One-to-one & group conversations** – Seamless switching between private and group chats.
-* **Multiple conversations** – Effortlessly switch between different chat windows.
-* **Easy navigation** – Intuitive UI for finding and accessing chats quickly.
-* **Tap-to-view on mobile** – In mobile layouts, tapping a conversation opens the **Message View**, optimizing space.
-* **Real-time updates** – Auto-refreshes messages and conversation lists.
-* **Message sync** – Ensures messages stay updated across all sessions and devices.
+Add this line at the top of your global CSS file (e.g. `globals.css`):
-
-
-
+```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%;
+}
-[](https://link.cometchat.com/next-conversation-list-message)
+#__next {
+ height: 100%;
+}
+```
-> **Tip:** You can **fork** the sandbox, insert your **CometChat credentials** (App ID, Region, Auth Key.) in the code, and immediately preview how the UI and messages respond in real time.
+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](./next-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 live CodeSandbox demo and 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.
-
-[](https://link.cometchat.com/next-one-on-one)
-
-> **Tip:** You can **fork** the sandbox, insert your **CometChat credentials** (App ID, Region, Auth Key.) in the code, and immediately preview how the UI and messages respond in real time.
+[](https://link.cometchat.com/next-conversation-list-message)
-[Integrate One-to-One/Group Chat](./next-one-to-one-chat)
+> Fork the sandbox, insert your CometChat credentials (App ID, Region, Auth Key), and preview the UI in real time.
-***
+
+ Step-by-step guide to build this layout
+
-#### **3️⃣ Tab-Based Chat Experience**
+---
-**Best for:** Apps that need a **structured, multi-feature navigation system** for seamless interaction between **chats, calls, users, and settings**.
+### One-to-One / Group Chat
-**Features:**
+Single chat window — no sidebar. Good for support chat, embedded widgets, or focused messaging.
-* **Tab Navigation** – Easily switch between **Chat, Call Logs, Users, and Settings**.
-* **Dedicated Chat Window** – Full-screen messaging experience for focused communication.
-* **No Sidebar** – Unlike multi-panel UI, this design prioritizes individual interactions.
-* **Unified Experience** – Users can seamlessly manage conversations, call history, and settings from a single interface.
-* **Scalable for future features** – Easily extend to include more functionalities such as notifications or contact management.
-* **Optimized for both desktop and mobile** – Ensures a smooth experience across different screen sizes.
+- Dedicated chat window for one-on-one or group messaging
+- No conversation list — users go directly into the chat
+- Full-screen experience optimized for mobile
+- Ideal for support chat or community messaging
-
+
-**Recommended for:**
+[](https://link.cometchat.com/next-one-on-one)
-* **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.
+> Fork the sandbox, insert your CometChat credentials (App ID, Region, Auth Key), and preview the UI in real time.
-[](https://link.cometchat.com/next-tabs-sidebar-message)
+
+ Step-by-step guide to build this layout
+
-> **Tip:** You can **fork** the sandbox, insert your **CometChat credentials** (App ID, Region, Auth Key.) in the code, and immediately preview how the UI and messages respond in real time.
+---
-[Integrate Tab-Based Chat](./next-tab-based-chat)
+### Tab-Based Chat
-***
+Tabbed navigation — Chat, Call Logs, Users, Settings in separate tabs. Good for full-featured apps.
-## **Build Your Own Chat Experience**
+- Tab navigation between Chat, Call Logs, Users, and Settings
+- Full-screen messaging within each tab
+- Unified experience for conversations, call history, and settings
+- Scales well for adding future features like notifications or contacts
-**Best for:** Developers who need complete control over their chat interface, allowing customization of components, themes, and features to align with their app’s design and functionality. Whether you're enhancing an existing chat experience or building from scratch, this approach provides the flexibility to tailor every aspect to your needs.
+
+
+
-**Recommended for:**
+[](https://link.cometchat.com/next-tabs-sidebar-message)
-* Apps that require **a fully customized chat experience**.
-* Developers who want to **extend functionalities and modify UI components**.
-* Businesses integrating chat seamlessly into **existing platforms**.
+> Fork the sandbox, insert your CometChat credentials (App ID, Region, Auth Key), and preview the UI in real time.
-**Key Areas to Explore:**
+
+ Step-by-step guide to build this layout
+
-* **[React Sample App](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app)** – Fully functional sample applications to accelerate your development.
-* **[Core Features](./core-features)** – Learn about messaging, real-time updates, and other essential capabilities.
-* **[Components](./components-overview)** – Utilize prebuilt UI elements or customize them to fit your design.
-* **[Themes](./theme)** – Adjust colors, fonts, and styles to match your branding.
-* **[Build Your Own UI](./../../../sdk/javascript/overview)** – Prefer a custom UI over our UI Kits? Explore our SDKs to create a tailored chat experience.
+---
-***
+## Build Your Own Chat Experience
-## **Next Steps**
+Need full control over the UI? Use individual components, customize themes, and wire up your own layouts.
-Now that you’ve selected your **chat experience**, proceed to the **integration guide**:
+- [Sample App](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app) — Working reference app to compare against
+- [Components](/ui-kit/react/components-overview) — All prebuilt UI elements with props and customization options
+- [Core Features](/ui-kit/react/core-features) — Messaging, real-time updates, and other capabilities
+- [Theming](/ui-kit/react/theme) — Colors, fonts, dark mode, and custom styling
+- [Build Your Own UI](/sdk/javascript/overview) — Skip the UI Kit entirely and build on the raw SDK
-* **[Integrate Conversation List + Message](/ui-kit/react/next-conversation)**
-* **[Integrate One-to-One Chat](/ui-kit/react/next-one-to-one-chat)**
-* **[Integrate Tab-Based Chat](/ui-kit/react/next-tab-based-chat)**
-* **[Advanced Customizations](/ui-kit/react/theme)**
+---
-***
+## Next Steps
+
+
+
+ Browse all prebuilt UI components
+
+
+ Customize colors, fonts, and styles
+
+
+ Chat features included out of the box
+
+
+ Common issues and fixes
+
+
diff --git a/ui-kit/react/next-one-to-one-chat.mdx b/ui-kit/react/next-one-to-one-chat.mdx
index 6b9ca33f4..af5dbacb7 100644
--- a/ui-kit/react/next-one-to-one-chat.mdx
+++ b/ui-kit/react/next-one-to-one-chat.mdx
@@ -1,91 +1,89 @@
---
-title: "Building A One To One/Group Chat Experience"
-sidebarTitle: "One To One/Group Chat"
+title: "One-to-One / Group Chat"
+sidebarTitle: "One-to-One / Group Chat"
+description: "Build a focused one-to-one or group chat experience in Next.js with CometChat UI Kit."
---
-The **One-to-One Chat** feature provides a streamlined **direct messaging interface**, making it ideal for **support chats, dating apps, and private messaging platforms**. This setup eliminates distractions by focusing solely on a **dedicated chat window**.
+
-[](https://link.cometchat.com/next-one-on-one)
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Framework | Next.js |
+| Components | `CometChatMessageHeader`, `CometChatMessageList`, `CometChatMessageComposer` |
+| Layout | Single chat window — no sidebar, no conversation list |
+| Prerequisite | Complete [Next.js Integration](/ui-kit/react/next-js-integration) Steps 1–5 first |
+| SSR | Dynamic import with `ssr: false` — CometChat requires browser APIs |
+| Pattern | Support chat, embedded widgets, focused messaging |
-> **Tip:** You can **fork** the sandbox, insert your **CometChat credentials** (App ID, Region, Auth Key.) in the code, and immediately preview how the UI and messages respond in real time.
+
-***
+This guide builds a single chat window — no sidebar, no conversation list. Users go directly into a one-to-one or group chat. Good for support chat, embedded widgets, or any focused messaging experience.
-## **User Interface Preview**
+This assumes you've already completed [Next.js Integration](/ui-kit/react/next-js-integration) (project created, UI Kit installed, CSS imported).
-### **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
-
-```
-
-### **Step 2: Build the Message View**
+[](https://link.cometchat.com/next-one-on-one)
-* Load **chat history** and **real-time messages**.
-* Ensure **smooth scrolling and timestamp visibility**.
+> Fork the sandbox, insert your CometChat credentials (App ID, Region, Auth Key), and preview the UI in real time.
-```html
-
-```
+---
-### **Step 3: Add the Message Composer**
+## What You're Building
-* Include a **text input field**.
-* Support **media uploads, file attachments, emojis, and reactions**.
+Three components stacked vertically:
-```html
-
-```
+1. **Chat header** — displays recipient name, avatar, online status, and optional call buttons
+2. **Message list** — real-time chat history with scrolling
+3. **Message composer** — text input with media, emojis, and reactions
-***
+---
-#### **Implementation**
+## Step 1 — Create the CometChatNoSSR Component
-Now we will create the `CometChatNoSSR.tsx` & `CometChatNoSSR.css` files. Here, we will initialize the CometChat UI Kit, log in a user, and build the messaging experience using `CometChatMessageHeader`, `CometChatMessageList`, and `CometChatMessageComposer` components.
+This component handles init, login, fetches the target user/group, and renders the chat UI. It runs client-side only.
-```
-src/
-│── CometChatNoSSR/
-│ ├── CometChatNoSSR.tsx
-│ ├── CometChatNoSSR.css
-```
+
+
+
+
+
+
+
+
+
+
-```tsx CometChatNoSSR.tsx
+```tsx title="CometChatNoSSR.tsx" lines highlight={13-15, 19}
import React, { useEffect, useState } from "react";
-import { CometChatMessageComposer, CometChatMessageHeader, CometChatMessageList, CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
+import {
+ CometChatMessageComposer,
+ CometChatMessageHeader,
+ CometChatMessageList,
+ CometChatUIKit,
+ UIKitSettingsBuilder,
+} from "@cometchat/chat-uikit-react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import "./CometChatNoSSR.css";
const COMETCHAT_CONSTANTS = {
- APP_ID: "",
- REGION: "",
- AUTH_KEY: "",
+ APP_ID: "", // Replace with your App ID
+ REGION: "", // Replace with your Region
+ AUTH_KEY: "", // Replace with your Auth Key (dev only)
};
+// Fetch the user whose chat you want to load
+const UID = "cometchat-uid-1";
+
const CometChatNoSSR: React.FC = () => {
const [user, setUser] = useState(undefined);
const [selectedUser, setSelectedUser] = useState(undefined);
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
const [selectedGroup, setSelectedGroup] = useState(undefined);
useEffect(() => {
@@ -101,7 +99,7 @@ const CometChatNoSSR: React.FC = () => {
console.log("Initialization completed successfully");
CometChatUIKit.getLoggedinUser().then((loggedInUser) => {
if (!loggedInUser) {
- CometChatUIKit.login("superhero1")
+ CometChatUIKit.login("cometchat-uid-2")
.then((user) => {
console.log("Login Successful", { user });
setUser(user);
@@ -118,26 +116,16 @@ const CometChatNoSSR: React.FC = () => {
useEffect(() => {
if (user) {
- // Fetch user or group from CometChat SDK whose chat you want to load.
-
- /** Fetching User */
- const UID = "cometchat-uid-1";
CometChat.getUser(UID).then(
- user => {
- setSelectedUser(user);
- }, error => {
- console.log("User fetching failed with error:", error);
- }
+ (user) => setSelectedUser(user),
+ (error) => console.log("User fetching failed with error:", error)
);
- /** Fetching Group */
- // const GUID = "GUID"
+ // To load a group chat instead, uncomment below:
+ // const GUID = "GUID";
// CometChat.getGroup(GUID).then(
- // group => {
- // setSelectedGroup(group);
- // }, error => {
- // console.log("User fetching failed with error:", error);
- // }
+ // (group) => setSelectedGroup(group),
+ // (error) => console.log("Group fetching failed with error:", error)
// );
}
}, [user]);
@@ -151,7 +139,9 @@ const CometChatNoSSR: React.FC = () => {
) : (
-
Select Conversation to start
+
+ Set a user or group UID in CometChatNoSSR.tsx to start chatting
+
)}
>
) : undefined;
@@ -161,174 +151,113 @@ export default CometChatNoSSR;
```
-
-```css CometChatNoSSR.css
+```css title="CometChatNoSSR.css" lines
.messages-wrapper {
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
+ width: 100%;
+ height: 100%;
+ display: flex;
+ flex-direction: column;
}
.empty-conversation {
- height: 100%;
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- background: white;
- color: var(--cometchat-text-color-secondary, #727272);
- font: var(--cometchat-font-body-regular, 400 14px Roboto);
+ height: 100%;
+ width: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ background: white;
+ color: var(--cometchat-text-color-secondary, #727272);
+ font: var(--cometchat-font-body-regular, 400 14px Roboto);
}
.cometchat .cometchat-message-composer {
- border-radius: 0px;
+ border-radius: 0px;
}
```
-
-In the code snippet above, ensure you select either a user or a group based on your chat requirement. You can also determine this dynamically depending on the conversation type.
+Key points:
+- `CometChat.getUser(UID)` fetches the user object from the SDK — you need a real user object, not a manually constructed one.
+- Pass either `user` or `group` to the message components, never both.
+- The highlighted lines show where to set your credentials.
-#### **Fetching a User (One-on-One Chat)**
+---
-```javascript
-const UID = "cometchat-uid-1";
-CometChat.getUser(UID).then(
- user => {
- setSelectedUser(user);
- }, error => {
- console.log("User fetching failed with error:", error);
- }
-);
-```
+## Switching Between User and Group Chat
-#### **Fetching a Group (Group Chat)**
+To load a group chat instead of one-to-one, replace the `getUser` call with `getGroup`:
-```javascript
-const GUID = "GUID"
-CometChat.getGroup(GUID).then(
- group => {
- setSelectedGroup(group);
- }, error => {
- console.log("User fetching failed with error:", error);
- }
-);
-```
+```tsx highlight={1} lines
+const GUID = "GUID"; // Replace with your actual Group ID
-### **Step 4: Disabling SSR for `CometChatNoSSR.tsx` in Next.js**
+CometChat.getGroup(GUID)
+ .then((group) => setSelectedGroup(group))
+ .catch((error) => console.error("Failed to fetch group:", error));
+```
-In this update, we will **disable Server-Side Rendering (SSR) for `CometChatNoSSR.tsx`** while keeping the rest of the application’s SSR functionality intact. This ensures that the **CometChat UI Kit components load only on the client-side**, preventing SSR-related issues.
+---
-#### **Disabling SSR in `index.tsx`**
+## Step 2 — Disable SSR in Your Page
-Modify your `index.tsx` file to dynamically import the `CometChatNoSSR.tsx` component with `{ ssr: false }`.
+Dynamically import `CometChatNoSSR` with `ssr: false` so it only loads client-side.
-```tsx index.tsx
-import { Inter } from "next/font/google";
+```tsx title="index.tsx" lines
import dynamic from "next/dynamic";
+import "@cometchat/chat-uikit-react/css-variables.css";
-import '@cometchat/chat-uikit-react/css-variables.css';
-
-const inter = Inter({ subsets: ["latin"] });
-
-// Dynamically import CometChat component with SSR disabled
-const CometChatComponent = dynamic(() => import("../CometChatNoSSR/CometChatNoSSR"), {
- ssr: false,
-});
+const CometChatComponent = dynamic(
+ () => import("../CometChatNoSSR/CometChatNoSSR"),
+ { ssr: false }
+);
export default function Home() {
return ;
}
```
-#### **Why disable SSR?**
-
-* The CometChat UI Kit depends on browser APIs (window, document, WebSockets).
-* Next.js pre-renders components on the server, which can cause errors with browser-specific features.
-* By setting `{ ssr: false }`, we ensure that CometChatNoSSR.tsx only loads on the client.
-
-***
-
-### **Step 5: Update Global CSS**
-
-Next, add the following styles to global.css to ensure CometChat UI Kit is properly styled.
-
-```css global.css
-:root {
- --background: #ffffff;
- --foreground: #171717;
-}
-
-@media (prefers-color-scheme: dark) {
- :root {
- --background: #0a0a0a;
- --foreground: #ededed;
- }
-}
-
-/** Give your App a height of `100%`. Keep other CSS properties in the below selector as it is. */
-.root {
- height: 100%;
-}
-
-#__next {
- height: 100%;
-}
-
-html,
-body {
- height: 100%;
-}
-
-html,
-body {
- max-width: 100vw;
- overflow-x: hidden;
-}
-
-body {
- color: var(--foreground);
- background: var(--background);
- font-family: Arial, Helvetica, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
-
-* {
- box-sizing: border-box;
- padding: 0;
- margin: 0;
-}
+---
-a {
- color: inherit;
- text-decoration: none;
-}
+## Step 3 — Run the Project
-@media (prefers-color-scheme: dark) {
- html {
- color-scheme: dark;
- }
-}
+
+
+```bash lines
+npm run dev
```
-
-***
-
-### **Step 6: Run the project**
-
+
+
+```bash lines
+pnpm dev
```
-npm run dev
+
+
+```bash lines
+yarn dev
```
+
+
-## **Next Steps**
-
-### **Enhance the User Experience**
+You should see the chat window load with the conversation for the UID you set.
-* **[Advanced Customizations](/ui-kit/react/theme)** – Personalize the chat UI to align with your brand.
+---
-***
+## Next Steps
+
+
+
+ Customize colors, fonts, and styles to match your brand
+
+
+ Browse all prebuilt UI components
+
+ } href="/ui-kit/react/next-js-integration">
+ Back to the main setup guide
+
+
+ Chat features included out of the box
+
+
diff --git a/ui-kit/react/next-tab-based-chat.mdx b/ui-kit/react/next-tab-based-chat.mdx
index 91f61a656..afd95dcc1 100644
--- a/ui-kit/react/next-tab-based-chat.mdx
+++ b/ui-kit/react/next-tab-based-chat.mdx
@@ -1,90 +1,92 @@
---
-title: "Building A Messaging UI With Tabs, Sidebar, And Message View"
-sidebarTitle: "Tab Based Chat Experience"
+title: "Tab-Based Chat"
+sidebarTitle: "Tab-Based Chat"
+description: "Build a tab-based messaging UI with chats, calls, users, and groups in Next.js with CometChat UI Kit."
---
-This guide walks you through creating a **tab-based messaging UI** using **React** and **CometChat UIKit**. The UI will include different sections for **Chats, Calls, Users, and Groups**, allowing seamless navigation.
+
-[](https://link.cometchat.com/next-tabs-sidebar-message)
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Framework | Next.js |
+| Components | `CometChatConversations`, `CometChatCallLogs`, `CometChatUsers`, `CometChatGroups`, `CometChatMessageHeader`, `CometChatMessageList`, `CometChatMessageComposer` |
+| Layout | Tabbed sidebar (Chats, Calls, Users, Groups) + message view |
+| Prerequisite | Complete [Next.js Integration](/ui-kit/react/next-js-integration) Steps 1–5 first |
+| SSR | Dynamic import with `ssr: false` — CometChat requires browser APIs |
+| Pattern | Full-featured messaging app with multiple sections |
-> **Tip:** You can **fork** the sandbox, insert your **CometChat credentials** (App ID, Region, Auth Key.) in the code, and immediately preview how the UI and messages respond in real time.
+
-***
+This guide builds a tabbed messaging UI — Chats, Calls, Users, and Groups tabs in the sidebar, with a message view on the right. Good for full-featured apps that need more than just conversations.
-## **User Interface Preview**
+This assumes you've already completed [Next.js Integration](/ui-kit/react/next-js-integration) (project created, UI Kit installed, CSS imported).
-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.
+[](https://link.cometchat.com/next-tabs-sidebar-message)
-#### **Folder Structure**
+> Fork the sandbox, insert your CometChat credentials (App ID, Region, Auth Key), and preview the UI in real time.
-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/
-│── 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
+
+
+
+
+
+
+
+
+
+
+
+
+Tab icons need to be placed in `public/assets/`. Download them from the [CometChat UI Kit assets folder on GitHub](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app/src/assets).
+
+
+
+
+
+
+
+
+
+
+
-```tsx CometChatTabs.tsx
+```tsx title="CometChatTabs.tsx" lines
import { useState } from "react";
import "./CometChatTabs.css";
-// Define icon paths for each tab
const chatsIcon = "/assets/chats.svg";
const callsIcon = "/assets/calls.svg";
const usersIcon = "/assets/users.svg";
const groupsIcon = "/assets/groups.svg";
-// CometChatTabs component to display tab options
export const CometChatTabs = (props: {
- onTabClicked?: (tabItem: { name: string; icon?: string }) => void; // Callback when a tab is clicked
- activeTab?: string; // Name of the currently active tab
+ onTabClicked?: (tabItem: { name: string; icon?: string }) => void;
+ activeTab?: string;
}) => {
- // Destructure props with default fallback
- const {
- onTabClicked = () => {}, // Fallback to no-op if not provided
- activeTab,
- } = props;
-
- // State to track the currently hovered tab
+ const { onTabClicked = () => {}, activeTab } = props;
const [hoverTab, setHoverTab] = useState("");
- // Array of tab items with their labels and icons
const tabItems = [
{ name: "CHATS", icon: chatsIcon },
{ name: "CALLS", icon: callsIcon },
@@ -94,7 +96,6 @@ export const CometChatTabs = (props: {
return (
- {/* Loop through each tab item to render it */}
{tabItems.map((tabItem) => {
const isActive =
activeTab === tabItem.name.toLowerCase() ||
@@ -104,9 +105,8 @@ export const CometChatTabs = (props: {
onTabClicked(tabItem)} // Invoke callback on click
+ onClick={() => onTabClicked(tabItem)}
>
- {/* Icon section with mask styling */}
) : undefined;
@@ -534,169 +491,118 @@ export default CometChatNoSSR;
```
-
-```css CometChatNoSSR.css
-/* Layout for the main container that holds conversations and messages */
+```css title="CometChatNoSSR.css" lines
.conversations-with-messages {
- display: flex;
- height: 100%;
- width: 100%;
+ display: flex;
+ height: 100%;
+ width: 100%;
}
-/* Sidebar wrapper for conversation list */
.conversations-wrapper {
- height: 100%;
- width: 480px; /* Fixed width for conversation list */
- overflow: hidden; /* Hide any overflowing content */
- display: flex;
- flex-direction: column;
- height: inherit;
+ height: 100%;
+ width: 480px;
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+ height: inherit;
}
-/* Hide overflow content inside the conversation component */
.conversations-wrapper > .cometchat {
- overflow: hidden;
+ overflow: hidden;
}
-/* Message section layout */
.messages-wrapper {
- width: calc(100% - 480px); /* Take remaining space */
- height: 100%;
- display: flex;
- flex-direction: column;
+ width: calc(100% - 480px);
+ height: 100%;
+ display: flex;
+ flex-direction: column;
}
-/* Styling for when no conversation is selected */
.empty-conversation {
- height: 100%;
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- background: white;
- color: var(--cometchat-text-color-secondary, #727272);
- font: var(--cometchat-font-body-regular, 400 14px Roboto);
+ height: 100%;
+ width: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ background: white;
+ color: var(--cometchat-text-color-secondary, #727272);
+ font: var(--cometchat-font-body-regular, 400 14px Roboto);
}
-/* Ensure message composer does not have rounded corners */
.cometchat .cometchat-message-composer {
- border-radius: 0px;
+ border-radius: 0px;
}
```
-
-### **Step 4: Disabling SSR for `CometChatNoSSR.tsx` in Next.js**
+How it works:
+- Selections from any tab (Chats, Calls, Users, Groups) flow through the same `onSelectorItemClicked` callback.
+- Conversation items are unwrapped via `getConversationWith()` to extract the underlying `User` or `Group`.
+- Only one of `selectedUser` / `selectedGroup` is set at a time — the other is cleared.
-In this update, we will **disable Server-Side Rendering (SSR) for `CometChatNoSSR.tsx`** while keeping the rest of the application’s SSR functionality intact. This ensures that the **CometChat UI Kit components load only on the client-side**, preventing SSR-related issues.
+---
-#### **Disabling SSR in `index.tsx`**
+## Step 4 — Disable SSR in Your Page
-Modify your `index.tsx` file to dynamically import the `CometChatNoSSR.tsx` component with `{ ssr: false }`.
+Dynamically import `CometChatNoSSR` with `ssr: false` so it only loads client-side.
-```tsx index.tsx
-import { Inter } from "next/font/google";
+```tsx title="index.tsx" lines
import dynamic from "next/dynamic";
+import "@cometchat/chat-uikit-react/css-variables.css";
-import '@cometchat/chat-uikit-react/css-variables.css';
-
-const inter = Inter({ subsets: ["latin"] });
-
-// Dynamically import CometChat component with SSR disabled
-const CometChatComponent = dynamic(() => import("../CometChatNoSSR/CometChatNoSSR"), {
- ssr: false,
-});
+const CometChatComponent = dynamic(
+ () => import("../CometChatNoSSR/CometChatNoSSR"),
+ { ssr: false }
+);
export default function Home() {
return ;
}
```
-#### **Why disable SSR?**
-
-* The CometChat UI Kit depends on browser APIs (window, document, WebSockets).
-* Next.js pre-renders components on the server, which can cause errors with browser-specific features.
-* By setting `{ ssr: false }`, we ensure that CometChatNoSSR.tsx only loads on the client.
-
-### **Step 5: Update Global CSS**
-
-Next, add the following styles to global.css to ensure CometChat UI Kit is properly styled.
-
-```css global.css
-:root {
- --background: #ffffff;
- --foreground: #171717;
-}
-
-@media (prefers-color-scheme: dark) {
- :root {
- --background: #0a0a0a;
- --foreground: #ededed;
- }
-}
-
-/** Give your App a height of `100%`. Keep other CSS properties in the below selector as it is. */
-.root {
- height: 100%;
-}
-
-#__next {
- height: 100%;
-}
-
-html,
-body {
- height: 100%;
-}
-
-html,
-body {
- max-width: 100vw;
- overflow-x: hidden;
-}
-
-body {
- color: var(--foreground);
- background: var(--background);
- font-family: Arial, Helvetica, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
-
-* {
- box-sizing: border-box;
- padding: 0;
- margin: 0;
-}
+---
-a {
- color: inherit;
- text-decoration: none;
-}
+## Step 5 — Run the Project
-@media (prefers-color-scheme: dark) {
- html {
- color-scheme: dark;
- }
-}
+
+
+```bash lines
+npm run dev
```
-
-### **Step 6: Run the project**
-
+
+
+```bash lines
+pnpm dev
```
-npm run dev
+
+
+```bash lines
+yarn dev
```
+
+
-***
-
-## **Next Steps**
-
-### **Enhance the User Experience**
+You should see the tab bar at the bottom of the sidebar. Switch between Chats, Calls, Users, and Groups — tapping any item loads the message view on the right.
-* **[Advanced Customizations](/ui-kit/react/theme)** – Personalize the chat UI to align with your brand.
+---
-***
+## Next Steps
+
+
+
+ Customize colors, fonts, and styles to match your brand
+
+
+ Browse all prebuilt UI components
+
+ } href="/ui-kit/react/next-js-integration">
+ Back to the main setup guide
+
+
+ Chat features included out of the box
+
+
diff --git a/ui-kit/react/outgoing-call.mdx b/ui-kit/react/outgoing-call.mdx
index 89413847a..c6d9c9f35 100644
--- a/ui-kit/react/outgoing-call.mdx
+++ b/ui-kit/react/outgoing-call.mdx
@@ -1,29 +1,35 @@
---
title: "Outgoing Call"
+description: "Display and manage outgoing voice and video calls with cancel controls using the CometChatOutgoingCall component."
---
-## Overview
-
-The outgoing call component is a visual representation of a user-initiated call, whether it's a voice or video call. It serves as an interface for managing outgoing calls, providing users with essential options to control the call experience. This component typically includes information about the call recipient, call controls for canceling the call, and feedback on the call status, such as indicating when the call is in progress.
-
-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. |
+| Field | Value |
+| --- | --- |
+| Purpose | Visual representation of a user-initiated outgoing voice/video call with cancel control and recipient info |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatOutgoingCall } from "@cometchat/chat-uikit-react";` |
+| Used in experiences | Outgoing call screen, call initiation overlay |
+| Copy-paste base | See [Base Code](#base-code--stylesheet) below |
+| Primary output | Call cancellation via `onCallCanceled` |
+| Primary hook points | `onCallCanceled`, `onError`, view slots (`titleView`, `subtitleView`, `avatarView`, `cancelButtonView`) |
+| CSS root class | `.cometchat-outgoing-call` |
+| Real-time events | None emitted directly |
-## Usage
+
-### Integration
+## Base Code and Stylesheet
+
+Renders an outgoing call screen with recipient info and a cancel button. Requires a `CometChat.Call` object from `CometChat.initiateCall()`.
-```tsx
+```tsx lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import {
CometChatOutgoingCall,
@@ -36,16 +42,13 @@ const OutgoingCallDemo = () => {
React.useEffect(() => {
const uid = "uid";
-
const callObject = new CometChat.Call(
uid,
CometChatUIKitConstants.MessageTypes.audio,
CometChatUIKitConstants.MessageReceiverType.user
);
CometChat.initiateCall(callObject)
- .then((c) => {
- setCall(c);
- })
+ .then((c) => setCall(c))
.catch(console.log);
}, []);
@@ -54,975 +57,335 @@ const OutgoingCallDemo = () => {
export default OutgoingCallDemo;
```
-
+
-
-```tsx
-import { OutgoingCallDemo } from "./OutgoingCallDemo";
+Root CSS class for style overrides:
-export default function App() {
- return (
-
-
-
-
-
- );
+```css lines
+.cometchat-outgoing-call {
+ /* overrides here */
}
```
-
-
-
-
-### Actions
-
-[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. onCallCanceled
-
-The `onCallCanceled` event gets activated when the cancel button is clicked. It does not have a default behavior. However, you can override its behavior using the following code snippet.
-
-
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import {
- CometChatOutgoingCall,
- CometChatUIKitConstants,
-} from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const OutgoingCallDemo = () => {
- const [call, setCall] = React.useState();
-
- React.useEffect(() => {
- const uid = "uid";
-
- const callObject = new CometChat.Call(
- uid,
- CometChatUIKitConstants.MessageTypes.audio,
- CometChatUIKitConstants.MessageReceiverType.user
- );
- CometChat.initiateCall(callObject)
- .then((c) => {
- setCall(c);
- })
- .catch(console.log);
- }, []);
-
- const cancelCall = () => {
- //your custom cancel call click actions
- CometChat.endCall(call!.getSessionId()).then(() => {
- setCall(undefined);
- });
- };
- return call ? (
-
- ) : null;
-};
+## Functionality
-export default OutgoingCallDemo;
-```
+Props that control component behavior, grouped by surface area.
-
+### Data
-
-```js
-import React, { useState, useEffect } from 'react';
-import { CometChat } from '@cometchat/chat-sdk-javascript';
-import { CometChatOutgoingCall, CometChatUIKitConstants } from '@cometchat/chat-uikit-react';
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `call` | `CometChat.Call` | — (required) | Sets the outgoing call object | Must come from `CometChat.initiateCall()` |
-const OutgoingCallDemo = () => {
- const [call, setCall] = useState(null);
+### Sound
- useEffect(() => {
- const uid = "uid";
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `disableSoundForCalls` | `boolean` | `false` | Disables the outgoing call ringtone | — |
+| `customSoundForCalls` | `string` | `undefined` | Custom sound file URL for outgoing calls | — |
- const callObject = new CometChat.Call(
- uid,
- CometChatUIKitConstants.MessageTypes.audio,
- CometChatUIKitConstants.MessageReceiverType.user
- );
+## Actions
- CometChat.initiateCall(callObject)
- .then((c) => {
- setCall(c);
- })
- .catch(console.log);
- }, []);
+[Actions](/ui-kit/react/components-overview#actions) split into predefined (built-in triggers) and user-defined (callbacks).
- const cancelCall = () =>{
- //your custom cancel call click actions
- CometChat.endCall(call!.getSessionId())
- .then(() => {
- setCall(undefined);
- })
- };
+### Predefined Actions
- return (
- call && (
-
- )
- );
-};
-export default OutgoingCallDemo;
-```
+The cancel button has no default behavior. Override it with `onCallCanceled`.
-
+### User-Defined Actions
-
+#### onCallCanceled
-##### 2. onError
+Fires when the cancel button is clicked.
-This action doesn't change the behavior of the component but rather listens for any errors that occur in the Outgoing Call component.
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks the cancel button |
+| Payload type | `() => void` |
+| What devs typically do next | End the call session, hide the outgoing call UI |
-
-
-```ts
+```ts lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
-import {
- CometChatOutgoingCall,
- CometChatUIKitConstants,
-} from "@cometchat/chat-uikit-react";
-import React from "react";
+import { CometChatOutgoingCall, CometChatUIKitConstants } from "@cometchat/chat-uikit-react";
const OutgoingCallDemo = () => {
const [call, setCall] = React.useState();
React.useEffect(() => {
const uid = "uid";
-
- const callObject = new CometChat.Call(
- uid,
- CometChatUIKitConstants.MessageTypes.audio,
- CometChatUIKitConstants.MessageReceiverType.user
- );
- CometChat.initiateCall(callObject)
- .then((c) => {
- setCall(c);
- })
- .catch(console.log);
+ const callObject = new CometChat.Call(uid, CometChatUIKitConstants.MessageTypes.audio, CometChatUIKitConstants.MessageReceiverType.user);
+ CometChat.initiateCall(callObject).then((c) => setCall(c)).catch(console.log);
}, []);
- function handleOnError(error: CometChat.CometChatException) {
- //Your Custom Error Actions
- console.log(error);
- }
-
- return call ? (
-
- ) : null;
-};
-
-export default OutgoingCallDemo;
-```
-
-
-
-
-```js
-import React, { useState, useEffect } from "react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import {
- CometChatOutgoingCall,
- CometChatUIKitConstants,
-} from "@cometchat/chat-uikit-react";
-
-const OutgoingCallDemo = () => {
- const [call, setCall] = useState(null);
-
- useEffect(() => {
- const uid = "uid";
-
- const callObject = new CometChat.Call(
- uid,
- CometChatUIKitConstants.MessageTypes.audio,
- CometChatUIKitConstants.MessageReceiverType.user
- );
-
- CometChat.initiateCall(callObject)
- .then((c) => {
- setCall(c);
- })
- .catch(console.log);
- }, []);
+ const cancelCall = () => {
+ CometChat.endCall(call!.getSessionId()).then(() => setCall(undefined));
+ };
- function handleOnError(error) {
- //Your Custom Error Actions
- console.log(error);
- }
- return call && ;
+ return call ? : null;
};
-
-export default OutgoingCallDemo;
```
-
+#### onError
-
+Fires when the component encounters an error.
-***
+| Detail | Value |
+| --- | --- |
+| When it fires | Any internal error |
+| Payload type | `(error: CometChat.CometChatException) => void` |
+| What devs typically do next | Log to error tracking service |
-### Filters
+## Filters
-**Filters** allow you to customize the data displayed in a list within a `Component`. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using `RequestBuilders` of Chat SDK.
+The OutgoingCall component does not have any exposed filters.
-The `Outgoing Call` component does not have any exposed filters.
+## Events
-***
+### UI Events
-### Events
+The OutgoingCall component does not emit any custom UI events.
-[Events](/ui-kit/react/components-overview#events) are emitted by a `Component`. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
+### SDK Events (Real-Time)
-The `Outgoing Call` component does not have any exposed filters.
+The component internally listens to SDK call events for real-time call status updates. No manual attachment needed.
-***
+## Advanced: Custom View Slots
-## Customization
+Customization override points for the outgoing call UI.
-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.
+### Slot Catalog
-### Style
+| Slot | Params | What it replaces | Section |
+| --- | --- | --- | --- |
+| `titleView` | `JSX.Element` | Recipient name | Sub-section (title) |
+| `subtitleView` | `JSX.Element` | "Calling..." text | Sub-section (subtitle) |
+| `avatarView` | `JSX.Element` | Recipient avatar | Sub-section (avatar) |
+| `cancelButtonView` | `JSX.Element` | Cancel call button | Sub-section (cancel) |
-Using CSS you can customize the look and feel of the component in your app like the color, size, shape, and fonts.
+### titleView
-**Example**
+Replace the recipient name.
-
+
-```ts
+```ts lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
-import {
- CometChatOutgoingCall,
- CometChatUIKitConstants,
- OutgoingCallStyle,
-} from "@cometchat/chat-uikit-react";
-import React from "react";
+import { CometChatOutgoingCall, CometChatUIKitConstants } from "@cometchat/chat-uikit-react";
const OutgoingCallDemo = () => {
const [call, setCall] = React.useState();
React.useEffect(() => {
const uid = "uid";
+ const callObject = new CometChat.Call(uid, CometChatUIKitConstants.MessageTypes.audio, CometChatUIKitConstants.MessageReceiverType.user);
+ CometChat.initiateCall(callObject).then((c) => setCall(c)).catch(console.log);
+ }, []);
- const callObject = new CometChat.Call(
- uid,
- CometChatUIKitConstants.MessageTypes.audio,
- CometChatUIKitConstants.MessageReceiverType.user
+ const getTitleView = (call: CometChat.Call) => {
+ return (
+
);
};
-export default OutgoingCallDemo;
+;
```
-
-
-
-
-Below is a list of customizations along with corresponding code snippets
-
-| Property | Description | Code |
-| ----------------- | ---------------------------------------------------------------------- | --------------------------------------------------- |
-| **Call** | The CometChat call object used to set up and launch the outgoing call. | `call={call}` |
-| **Disable Sound** | Disables the sound of outgoing calls. | `disableSoundForCalls={false}` |
-| **Custom Sound** | Specifies a custom sound to play for outgoing calls. | `customSoundForCalls='Your Custom Sound For Calls'` |
-
-***
-
-### 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.
-
-***
-
-#### TitleView
-
-This prop renders the custom title view for the outgoing call. Use this to override the existing title of user name from the outgoing call.
-
-The customized chat interface is displayed below.
-
-
-
-
-
-Use the following code to achieve the customization shown above.
-
-
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import {
- CometChatOutgoingCall,
- CometChatUIKitConstants,
-} from "@cometchat/chat-uikit-react";
-import React from "react";
-
-const OutgoingCallDemo = () => {
- const [call, setCall] = React.useState();
-
- React.useEffect(() => {
- const uid = "uid";
-
- const callObject = new CometChat.Call(
- uid,
- CometChatUIKitConstants.MessageTypes.audio,
- CometChatUIKitConstants.MessageReceiverType.user
- );
- CometChat.initiateCall(callObject)
- .then((c) => {
- setCall(c);
- })
- .catch(console.log);
- }, []);
-
- const getTitleView = (call: Call) => {
- return (
-
- );
- };
-
- return (
- call &&
- );
-};
-
-export default OutgoingCallDemo;
+```tsx lines
+
```
-
-
-
-```css
-.outgoing-call__cancel-button-wrapper {
- height: 64px;
- display: flex;
- justify-content: center;
- cursor: pointer;
+```css lines
+.cometchat-outgoing-call__avatar .cometchat-avatar {
+ border-radius: 16px;
+ background: #fbaa75;
}
-.outgoing-call__cancel-button {
- display: flex;
- width: 330px;
- padding: 12px 30px;
- justify-content: center;
- align-items: center;
- gap: 12px;
- align-self: stretch;
- border-radius: 12px;
- background-color: #F44649;
- color: #FFF;
- font: 500 20px Roboto;
+.cometchat-outgoing-call__button {
+ border-radius: 8px;
+ background: #f44649;
}
-.outgoing-call__cancel-button-icon {
- -webkit-mask: url("") center center no-repeat;
- background: #E8E8E8;
- height: 32px;
- width: 32px;
+.cometchat-outgoing-call .cometchat-outgoing-call__title {
+ text-align: center;
+ font: 400 32px/38px "Times New Roman";
}
-```
-
-
-
-
+```
\ No newline at end of file
diff --git a/ui-kit/react/overview.mdx b/ui-kit/react/overview.mdx
index 42b82d980..ee3a0041a 100644
--- a/ui-kit/react/overview.mdx
+++ b/ui-kit/react/overview.mdx
@@ -1,214 +1,106 @@
---
-title: "CometChat UI Kit For React"
+title: "React UI Kit"
sidebarTitle: "Overview"
+description: "Prebuilt React components for chat, voice, and video calling. Supports React.js, Next.js, React Router, and Astro."
---
-The **CometChat UI Kit** for React is a powerful solution designed to seamlessly integrate chat functionality into applications. It provides a robust set of **prebuilt UI components** that are **modular, customizable, and highly scalable**, allowing developers to accelerate their development process with minimal effort.
+
-***
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` v6.3.x |
+| Peer deps | `react` >=18, `react-dom` >=18, `rxjs` ^7.8.1 |
+| Calling | Optional — `@cometchat/calls-sdk-javascript` |
+| SSR | Client-side only. Use `ssr: false` or `client:only="react"` |
+| Localization | 19 languages built-in |
+| Source | [GitHub](https://github.com/cometchat/cometchat-uikit-react/tree/v6) |
-## **Why Choose CometChat UI Kit?**
+
-* **Rapid Integration** – Prebuilt UI components for faster deployment.
-* **Customizable & Flexible** – Modify the UI to align with your brand’s identity.
-* **Cross-Platform Compatibility** – Works seamlessly across various React-based frameworks.
-* **Scalable & Reliable** – Built on CometChat's **robust chat infrastructure** for enterprise-grade performance.
-
-***
-
-## **User Interface Preview**
+The CometChat React UI Kit provides prebuilt, customizable components for adding chat, voice, and video calling to any React app. Each component handles its own data fetching, real-time listeners, and state — you just drop them into your layout.
-***
-
-## **Try Live Demo**
+---
-**Experience the CometChat UI Kit in action:**
+## Try It
-
-
-
-
-
+
+ Try the full chat experience in your browser
+
+
+ Fork, add your credentials, and start building
+
+---
-{/* [](https://link.cometchat.com/cometchat-demo)
-
-[](https://link.cometchat.com/react-conversation-list-message) */}
-
-
-> **Tip:** You can **fork** the sandbox, insert your **CometChat credentials** (App ID, Region, Auth Key) in the code, and immediately preview how the UI and messages respond in real time.
-
-***
-
-## **Integration**
-
-{/* ### **Option 1: UI Kit Builder (Pre-Assembled UI)**
-
-A ready-to-use chat interface—configured via a UI Kit Builder—built on top of our UI Kits.
+## Get Started
-
+
-**How It Works**
-
-* Toggle features like @mentions, reactions, media uploads, and more in a visual interface.
-* Drag-and-drop or point-and-click to enable or disable components.
-* Customize layouts and styles—no deep coding required.
-
-**Why It’s Great**
-
-* **Fastest Setup** – Minimal component wiring.
-* **Continuous Customization** – Only turn on the features you want.
-* **Fewer Moving Parts** – Reliable, pre-assembled UI that’s easy to maintain.
-
-
-
-}
- href="/ui-kit/react/builder-integration"
- horizontal
-/>
-
-}
- href="/ui-kit/react/builder-integration-nextjs"
- horizontal
-/>
-
-}
- href="/ui-kit/react/builder-integration-react-router"
- horizontal
-/>
-
+Pick your framework and follow the step-by-step integration guide:
+
+
+
+ Vite or Create React App
+
+ } href="/ui-kit/react/next-js-integration">
+ App Router with client-side rendering
+
+ } href="/ui-kit/react/react-router-integration">
+ SPA with React Router v6+
+
+ } href="/ui-kit/react/astro-integration">
+ React islands with client:only directive
+
-***
-
-### **Option 2: UI Components (Assemble It Yourself)** */}
-
-A collection of individual components—like conversation lists, message lists, message composer, etc.—each with built-in chat logic so you can customize every element.
-
-
-
-
+---
-**How It Works**
+## Explore
+
+
+
+ Browse all prebuilt UI components
+
+
+ Chat, calling, AI, and extensions
+
+
+ Colors, fonts, dark mode, and custom styling
+
+
+ Threaded messages, new chat, search, and more
+
+
-* Import the components you need from our UI Kits.
-* Arrange them in your desired layout, applying styling or customization as needed.
-* You don’t need to rewrite the SDK calls yourself—each component already integrates with CometChat logic.
+---
-**Why It’s Great**
+## Resources
-* **Flexible Design** – You control the final UI arrangement.
-* **No Extra Overhead** – Implement only the features you need.
-* **Modular** – Use exactly what you want, when you want.
-
-
-}
- href="/ui-kit/react/react-js-integration"
- horizontal
-/>
-
-}
- href="/ui-kit/react/builder-integration-nextjs"
- horizontal
-/>
-
-}
- href="/ui-kit/react/builder-integration-react-router"
- horizontal
-/>
-
-}
- href="/ui-kit/react/astro-integration"
- horizontal
-/>
-
-
-
-***
-
-## **Next Steps for Developers**
-
-1. **Learn the Basics** – [Key Concepts](/fundamentals/key-concepts).
-
-2. **Pick a Framework** – React.js or Next.js or React Router or Astro.
-
-3. **Follow the Setup Guide** –
-
- * **UI Components** – [React.js](/ui-kit/react/react-js-integration) or [Next.js](/ui-kit/react/next-js-integration) or [React Router](/ui-kit/react/react-router-integration) or [Astro](/ui-kit/react/astro-integration).
-
-4. **Customize UI** – Adjust [styles, themes](/ui-kit/react/theme), and [components](/ui-kit/react/components-overview).
-
-5. **Test & Deploy** – Run tests and launch your chat app.
-
-***
-
-## **Helpful Resources**
-
-Explore these essential resources to gain a deeper understanding of **CometChat UI Kits** and streamline your integration process.
-
-
-
-
-
- Fully functional sample applications to accelerate your development.
-
- View on GitHub
-
-
-
-
-
- Access the complete UI Kit source code on GitHub.
-
- View on GitHub
-
-
-
-
-
- UI design resources for customization and prototyping.
-
- View on Figma
-
-
-
+
+ Working reference app
+
+
+ Full UI Kit source on GitHub
+
+
+ Design resources and prototyping
+
+
+ Common issues and fixes
+
+
+ Open a support ticket
+
+
+ Upgrading from v5
+
-
-***
-
-## **Need Help?**
-
-If you need assistance, check out:
-
-* [Developer Community](http://community.cometchat.com/)
-* [Support Portal](https://help.cometchat.com/hc/en-us/requests/new)
diff --git a/ui-kit/react/property-changes.mdx b/ui-kit/react/property-changes.mdx
index 3358b3d16..e3c6c87a9 100644
--- a/ui-kit/react/property-changes.mdx
+++ b/ui-kit/react/property-changes.mdx
@@ -1,6 +1,14 @@
---
-title: "Property Changes"
+title: "Property Changes from V5 to V6"
+description: "Detailed reference of renamed, added, and removed properties and methods when upgrading from CometChat React UI Kit v5 to v6."
---
+
+- **Migration scope:** Property and method changes between v5 and v6 for all components
+- **Components affected:** Conversations, Users, Groups, Group Members, Message Header, Message List, Message Composer, Incoming Call, Outgoing Call, Call Buttons, Call Logs, CometChatLocalize
+- **Key pattern change:** `datePattern` (DatePatterns) replaced with `CalendarObject`-based props across all components
+- **Localization:** `setLocale` → `setCurrentLanguage`, `localize` → `getLocalizedString`
+- **Full migration guide:** [Upgrading from v5](/ui-kit/react/upgrading-from-v5)
+
## Conversations
@@ -92,3 +100,24 @@ title: "Property Changes"
| setDefaultLanguage | Sets the default lannguage if no language is passed in init method. |
| isRTL | Returns true if the active language is rtl otherwise return false. |
| getDir | Returns `rtl` or `ltr` based on the active language. |
+
+***
+
+## Next Steps
+
+
+
+ Full migration guide with breaking changes.
+
+
+ Explore all v6 prebuilt UI components.
+
+
+ Init, login, logout, and other UI Kit methods.
+
+
+ Subscribe to real-time events across components.
+
+
+
+***
diff --git a/ui-kit/react/react-conversation.mdx b/ui-kit/react/react-conversation.mdx
index 03ab256f4..309691b76 100644
--- a/ui-kit/react/react-conversation.mdx
+++ b/ui-kit/react/react-conversation.mdx
@@ -1,53 +1,63 @@
---
-title: "Building A Conversation List + Message View"
+title: "Conversation List + Message View"
sidebarTitle: "Conversation List + Message View"
+description: "Build a two-panel conversation list + message view layout in React.js with CometChat UI Kit."
---
-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**.
+
-This design enables users to switch between conversations effortlessly while keeping the chat window open, ensuring a **smooth, real-time messaging experience**.
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Framework | React.js |
+| Components | `CometChatConversations`, `CometChatMessageHeader`, `CometChatMessageList`, `CometChatMessageComposer` |
+| Layout | Two-panel — conversation list (left) + message view (right) |
+| Prerequisite | Complete [React.js Integration](/ui-kit/react/react-js-integration) Steps 1–5 first |
+| Pattern | WhatsApp Web, Slack, Microsoft Teams |
-[](https://link.cometchat.com/react-conversation-list-message)
-
-> **Tip:** You can **fork** the sandbox, insert your **CometChat credentials** (App ID, Region, Auth Key.) in the code, and immediately preview how the UI and messages respond in real time.
+
-***
+This guide builds a two-panel chat layout — conversation list on the left, messages on the right. Users tap a conversation to open it.
-## **User Interface Overview**
+This assumes you've already completed [React.js Integration](/ui-kit/react/react-js-integration) (project created, UI Kit installed, init + login working, CSS imported).
-This layout is structured into three key sections:
+[](https://link.cometchat.com/react-conversation-list-message)
-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.
+> Fork the sandbox, insert your CometChat credentials (App ID, Region, Auth Key), and preview the UI in real time.
-***
+---
-## **Step-by-Step Guide**
+## What You're Building
-### **Step 1: Create Sidebar**
+Three sections working together:
-Let's create the `Sidebar` component which will render different conversations.
+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
-#### **Folder Structure**
+---
-Create a `CometChatSelector` folder inside your `src` directory and add the following files:
+## Step 1 — Create the Sidebar Component
-```
-src/
-│── CometChatSelector/
-│ ├── CometChatSelector.tsx
-│ ├── CometChatSelector.css
-```
+Create a `CometChatSelector` folder inside `src/`:
+
+
+
+
+
+
+
+
+
-```tsx CometChatSelector.tsx
+```tsx title="CometChatSelector.tsx" lines
import { useEffect, useState } from "react";
import {
Conversation,
@@ -61,189 +71,167 @@ import {
} from "@cometchat/chat-uikit-react";
import "./CometChatSelector.css";
-// Define the props for the CometChatSelector component
interface SelectorProps {
onSelectorItemClicked?: (
input: User | Group | Conversation,
type: string
) => void;
- onHide?: () => void;
- onNewChatClicked?: () => void;
}
-// CometChatSelector component
export const CometChatSelector = (props: SelectorProps) => {
- // Destructure props with a default function for onSelectorItemClicked
const { onSelectorItemClicked = () => {} } = props;
-
- // State to store the logged-in user
const [loggedInUser, setLoggedInUser] = useState();
-
- // State to track the currently selected item (it can be a Conversation, User, or Group)
const [activeItem, setActiveItem] = useState<
CometChat.Conversation | CometChat.User | CometChat.Group | undefined
>();
- // useEffect hook to fetch and set the logged-in user
useEffect(() => {
- const loggedInUser = CometChatUIKitLoginListener.getLoggedInUser();
- setLoggedInUser(loggedInUser);
- }, [loggedInUser]); // Dependency on loggedInUser causes unnecessary re-renders
+ const user = CometChatUIKitLoginListener.getLoggedInUser();
+ setLoggedInUser(user);
+ }, []);
return (
<>
- {/* Render chat conversations if a user is logged in */}
{loggedInUser && (
- <>
- {
- setActiveItem(e); // Update the active item when an item is clicked
- onSelectorItemClicked(e, "updateSelectedItem"); // Notify parent component
- }}
- />
- >
+ {
+ setActiveItem(e);
+ onSelectorItemClicked(e, "updateSelectedItem");
+ }}
+ />
)}
-
>
);
};
```
-
-```css CometChatSelector.css
-/* Styles for the menu icon in the conversation header */
+```css title="CometChatSelector.css" lines
+/* Menu icon in conversation header */
.selector-wrapper .cometchat-conversations .cometchat-list__header-menu .cometchat-button__icon {
- background: var(--cometchat-icon-color-primary);
+ background: var(--cometchat-icon-color-primary);
}
-/* Change background color of the menu icon on hover */
.cometchat-conversations .cometchat-list__header-menu .cometchat-button__icon:hover {
- background: var(--cometchat-icon-color-highlight);
+ background: var(--cometchat-icon-color-highlight);
}
-/* Remove the right border from the search bar */
.cometchat-list__header-search-bar {
- border-right: none;
+ border-right: none;
}
-/* Aligns submenu list items to the left */
.cometchat .cometchat-menu-list__sub-menu-list-item {
- text-align: left;
+ text-align: left;
}
-/* Adjust the width and positioning of the conversation menu list */
.cometchat .cometchat-conversations .cometchat-menu-list__sub-menu-list {
- width: 212px;
- top: 40px !important;
- left: 172px !important;
+ width: 212px;
+ top: 40px !important;
+ left: 172px !important;
}
-/* Styles for the logged-in user section */
+/* Logged-in user section */
#logged-in-user {
- border-bottom: 2px solid var(--cometchat-border-color-default, #E8E8E8);
+ border-bottom: 2px solid var(--cometchat-border-color-default, #E8E8E8);
}
-/* Disable cursor interaction for menu items inside logged-in user section */
#logged-in-user .cometchat-menu-list__sub-menu-item-title,
#logged-in-user .cometchat-menu-list__sub-menu-list-item {
- cursor: default;
+ cursor: default;
}
-/* Background color for the logout button icon */
.cometchat-menu-list__sub-menu-list-item-icon-log-out {
- background-color: var(--cometchat-error-color, #F44649);
+ background-color: var(--cometchat-error-color, #F44649);
}
-/* Text color for the logout menu item */
.cometchat-menu-list__sub-menu-item-title-log-out {
- color: var(--cometchat-error-color, #F44649);
+ color: var(--cometchat-error-color, #F44649);
}
-/* Enable pointer cursor for menu items inside the chat menu */
.chat-menu .cometchat .cometchat-menu-list__sub-menu-item-title {
- cursor: pointer;
+ cursor: pointer;
}
-/* Remove box-shadow from submenu in the chat menu */
.chat-menu .cometchat .cometchat-menu-list__sub-menu {
- box-shadow: none;
+ box-shadow: none;
}
-/* Styles for the submenu icon inside the chat menu */
.chat-menu .cometchat .cometchat-menu-list__sub-menu-icon {
- background-color: var(--cometchat-icon-color-primary, #141414);
- width: 24px;
- height: 24px;
+ background-color: var(--cometchat-icon-color-primary, #141414);
+ width: 24px;
+ height: 24px;
}
-/* Styling for the chat selector container */
+/* Selector container */
.cometchat-selector {
- display: flex;
- width: 100%;
- padding: 0px 8px;
- align-items: flex-start;
- gap: 8px;
- border-top: 1px solid var(--cometchat-border-color-light, #F5F5F5);
- border-right: 1px solid var(--cometchat-border-color-light, #F5F5F5);
- background: var(--cometchat-background-color-01, #FFF);
+ display: flex;
+ width: 100%;
+ padding: 0px 8px;
+ align-items: flex-start;
+ gap: 8px;
+ border-top: 1px solid var(--cometchat-border-color-light, #F5F5F5);
+ border-right: 1px solid var(--cometchat-border-color-light, #F5F5F5);
+ background: var(--cometchat-background-color-01, #FFF);
}
-/* Styling for each tab inside the chat selector */
.cometchat-selector__tab {
- display: flex;
- padding: 12px 0px 10px 0px;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- gap: 4px;
- flex: 1 0 0;
- min-height: 48px;
+ display: flex;
+ padding: 12px 0px 10px 0px;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ gap: 4px;
+ flex: 1 0 0;
+ min-height: 48px;
}
-/* Styles for the active tab icon */
.cometchat-selector__tab-icon-active {
- display: flex;
- width: 32px;
- height: 32px;
- justify-content: center;
- align-items: center;
- -webkit-mask-size: contain;
- mask-size: contain;
- cursor: default;
- background: var(--cometchat-icon-color-highlight);
- -webkit-mask: url('./assets/chats.svg') no-repeat center;
- mask: url('./assets/chats.svg') no-repeat center;
+ display: flex;
+ width: 32px;
+ height: 32px;
+ justify-content: center;
+ align-items: center;
+ -webkit-mask-size: contain;
+ mask-size: contain;
+ cursor: default;
+ background: var(--cometchat-icon-color-highlight);
+ -webkit-mask: url('./assets/chats.svg') no-repeat center;
+ mask: url('./assets/chats.svg') no-repeat center;
}
-/* Styles for the active tab text */
.cometchat-selector__tab-text-active {
- text-align: center;
- font: var(--cometchat-font-caption1-medium, 500 12px Roboto);
- cursor: default;
- color: var(--cometchat-text-color-highlight);
+ text-align: center;
+ font: var(--cometchat-font-caption1-medium, 500 12px Roboto);
+ cursor: default;
+ color: var(--cometchat-text-color-highlight);
}
```
-
-### **Step 2: Update App**
+Key points about the sidebar:
+- `CometChatUIKitLoginListener.getLoggedInUser()` checks for an active session — the component only renders if a user is logged in.
+- `activeConversation` highlights the currently selected conversation in the list.
+- `onItemClick` fires when a user taps a conversation, passing the `Conversation` object to the parent.
+
+---
+
+## Step 2 — Update App.tsx and App.css
-Now we will update the `App.tsx` & `App.css` files to import these new components as below,
+Wire the sidebar and message components together in your main app file.
-```tsx App.tsx
+```tsx title="App.tsx" lines
import { useState } from "react";
import {
CometChatMessageComposer,
@@ -253,102 +241,100 @@ import {
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatSelector } from "./CometChatSelector/CometChatSelector";
import "./App.css";
-import '@cometchat/chat-uikit-react/css-variables.css';
+import "@cometchat/chat-uikit-react/css-variables.css";
function App() {
- // State to track the currently selected user
- const [selectedUser, setSelectedUser] = useState(undefined);
-
- // State to track the currently selected group
- const [selectedGroup, setSelectedGroup] = useState(undefined);
+ const [selectedUser, setSelectedUser] = useState<
+ CometChat.User | undefined
+ >(undefined);
+ const [selectedGroup, setSelectedGroup] = useState<
+ CometChat.Group | undefined
+ >(undefined);
return (
- {/* Sidebar for selecting conversations */}
+ {/* Sidebar — conversation list */}
{
let item = activeItem;
- // If the selected item is a conversation, extract the user/group from it
+ // Extract user/group from Conversation object
if (activeItem instanceof CometChat.Conversation) {
item = activeItem.getConversationWith();
}
- // Determine if the selected item is a User or a Group and update the state accordingly
if (item instanceof CometChat.User) {
setSelectedUser(item as CometChat.User);
- setSelectedGroup(undefined); // Ensure no group is selected
+ setSelectedGroup(undefined);
} else if (item instanceof CometChat.Group) {
- setSelectedUser(undefined); // Ensure no user is selected
+ setSelectedUser(undefined);
setSelectedGroup(item as CometChat.Group);
} else {
setSelectedUser(undefined);
- setSelectedGroup(undefined); // Reset if selection is invalid
+ setSelectedGroup(undefined);
}
}}
/>
- {/* If a user or group is selected, display the chat interface */}
+ {/* Message view — header + messages + composer */}
{selectedUser || selectedGroup ? (
- {/* Header displaying user/group details */}
-
- {/* List of messages for the selected user/group */}
-
- {/* Message input composer */}
-
+
) : (
- // Default message when no conversation is selected
-
Select Conversation to start
+
+ Select a conversation to start chatting
+
)}
);
-};
+}
export default App;
```
-
-```css App.css
-/* Root container settings */
+```css title="App.css" lines
+@import url("@cometchat/chat-uikit-react/css-variables.css");
+
#root {
text-align: center;
- width: 100vw; /* Full viewport width */
- height: 100vh; /* Full viewport height */
- background-color: #282c34; /* Dark background */
+ width: 100vw;
+ height: 100vh;
+ background-color: #282c34;
}
-/* Layout container for conversations and messages */
+/* Two-panel layout */
.conversations-with-messages {
display: flex;
height: 100%;
width: 100%;
- flex-direction: row; /* Horizontal layout */
+ flex-direction: row;
}
-/* Sidebar container for the conversation list */
+/* Left panel — conversation list */
.conversations-wrapper {
height: 100vh;
- width: 480px; /* Fixed width for the sidebar */
+ width: 480px;
overflow: hidden;
display: flex;
flex-direction: column;
}
-/* Prevent scrolling inside the conversation list */
.conversations-wrapper > .cometchat {
overflow: hidden;
}
-/* Main chat messages container */
+/* Right panel — messages */
.messages-wrapper {
width: 100%;
height: 100%;
@@ -356,40 +342,65 @@ export default App;
flex-direction: column;
}
-/* Styles for the placeholder when no conversation is selected */
+/* Empty state */
.empty-conversation {
height: 100vh;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
- background: var(--cometchat-background-color-03, #F5F5F5); /* Light gray background */
- color: var(--cometchat-text-color-secondary, #727272); /* Secondary text color */
+ background: var(--cometchat-background-color-03, #F5F5F5);
+ color: var(--cometchat-text-color-secondary, #727272);
font: var(--cometchat-font-body-regular, 400 14px Roboto);
}
-/* Remove border-radius for the message composer input */
.cometchat .cometchat-message-composer {
border-radius: 0px;
}
```
-
-### **Step 3: Run the project**
+How it works:
+- When a conversation is tapped, `onSelectorItemClicked` extracts the `User` or `Group` from the `Conversation` object.
+- `selectedUser` / `selectedGroup` state drives which chat is displayed — pass either `user` or `group` to the message components, never both.
+- The empty state shows until a conversation is selected.
-```powershell
-npm start
-```
+---
-***
+## Step 3 — Run the Project
-## **Next Steps**
+
+
+```bash lines
+npm run dev
+```
+
+
+```bash lines
+npm start
+```
+
+
-### **Enhance the User Experience**
+You should see the conversation list on the left. Tap any conversation to load messages on the right.
-* **[Advanced Customizations](/ui-kit/react/theme)** – Personalize the chat UI to align with your brand.
+---
-***
+## Next Steps
+
+
+
+ Customize colors, fonts, and styles to match your brand
+
+
+ Browse all prebuilt UI components
+
+
+ Back to the main setup guide
+
+
+ Chat features included out of the box
+
+
diff --git a/ui-kit/react/react-js-integration.mdx b/ui-kit/react/react-js-integration.mdx
index 55d433935..91da28f67 100644
--- a/ui-kit/react/react-js-integration.mdx
+++ b/ui-kit/react/react-js-integration.mdx
@@ -1,178 +1,110 @@
---
-title: "Getting Started With CometChat React UI Kit"
+title: "React.js Integration"
sidebarTitle: "Integration"
+description: "Add CometChat to a React.js app in 5 steps: create project, install, init, login, render."
---
-The **CometChat UI Kit for React** streamlines the integration of in-app chat functionality by providing a **comprehensive set of prebuilt UI components**. It offers seamless **theming options**, including **light and dark modes**, customizable fonts, colors, and extensive styling capabilities.
+
-With built-in support for **one-to-one and group conversations**, developers can efficiently enable chat features within their applications. Follow this guide to **quickly integrate chat functionality** using the CometChat React UI Kit.
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Peer deps | `react` >=18, `react-dom` >=18, `rxjs` ^7.8.1 |
+| Init | `CometChatUIKit.init(UIKitSettings)` — must resolve before `login()` |
+| Login | `CometChatUIKit.login("UID")` — must resolve before rendering components |
+| Order | `init()` → `login()` → render. Breaking this order = blank screen |
+| Auth Key | Dev/testing only. Use Auth Token in production |
+| CSS | `@import url("@cometchat/chat-uikit-react/css-variables.css");` in global CSS |
+| Calling | Optional. Install `@cometchat/calls-sdk-javascript` to enable |
+| Other frameworks | [Next.js](/ui-kit/react/next-js-integration) · [React Router](/ui-kit/react/react-router-integration) · [Astro](/ui-kit/react/astro-integration) |
-{/*
-
- */}
+
+
+This guide walks you through adding CometChat to a React.js app. By the end you'll have a working chat UI.
-***
-
-## **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**.
-
-🔗 **[Click here to Sign Up](https://app.cometchat.com/login)**
-
-### **Step 2: Get Your Application Keys**
-
-After registering, create a **new app** and retrieve your **authentication details**:
-
-1. Navigate to **Application**, then select the **Credentials** section.
-
-2. Note down the following keys:
-
- * **App ID**
- * **Auth Key**
- * **Region**
-
-
-
-Each CometChat application can be integrated with a **single client app**. Users within the same application can communicate across multiple platforms, including **web and mobile**.
-
-
-
-### **Step 3: Set Up Your Development Environment**
-
-Ensure your system meets the following **prerequisites** before proceeding with integration.
-
-**System Requirements:**
-
-* **Node.js** installed on your machine.
-* A code editor like **[Visual Studio Code](https://code.visualstudio.com/)** or **[Cursor](https://www.cursor.com/)**.
-* **npm** or **Yarn** package manager installed.
-
-***
+---
-## **Built With**
+## Prerequisites
-The CometChat UI Kit for React relies on the following technologies:
+You need three things from the [CometChat Dashboard](https://app.cometchat.com/):
-| Technology | Description |
-| ---------------------------------------------------- | ------------------------------------- |
-| [Node.js](https://nodejs.org/) | JavaScript runtime environment |
-| [npm](https://www.npmjs.com/get-npm) | Node Package Manager |
-| [React](https://www.npmjs.com/package/react) | JavaScript library for UI development |
-| [React DOM](https://www.npmjs.com/package/react-dom) | React package for rendering UI |
+| Credential | Where to find it |
+| --- | --- |
+| App ID | Dashboard → Your App → Credentials |
+| Auth Key | Dashboard → Your App → Credentials |
+| Region | Dashboard → Your App → Credentials (e.g. `us`, `eu`, `in`) |
-***
+You also need Node.js (v16+) and npm/yarn installed.
-## **Getting Started**
+
+Auth Key is for development only. In production, generate Auth Tokens server-side via the [REST API](https://api-explorer.cometchat.com/) and use [`loginWithAuthToken()`](/ui-kit/react/methods#login-using-auth-token). Never ship Auth Keys in client code.
+
-### **Step 1: Create a React Project**
+---
-1. **Open your code editor** (e.g., **VS Code**, **Cursor**).
-2. **Initialize a new React project** using one of the following methods:
+## Step 1 — Create a React Project
-
-**Using Vite (Recommended)**
-
-```
-npm create vite@latest my-app --template react-ts
+
+```bash lines
+npm create vite@latest my-app -- --template react-ts
cd my-app
```
-
-
-
-**Using Create React App**
-
-```
+
+```bash lines
npx create-react-app my-app --template typescript
cd my-app
```
-
-
-3. **Open the project directory in your code editor**.
-4. **Start developing your React components inside the src directory**.
-5. **Install additional dependencies as needed**.
-
-***
-
-### **Step 2: Install Dependencies**
-
-The **CometChat UI Kit for React** is an **extension** of the **CometChat JavaScript SDK**.\
-Installing it will **automatically** include the core **Chat SDK**, enabling **seamless integration**.
+---
-* To install the **CometChat UI Kit**
+## Step 2 — Install the UI Kit
-```
+```bash lines
npm install @cometchat/chat-uikit-react
```
-
-
-```
+```bash lines
yarn add @cometchat/chat-uikit-react
```
-
-
-***
+This installs the UI Kit and its dependency `@cometchat/chat-sdk-javascript` automatically.
-### **Step 3: Initialize CometChat UI Kit**
+If you want voice/video calling, also install:
-Before using any features of the **CometChat UI Kit** or **CometChat SDK**, you must **initialize** the required settings. This is done using the [`Init`](/ui-kit/react/methods#init) method.
-
-* Initialization Process
-
-Call the `Init` method at the **beginning of your application** to ensure all CometChat functionalities are properly configured.
-
-***
+```bash lines
+npm install @cometchat/calls-sdk-javascript
+```
-
-**Auth Key Usage**
+---
-The **Auth Key** is an **optional property** of the `UIKitSettings` class. It is primarily recommended for **proof-of-concept (POC) development** or **early-stage application development**.
+## Step 3 — Initialize CometChat
-For secure authentication, use the [`Auth Token`](/ui-kit/react/methods#login-using-auth-token) method instead.
+Create a constants file and initialize the UI Kit before anything else.
-
+```ts title="src/AppConstants.ts" lines
+export const COMETCHAT_CONSTANTS = {
+ APP_ID: "APP_ID", // Replace with your App ID
+ REGION: "REGION", // Replace with your Region
+ AUTH_KEY: "AUTH_KEY", // Replace with your Auth Key (dev only)
+};
+```
-```ts
+```ts lines highlight={7-9}
import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
/**
@@ -184,35 +116,24 @@ const COMETCHAT_CONSTANTS = {
AUTH_KEY: "AUTH_KEY", // Replace with your Auth Key (leave blank if using Auth Token)
};
-/**
- * Configure the CometChat UI Kit using the UIKitSettingsBuilder.
- * This setup determines how the chat UI behaves.
- */
const UIKitSettings = new UIKitSettingsBuilder()
- .setAppId(COMETCHAT_CONSTANTS.APP_ID) // Assign the App ID
- .setRegion(COMETCHAT_CONSTANTS.REGION) // Assign the App's Region
- .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY) // Assign the Authentication Key (if applicable)
- .subscribePresenceForAllUsers() // Enable real-time presence updates for all users
- .build(); // Build the final configuration
+ .setAppId(COMETCHAT_CONSTANTS.APP_ID)
+ .setRegion(COMETCHAT_CONSTANTS.REGION)
+ .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
+ .subscribePresenceForAllUsers()
+ .build();
-/**
- * Initialize the CometChat UI Kit with the configured settings.
- * Once initialized successfully, you can proceed with user authentication and chat features.
- */
-CometChatUIKit.init(UIKitSettings)!
+CometChatUIKit.init(UIKitSettings)
.then(() => {
console.log("CometChat UI Kit initialized successfully.");
- // You can now call login function to authenticate users
})
.catch((error) => {
- console.error("CometChat UI Kit initialization failed:", error); // Log errors if initialization fails
+ console.error("CometChat UI Kit initialization failed:", error);
});
```
-
-
-```js
+```js lines highlight={7-9}
import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
/**
@@ -224,92 +145,49 @@ const COMETCHAT_CONSTANTS = {
AUTH_KEY: "AUTH_KEY", // Replace with your Auth Key (leave blank if using Auth Token)
};
-/**
- * Configure the CometChat UI Kit using the UIKitSettingsBuilder.
- * This setup determines how the chat UI behaves.
- */
const UIKitSettings = new UIKitSettingsBuilder()
- .setAppId(COMETCHAT_CONSTANTS.APP_ID) // Assign the App ID
- .setRegion(COMETCHAT_CONSTANTS.REGION) // Assign the App's Region
- .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY) // Assign the Authentication Key (if applicable)
- .subscribePresenceForAllUsers() // Enable real-time presence updates for all users
- .build(); // Build the final configuration
+ .setAppId(COMETCHAT_CONSTANTS.APP_ID)
+ .setRegion(COMETCHAT_CONSTANTS.REGION)
+ .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
+ .subscribePresenceForAllUsers()
+ .build();
-/**
- * Initialize the CometChat UI Kit with the configured settings.
- * Once initialized successfully, you can proceed with user authentication and chat features.
- */
CometChatUIKit.init(UIKitSettings)
.then(() => {
console.log("CometChat UI Kit initialized successfully.");
- // You can now call login function to authenticate users
})
.catch((error) => {
- console.error("CometChat UI Kit initialization failed:", error); // Log errors if initialization fails
+ console.error("CometChat UI Kit initialization failed:", error);
});
```
-
-
-
-
-Ensure you replace the following placeholders with your actual CometChat credentials:
-
-* APP\_ID → Your CometChat App ID
-* AUTH\_KEY → Your CometChat Auth Key
-* REGION → Your App Region
-
-These values are required for proper authentication and seamless integration.
-
-
+
+`init()` must resolve before you call `login()`. If you call `login()` before init completes, it will fail silently.
+
-
-You can choose between different storage methods to store data. By default, we use local storage. To learn more about available storage options and how to configure them, [click here](/ui-kit/react/methods#setting-session-storage-mode).
-
+By default, session data is stored in `localStorage`. To use `sessionStorage` instead, see [Setting Session Storage Mode](/ui-kit/react/methods#setting-session-storage-mode).
-***
-
-### **Step 4: User Login**
-
-To authenticate a user, you need a **`UID`**. You can either:
-
-1. **Create new users** on the **[CometChat Dashboard](https://app.cometchat.com)**, **[CometChat SDK Method](/ui-kit/react/methods#create-user)** or **[via the API](https://api-explorer.cometchat.com/reference/creates-user)**.
-
-2. **Use pre-generated test users**:
-
- * `cometchat-uid-1`
- * `cometchat-uid-2`
- * `cometchat-uid-3`
- * `cometchat-uid-4`
- * `cometchat-uid-5`
-
-The **Login** method returns a **User object** containing all relevant details of the logged-in user.
-
-***
-
-
+---
-**Security Best Practices**
+## Step 4 — Login
-* The **Auth Key** method is recommended for **proof-of-concept (POC) development** and early-stage testing.
-* For **production environments**, it is strongly advised to use an **[Auth Token](/ui-kit/react/methods#login-using-auth-token)** instead of an **Auth Key** to enhance security and prevent unauthorized access.
+After init resolves, log the user in. For development, use one of the pre-created test UIDs:
-
+`cometchat-uid-1` · `cometchat-uid-2` · `cometchat-uid-3` · `cometchat-uid-4` · `cometchat-uid-5`
-```ts
+```ts lines highlight={3}
import { CometChatUIKit } from "@cometchat/chat-uikit-react";
const UID = "UID"; // Replace with your actual UID
CometChatUIKit.getLoggedinUser().then((user: CometChat.User | null) => {
if (!user) {
- // If no user is logged in, proceed with login
CometChatUIKit.login(UID)
.then((user: CometChat.User) => {
console.log("Login Successful:", { user });
@@ -317,22 +195,19 @@ CometChatUIKit.getLoggedinUser().then((user: CometChat.User | null) => {
})
.catch(console.log);
} else {
- // If user is already logged in, mount your app
+ // Already logged in — mount your app
}
});
```
-
-
-```js
+```js lines highlight={3}
import { CometChatUIKit } from "@cometchat/chat-uikit-react";
const UID = "UID"; // Replace with your actual UID
CometChatUIKit.getLoggedinUser().then((user) => {
if (!user) {
- // If no user is logged in, proceed with login
CometChatUIKit.login(UID)
.then((user) => {
console.log("Login Successful:", { user });
@@ -340,164 +215,152 @@ CometChatUIKit.getLoggedinUser().then((user) => {
})
.catch(console.log);
} else {
- // If user is already logged in, mount your app
+ // Already logged in — mount your app
}
});
```
-
-
-***
+Key points:
+- `getLoggedinUser()` checks for an existing session so you don't re-login unnecessarily.
+- `login(uid)` skips the API call if a session already exists and returns the cached user.
+- Components must not render until login resolves — use a state flag to gate rendering.
-### **Step 5: Choose a Chat Experience**
+
+For production, use [`loginWithAuthToken()`](/ui-kit/react/methods#login-using-auth-token) instead of Auth Key. Generate tokens server-side via the REST API.
+
+
+---
-Integrate a conversation view that suits your application's **UX requirements**. Below are the available options:
+## Step 5 — Add the CSS Import
-***
+Add this line at the top of your global CSS file (e.g. `src/App.css` or `src/index.css`):
-#### **1️⃣ Conversation List + Message View**
+```css title="src/App.css" lines
+@import url("@cometchat/chat-uikit-react/css-variables.css");
+```
+
+Without this import, components will render with broken or missing styles.
+
+---
-**Best for:** Applications that need a **two-panel layout**, such as web-based chat interfaces (e.g., WhatsApp Web, Slack).
+## Step 6 — Choose a Chat Experience
-**Features:**
+Integrate a conversation view that suits your app's UX. Each option below includes a live CodeSandbox demo and a step-by-step guide.
-* **Two-panel layout** – Displays the conversation list on the left and the active chat window on the right.
-* **One-to-one & group conversations** – Seamless switching between private and group chats.
-* **Multiple conversations** – Effortlessly switch between different chat windows.
-* **Easy navigation** – Intuitive UI for finding and accessing chats quickly.
-* **Tap-to-view on mobile** – In mobile layouts, tapping a conversation opens the **Message View**, optimizing space.
-* **Real-time updates** – Auto-refreshes messages and conversation lists.
-* **Message sync** – Ensures messages stay updated across all sessions and devices.
+### Conversation List + Message View
+
+Two-panel layout — conversation list on the left, messages on the right. Think WhatsApp Web or Slack.
+
+- 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:**
-
-* 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**
-
[](https://link.cometchat.com/react-conversation-list-message)
-> **Tip:** You can **fork** the sandbox, insert your **CometChat credentials** (App ID, Region, Auth Key.) in the code, and immediately preview how the UI and messages respond in real time.
+> **Tip:** Fork the sandbox, insert your CometChat credentials (App ID, Region, Auth Key), and preview the UI in real time.
-[Integrate Conversation List + Message](./react-conversation)
+
+ Step-by-step guide to build this layout
+
-***
-
-#### **2️⃣ One-to-One/Group Chat**
+---
-**Best for:** Apps that require a **focused, direct messaging experience** without a sidebar.
+### One-to-One / Group Chat
-**Features:**
+Single chat window — no sidebar. Good for support chat, embedded widgets, or focused messaging.
-* **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.**
+- Dedicated chat window for one-on-one or group messaging
+- No conversation list — users go directly into the chat
+- Full-screen experience optimized for mobile
+- Ideal for support chat or community messaging
-**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.
-
[](https://link.cometchat.com/react-one-on-one)
-> **Tip:** You can **fork** the sandbox, insert your **CometChat credentials** (App ID, Region, Auth Key.) in the code, and immediately preview how the UI and messages respond in real time.
-
-[Integrate One-to-One/Group Chat](./react-one-to-one-chat)
+> **Tip:** Fork the sandbox, insert your CometChat credentials (App ID, Region, Auth Key), and preview the UI in real time.
-***
+
+ Step-by-step guide to build this layout
+
-#### **3️⃣ Tab-Based Chat Experience**
+---
-**Best for:** Apps that need a **structured, multi-feature navigation system** for seamless interaction between **chats, calls, users, and settings**.
+### Tab-Based Chat
-**Features:**
+Tabbed navigation — Chat, Call Logs, Users, Settings in separate tabs. Good for full-featured apps.
-* **Tab Navigation** – Easily switch between **Chat, Call Logs, Users, and Settings**.
-* **Dedicated Chat Window** – Full-screen messaging experience for focused communication.
-* **No Sidebar** – Unlike multi-panel UI, this design prioritizes individual interactions.
-* **Unified Experience** – Users can seamlessly manage conversations, call history, and settings from a single interface.
-* **Scalable for future features** – Easily extend to include more functionalities such as notifications or contact management.
-* **Optimized for both desktop and mobile** – Ensures a smooth experience across different screen sizes.
+- Tab navigation between Chat, Call Logs, Users, and Settings
+- Full-screen messaging within each tab
+- Unified experience for conversations, call history, and settings
+- Scales well for adding future features like notifications or contacts
-**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.
-
[](https://link.cometchat.com/react-tabs-sidebar-message)
-> **Tip:** You can **fork** the sandbox, insert your **CometChat credentials** (App ID, Region, Auth Key.) in the code, and immediately preview how the UI and messages respond in real time.
-
-[Integrate Tab-Based Chat](./react-tab-based-chat)
-
-***
+> **Tip:** Fork the sandbox, insert your CometChat credentials (App ID, Region, Auth Key), and preview the UI in real time.
-## **Build Your Own Chat Experience**
+
+ Step-by-step guide to build this layout
+
-**Best for:** Developers who need complete control over their chat interface, allowing customization of components, themes, and features to align with their app’s design and functionality. Whether you're enhancing an existing chat experience or building from scratch, this approach provides the flexibility to tailor every aspect to your needs.
-
-**Recommended for:**
+---
-* Apps that require **a fully customized chat experience**.
-* Developers who want to **extend functionalities and modify UI components**.
-* Businesses integrating chat seamlessly into **existing platforms**.
+## Build Your Own Chat Experience
-**Key Areas to Explore:**
+Need full control over the UI? Use individual components, customize themes, and wire up your own layouts.
-* **[React Sample App](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app)** – Fully functional sample applications to accelerate your development.
-* **[Core Features](./core-features)** – Learn about messaging, real-time updates, and other essential capabilities.
-* **[Components](./components-overview)** – Utilize prebuilt UI elements or customize them to fit your design.
-* **[Themes](./theme)** – Adjust colors, fonts, and styles to match your branding.
-* **[Build Your Own UI](./../../../sdk/javascript/overview)** – Prefer a custom UI over our UI Kits? Explore our SDKs to create a tailored chat experience.
+- [Sample App](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app) — Working reference app to compare against
+- [Components](/ui-kit/react/components-overview) — All prebuilt UI elements with props and customization options
+- [Core Features](/ui-kit/react/core-features) — Messaging, real-time updates, and other capabilities
+- [Theming](/ui-kit/react/theme) — Colors, fonts, dark mode, and custom styling
+- [Build Your Own UI](/sdk/javascript/overview) — Skip the UI Kit entirely and build on the raw SDK
-***
+---
-## iFrame Support
+## iFrame Embedding
-If you’re embedding your React app inside an `
) : (
-
Please set a user or group in App.tsx.
+
+ Set a user or group UID in App.tsx to start chatting
+
)}
>
);
-};
+}
export default App;
```
-
-```css App.css
+```css title="App.css" lines
+@import url("@cometchat/chat-uikit-react/css-variables.css");
+
#root {
text-align: center;
width: 100vw;
@@ -128,25 +115,6 @@ export default App;
background-color: #282c34;
}
-.conversations-with-messages {
- display: flex;
- height: 100%;
- width: 100%;
- flex-direction: row;
-}
-
-.conversations-wrapper {
- height: 100vh;
- width: 480px;
- overflow: hidden;
- display: flex;
- flex-direction: column;
-}
-
-.conversations-wrapper>.cometchat {
- overflow: hidden;
-}
-
.messages-wrapper {
width: 100%;
height: 100vh;
@@ -171,41 +139,63 @@ export default App;
```
-
-In the code snippet above, ensure you select either a user or a group based on your chat requirement. You can also determine this dynamically depending on the conversation type.
+Key points:
+- `CometChat.getUser(UID)` fetches the user object from the SDK — you need a real user object, not a manually constructed one.
+- Pass either `user` or `group` to the message components, never both.
+- The highlighted lines show where to set the UID or swap to group chat.
-#### **Fetching a User (One-on-One Chat)**
+---
-```tsx
-const UID = "cometchat-uid-1";
-CometChat.getUser(UID)
- .then(user => setSelectedUser(user))
- .catch(error => console.error("Failed to fetch user:", error));
-```
+## Switching Between User and Group Chat
-#### **Fetching a Group (Group Chat)**
+To load a group chat instead of one-to-one, replace the `getUser` call with `getGroup`:
+
+```tsx lines highlight={1}
+const GUID = "GUID"; // Replace with your actual Group ID
-```tsx
-const GUID = "GUID";
CometChat.getGroup(GUID)
- .then(group => setSelectedGroup(group))
- .catch(error => console.error("Failed to fetch group:", error));
+ .then((group) => setSelectedGroup(group))
+ .catch((error) => console.error("Failed to fetch group:", error));
```
-***
+You can also determine this dynamically — for example, based on a route parameter or a selection from another part of your app.
+
+---
-### **Step 4: Run the project**
+## Step 2 — Run the Project
-```powershell
+
+
+```bash lines
+npm run dev
+```
+
+
+```bash lines
npm start
```
+
+
-## **Next Steps**
-
-### **Enhance the User Experience**
+You should see the chat window load with the conversation for the UID you set.
-* **[Advanced Customizations](/ui-kit/react/theme)** – Personalize the chat UI to align with your brand.
+---
-***
+## Next Steps
+
+
+
+ Customize colors, fonts, and styles to match your brand
+
+
+ Browse all prebuilt UI components
+
+
+ Back to the main setup guide
+
+
+ Chat features included out of the box
+
+
diff --git a/ui-kit/react/react-router-conversation.mdx b/ui-kit/react/react-router-conversation.mdx
index 8b90fa5f5..dac291a5f 100644
--- a/ui-kit/react/react-router-conversation.mdx
+++ b/ui-kit/react/react-router-conversation.mdx
@@ -1,212 +1,201 @@
---
-title: "Building A Conversation List + Message View"
+title: "Conversation List + Message View"
sidebarTitle: "Conversation List + Message View"
+description: "Build a two-panel conversation list + message view layout in React Router with CometChat UI Kit."
---
-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**.
+
-This design enables users to switch between conversations effortlessly while keeping the chat window open, ensuring a **smooth, real-time messaging experience**.
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Framework | React Router |
+| Components | `CometChatConversations`, `CometChatMessageHeader`, `CometChatMessageList`, `CometChatMessageComposer` |
+| Layout | Two-panel — conversation list (left) + message view (right) |
+| Prerequisite | Complete [React Router Integration](/ui-kit/react/react-router-integration) Steps 1–5 first |
+| SSR | Lazy import + mounted check — CometChat requires browser APIs |
+| Pattern | WhatsApp Web, Slack, Microsoft Teams |
-***
+
-## **User Interface Overview**
+This guide builds a two-panel chat layout — conversation list on the left, messages on the right. Users tap a conversation to open it.
+
+This assumes you've already completed [React Router Integration](/ui-kit/react/react-router-integration) (project created, UI Kit installed, CSS imported).
-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)
+
+
+
+
+
+
+
+
+
+
-```tsx CometChatSelector.tsx
+```tsx title="CometChatSelector.tsx" lines
import { useEffect, useState } from "react";
-import { Conversation, Group, User } from "@cometchat/chat-sdk-javascript";
+import { Conversation, Group, User, CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatConversations, CometChatUIKitLoginListener } from "@cometchat/chat-uikit-react";
-import { CometChat } from '@cometchat/chat-sdk-javascript';
import "./CometChatSelector.css";
-// Define props interface for component
interface SelectorProps {
- onSelectorItemClicked?: (input: User | Group | Conversation, type: string) => void;
+ onSelectorItemClicked?: (input: User | Group | Conversation, type: string) => void;
}
-// CometChatSelector component definition
export const CometChatSelector = (props: SelectorProps) => {
- const {
- onSelectorItemClicked = () => { }, // Default function if no prop is provided
- } = props;
-
- // State to store the currently logged-in user
- const [loggedInUser, setLoggedInUser] = useState();
-
- // State to track the currently selected item (conversation, user, group, or call)
- const [activeItem, setActiveItem] = useState<
- CometChat.Conversation | CometChat.User | CometChat.Group | CometChat.Call | undefined
- >();
-
- useEffect(() => {
- // Retrieve the logged-in user from CometChat's login listener
- let loggedInUser = CometChatUIKitLoginListener.getLoggedInUser();
- setLoggedInUser(loggedInUser);
- }, [CometChatUIKitLoginListener?.getLoggedInUser()]); // Dependency array to trigger effect when user changes
-
- return (
- <>
- {/* Render CometChatConversations only if a user is logged in */}
- {loggedInUser && (
- <>
- {
- setActiveItem(e); // Update the selected item state
- onSelectorItemClicked(e, "updateSelectedItem"); // Trigger callback with selected item
- }}
- />
- >
- )}
- >
- );
-};
+ const { onSelectorItemClicked = () => {} } = props;
+ const [loggedInUser, setLoggedInUser] = useState();
+ const [activeItem, setActiveItem] = useState<
+ CometChat.Conversation | CometChat.User | CometChat.Group | undefined
+ >();
+
+ useEffect(() => {
+ const user = CometChatUIKitLoginListener.getLoggedInUser();
+ setLoggedInUser(user);
+ }, []);
+
+ return (
+ <>
+ {loggedInUser && (
+ {
+ setActiveItem(e);
+ onSelectorItemClicked(e, "updateSelectedItem");
+ }}
+ />
+ )}
+ >
+ );
+};
```
-
-```css CometChatSelector.css
-/* Style for the icon in the header menu of the conversation list */
+```css title="CometChatSelector.css" lines
.selector-wrapper .cometchat-conversations .cometchat-list__header-menu .cometchat-button__icon {
- background: var(--cometchat-icon-color-primary);
+ background: var(--cometchat-icon-color-primary);
}
-/* Change background color of icon on hover */
.cometchat-conversations .cometchat-list__header-menu .cometchat-button__icon:hover {
- background: var(--cometchat-icon-color-highlight);
+ background: var(--cometchat-icon-color-highlight);
}
-/* Remove the right border from the search bar */
.cometchat-list__header-search-bar {
- border-right: none;
+ border-right: none;
}
-/* Align submenu items to the left */
.cometchat .cometchat-menu-list__sub-menu-list-item {
- text-align: left;
+ text-align: left;
}
-/* Set specific width and positioning for submenu list */
.cometchat .cometchat-conversations .cometchat-menu-list__sub-menu-list {
- width: 212px;
- top: 40px !important;
- left: 172px !important;
+ width: 212px;
+ top: 40px !important;
+ left: 172px !important;
}
-/* Style the logged-in user section with a bottom border */
#logged-in-user {
- border-bottom: 2px solid var(--cometchat-border-color-default, #E8E8E8);
+ border-bottom: 2px solid var(--cometchat-border-color-default, #E8E8E8);
}
-/* Prevent cursor interaction on logged-in user menu items */
#logged-in-user .cometchat-menu-list__sub-menu-item-title,
#logged-in-user .cometchat-menu-list__sub-menu-list-item {
- cursor: default;
+ cursor: default;
}
-/* Style for logout icon with error color */
.cometchat-menu-list__sub-menu-list-item-icon-log-out {
- background-color: var(--cometchat-error-color, #F44649);
+ background-color: var(--cometchat-error-color, #F44649);
}
-/* Style for logout text with error color */
.cometchat-menu-list__sub-menu-item-title-log-out {
- color: var(--cometchat-error-color, #F44649);
+ color: var(--cometchat-error-color, #F44649);
}
-/* Allow pointer interaction on submenu items inside chat menu */
.chat-menu .cometchat .cometchat-menu-list__sub-menu-item-title {
- cursor: pointer;
+ cursor: pointer;
}
-/* Remove shadow from submenu inside chat menu */
.chat-menu .cometchat .cometchat-menu-list__sub-menu {
- box-shadow: none;
+ box-shadow: none;
}
-/* Style for submenu icons inside chat menu */
.chat-menu .cometchat .cometchat-menu-list__sub-menu-icon {
- background-color: var(--cometchat-icon-color-primary, #141414);
- width: 24px;
- height: 24px;
+ background-color: var(--cometchat-icon-color-primary, #141414);
+ width: 24px;
+ height: 24px;
}
```
-
-### **Step 2: Render Experience**
+---
-Now we will create the `CometChatNoSSR.tsx` & `CometChatNoSSR.css` files. Here, we will initialize the CometChat UI Kit, log in a user, and build the messaging experience using `CometChatMessageHeader`, `CometChatMessageList`, and `CometChatMessageComposer` components.
+## Step 2 — Create the CometChatNoSSR Component
-```swift
-src/app/
-│── CometChatNoSSR/
-│ ├── CometChatNoSSR.tsx
-│ ├── CometChatNoSSR.css
-```
+This component handles init, login, and renders the full chat experience. It runs client-side only.
+
+
+
+
+
+
+
+
+
+
+
-```tsx CometChatNoSSR.tsx
+```tsx title="CometChatNoSSR.tsx" lines highlight={14-16, 19}
import React, { useEffect, useState } from "react";
import {
CometChatMessageComposer,
CometChatMessageHeader,
CometChatMessageList,
CometChatUIKit,
- UIKitSettingsBuilder
+ UIKitSettingsBuilder,
} from "@cometchat/chat-uikit-react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatSelector } from "../CometChatSelector/CometChatSelector";
import "./CometChatNoSSR.css";
const COMETCHAT_CONSTANTS = {
- APP_ID: "",
- REGION: "",
- AUTH_KEY: "",
+ APP_ID: "", // Replace with your App ID
+ REGION: "", // Replace with your Region
+ AUTH_KEY: "", // Replace with your Auth Key (dev only)
};
+const UID = "cometchat-uid-1"; // Replace with your actual UID
+
const CometChatNoSSR: React.FC = () => {
const [initialized, setInitialized] = useState(false);
const [user, setUser] = useState(null);
@@ -214,7 +203,7 @@ const CometChatNoSSR: React.FC = () => {
const [selectedGroup, setSelectedGroup] = useState();
useEffect(() => {
- if (typeof window === 'undefined') return;
+ if (typeof window === "undefined") return;
const UIKitSettings = new UIKitSettingsBuilder()
.setAppId(COMETCHAT_CONSTANTS.APP_ID)
@@ -227,10 +216,9 @@ const CometChatNoSSR: React.FC = () => {
?.then(() => {
console.log("Initialization completed successfully");
setInitialized(true);
-
CometChatUIKit.getLoggedinUser().then((loggedInUser) => {
if (!loggedInUser) {
- CometChatUIKit.login("cometchat-uid-1")
+ CometChatUIKit.login(UID)
.then((u) => {
console.log("Login Successful", { u });
setUser(u);
@@ -258,7 +246,6 @@ const CometChatNoSSR: React.FC = () => {
if (activeItem instanceof CometChat.Conversation) {
item = activeItem.getConversationWith();
}
-
if (item instanceof CometChat.User) {
setSelectedUser(item);
setSelectedGroup(undefined);
@@ -280,7 +267,7 @@ const CometChatNoSSR: React.FC = () => {
) : (
-
Select Conversation to start
+
Select a conversation to start chatting
)}
);
@@ -290,71 +277,64 @@ export default CometChatNoSSR;
```
-
-```css CometChatNoSSR.css
-/* Layout for the main conversations and messages container */
+```css title="CometChatNoSSR.css" lines
.conversations-with-messages {
- display: flex;
- height: 100%;
- width: 100%;
+ display: flex;
+ height: 100%;
+ width: 100%;
}
-/* Sidebar wrapper for conversations */
.conversations-wrapper {
- height: 100%;
- width: 480px; /* Fixed width for conversation list */
- overflow: hidden;
- display: flex;
- flex-direction: column;
- height: inherit;
+ height: 100%;
+ width: 480px;
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+ height: inherit;
}
-/* Hide overflow for the conversation list */
.conversations-wrapper > .cometchat {
- overflow: hidden;
+ overflow: hidden;
}
-/* Message section layout */
.messages-wrapper {
- width: calc(100% - 480px); /* Take remaining space */
- height: 100%;
- display: flex;
- flex-direction: column;
+ width: calc(100% - 480px);
+ height: 100%;
+ display: flex;
+ flex-direction: column;
}
-/* Display styling for when no conversation is selected */
.empty-conversation {
- height: 100%;
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- background: white;
- color: var(--cometchat-text-color-secondary, #727272);
- font: var(--cometchat-font-body-regular, 400 14px Roboto);
+ height: 100%;
+ width: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ background: white;
+ color: var(--cometchat-text-color-secondary, #727272);
+ font: var(--cometchat-font-body-regular, 400 14px Roboto);
}
-/* Ensure message composer does not have rounded corners */
.cometchat .cometchat-message-composer {
- border-radius: 0px;
+ border-radius: 0px;
}
```
-
-### **Step 3: Disable SSR and Render the CometChat Component**
+---
+
+## Step 3 — Disable SSR and Add the Route
-Create a file CometChat.tsx inside the routes folder:
+Create `CometChat.tsx` inside the `routes` folder. This uses lazy loading and a mounted check to ensure CometChat only runs client-side.
-```javascript
+```tsx title="routes/CometChat.tsx" lines
import React, { lazy, Suspense, useEffect, useState } from "react";
import "@cometchat/chat-uikit-react/css-variables.css";
-// Lazy import to prevent SSR crash
const CometChatNoSSR = lazy(() => import("../CometChatNoSSR/CometChatNoSSR"));
export default function CometChatRoute() {
@@ -374,101 +354,58 @@ export default function CometChatRoute() {
}
```
-Now, create a route for CometChat in your routes file:
+Add the route to your routes config:
-```typescript
+```ts title="routes.ts" lines
import { type RouteConfig, index, route } from "@react-router/dev/routes";
export default [
index("routes/home.tsx"),
- route("chat", "routes/CometChat.tsx"), // Chat Route
+ route("chat", "routes/CometChat.tsx"),
] satisfies RouteConfig;
```
-
-
-Why disable SSR? CometChat UI Kit Builder relies on browser APIs such as window, document, and WebSockets. Since React Router renders on the server by default, disabling SSR for this component prevents runtime errors.
-
-
+CometChat depends on browser APIs (`window`, `WebSocket`, `document`). The lazy import + mounted check ensures the component only renders on the client.
-### **Step 4: Update App CSS**
-
-Next, add the following styles to app.css to ensure CometChat UI Kit is properly styled.
-
-```css app.css
-:root {
- --background: #ffffff;
- --foreground: #171717;
-}
-
-@media (prefers-color-scheme: dark) {
- :root {
- --background: #0a0a0a;
- --foreground: #ededed;
- }
-}
-
-/** Give your App a height of `100%`. Keep other CSS properties in the below selector as it is. */
-.root {
- height: 100%;
-}
-
-html,
-body {
- height: 100%;
-}
-
-html,
-body {
- max-width: 100vw;
- overflow-x: hidden;
-}
-
-body {
- color: var(--foreground);
- background: var(--background);
- font-family: Arial, Helvetica, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
+---
-* {
- box-sizing: border-box;
- padding: 0;
- margin: 0;
-}
+## Step 4 — Run the Project
-a {
- color: inherit;
- text-decoration: none;
-}
-
-@media (prefers-color-scheme: dark) {
- html {
- color-scheme: dark;
- }
-}
+
+
+```bash lines
+npm run dev
```
+
+
+```bash lines
+pnpm dev
+```
+
+
+```bash lines
+yarn dev
+```
+
+
-### **Step 5: Run Your Application**
-
-1. **Start the development server**
-
- ```
- npm run dev
- ```
-
-2. **Verify the chat interface**
-
-* In your browser, navigate to the `/chat` route `(e.g., http://localhost:3000/chat)`.
-* Confirm that the chat experience loads as expected.
-
-***
-
-## **Next Steps**
-
-### **Enhance the User Experience**
+Navigate to `/chat` (e.g. `http://localhost:5173/chat`). You should see the conversation list on the left. Tap any conversation to load messages on the right.
-* **[Advanced Customizations](/ui-kit/react/theme)** – Personalize the chat UI to align with your brand.
+---
-***
+## Next Steps
+
+
+
+ Customize colors, fonts, and styles to match your brand
+
+
+ Browse all prebuilt UI components
+
+
+ Back to the main setup guide
+
+
+ Chat features included out of the box
+
+
\ No newline at end of file
diff --git a/ui-kit/react/react-router-integration.mdx b/ui-kit/react/react-router-integration.mdx
index af2432431..8c2eb7d5b 100644
--- a/ui-kit/react/react-router-integration.mdx
+++ b/ui-kit/react/react-router-integration.mdx
@@ -1,135 +1,91 @@
---
-title: "Getting Started With CometChat React UI Kit For React Router"
+title: "React Router Integration"
sidebarTitle: "Integration"
+description: "Add CometChat to a React Router app in 5 steps: create project, install, init, login, render."
---
-The **CometChat UI Kit for React** streamlines the integration of in-app chat functionality by providing a **comprehensive set of prebuilt UI components**. It offers seamless **theming options**, including **light and dark modes**, customizable fonts, colors, and extensive styling capabilities.
+
-With built-in support for **one-to-one and group conversations**, developers can efficiently enable chat features within their applications. Follow this guide to **quickly integrate chat functionality** using the CometChat React UI Kit.
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Peer deps | `react` >=18, `react-dom` >=18, `rxjs` ^7.8.1 |
+| Init | `CometChatUIKit.init(UIKitSettings)` — must resolve before `login()` |
+| Login | `CometChatUIKit.login("UID")` — must resolve before rendering components |
+| Order | `init()` → `login()` → render. Breaking this order = blank screen |
+| Auth Key | Dev/testing only. Use Auth Token in production |
+| SSR | React Router SSR — use lazy import + mounted check for CometChat components |
+| CSS | `@import url("@cometchat/chat-uikit-react/css-variables.css");` in global CSS |
+| Calling | Optional. Install `@cometchat/calls-sdk-javascript` to enable |
+| Other frameworks | [React.js](/ui-kit/react/react-js-integration) · [Next.js](/ui-kit/react/next-js-integration) · [Astro](/ui-kit/react/astro-integration) |
-
-
-
---------
-
-***
-
-## **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**.
+
-🔗 **[Click here to Sign Up](https://app.cometchat.com/login)**
+This guide walks you through adding CometChat to a React Router app. By the end you'll have a working chat UI.
-### **Step 2: Get Your Application Keys**
+
+CometChat UI Kit requires browser APIs (`window`, `WebSocket`, `document`). In React Router, use lazy imports with a mounted check to ensure CometChat components only render client-side.
+
-After registering, create a **new app** and retrieve your **authentication details**:
-
-1. Navigate to **Application**, then select the **Credentials** section.
-
-2. Note down the following keys:
-
- * **App ID**
- * **Auth Key**
- * **Region**
-
-
-
-Each CometChat application can be integrated with a **single client app**. Users within the same application can communicate across multiple platforms, including **web and mobile**.
-
-
-
-### **Step 3: Set Up Your Development Environment**
-
-Ensure your system meets the following **prerequisites** before proceeding with integration.
+---
-**System Requirements:**
+## Prerequisites
-* **Node.js** installed on your machine.
-* A code editor like **[Visual Studio Code](https://code.visualstudio.com/)** or **[Cursor](https://www.cursor.com/)**.
-* **npm** or **Yarn** package manager installed.
+You need three things from the [CometChat Dashboard](https://app.cometchat.com/):
-***
+| Credential | Where to find it |
+| --- | --- |
+| App ID | Dashboard → Your App → Credentials |
+| Auth Key | Dashboard → Your App → Credentials |
+| Region | Dashboard → Your App → Credentials (e.g. `us`, `eu`, `in`) |
-## **Built With**
+You also need Node.js (v16+) and npm/yarn installed.
-The CometChat UI Kit for React relies on the following technologies:
+
+Auth Key is for development only. In production, generate Auth Tokens server-side via the [REST API](https://api-explorer.cometchat.com/) and use [`loginWithAuthToken()`](/ui-kit/react/methods#login-using-auth-token). Never ship Auth Keys in client code.
+
-| Technology | Description |
-| ---------------------------------------------------- | ------------------------------------- |
-| [Node.js](https://nodejs.org/) | JavaScript runtime environment |
-| [npm](https://www.npmjs.com/get-npm) | Node Package Manager |
-| [React](https://www.npmjs.com/package/react) | JavaScript library for UI development |
-| [React DOM](https://www.npmjs.com/package/react-dom) | React package for rendering UI |
+---
-***
+## Step 1 — Create a React Router Project
-## **Getting Started**
+```bash lines
+npx create-react-router@latest my-app
+cd my-app
+```
-### **Step 1: Create a React Router Project**
+---
-1. **Open your code editor** (e.g., **VS Code**, **Cursor**).
-2. **Initialize a new React Router project** using one of the following methods:
+## Step 2 — Install the UI Kit
-
-**Using Create React Router App**
-
+
+```bash lines
+npm install @cometchat/chat-uikit-react
```
-npx create-react-router@latest my-app
-cd my-app
+
+
+```bash lines
+yarn add @cometchat/chat-uikit-react
```
-
-
-3. **Open the project directory in your code editor**.
-4. **Begin developing your React Router application in the "app" directory.**.
-5. **Install additional dependencies as needed**.
+This installs the UI Kit and its dependency `@cometchat/chat-sdk-javascript` automatically.
-***
+If you want voice/video calling, also install:
-### **Step 2: Install Dependencies**
-
-The **CometChat UI Kit for React** is an **extension** of the **CometChat JavaScript SDK**.\
-Installing it will **automatically** include the core **Chat SDK**, enabling **seamless integration**.
-
-```java
-npm install @cometchat/chat-uikit-react
+```bash lines
+npm install @cometchat/calls-sdk-javascript
```
-***
-
-### **Step 3: Initialize CometChat UI Kit**
+---
-Before using any features of the **CometChat UI Kit** or **CometChat SDK**, you must **initialize** the required settings.
+## Step 3 — Initialize CometChat
-```ts
+```ts lines highlight={7-9}
import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
/**
@@ -141,35 +97,24 @@ const COMETCHAT_CONSTANTS = {
AUTH_KEY: "AUTH_KEY", // Replace with your Auth Key (leave blank if using Auth Token)
};
-/**
- * Configure the CometChat UI Kit using the UIKitSettingsBuilder.
- * This setup determines how the chat UI behaves.
- */
const UIKitSettings = new UIKitSettingsBuilder()
- .setAppId(COMETCHAT_CONSTANTS.APP_ID) // Assign the App ID
- .setRegion(COMETCHAT_CONSTANTS.REGION) // Assign the App's Region
- .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY) // Assign the Authentication Key (if applicable)
- .subscribePresenceForAllUsers() // Enable real-time presence updates for all users
- .build(); // Build the final configuration
+ .setAppId(COMETCHAT_CONSTANTS.APP_ID)
+ .setRegion(COMETCHAT_CONSTANTS.REGION)
+ .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
+ .subscribePresenceForAllUsers()
+ .build();
-/**
- * Initialize the CometChat UI Kit with the configured settings.
- * Once initialized successfully, you can proceed with user authentication and chat features.
- */
-CometChatUIKit.init(UIKitSettings)!
- .then(() => {
+CometChatUIKit.init(UIKitSettings)
+ ?.then(() => {
console.log("CometChat UI Kit initialized successfully.");
- // You can now call login function to authenticate users
})
.catch((error) => {
- console.error("CometChat UI Kit initialization failed:", error); // Log errors if initialization fails
+ console.error("CometChat UI Kit initialization failed:", error);
});
```
-
-
-```js
+```js lines highlight={7-9}
import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
/**
@@ -181,239 +126,195 @@ const COMETCHAT_CONSTANTS = {
AUTH_KEY: "AUTH_KEY", // Replace with your Auth Key (leave blank if using Auth Token)
};
-/**
- * Configure the CometChat UI Kit using the UIKitSettingsBuilder.
- * This setup determines how the chat UI behaves.
- */
const UIKitSettings = new UIKitSettingsBuilder()
- .setAppId(COMETCHAT_CONSTANTS.APP_ID) // Assign the App ID
- .setRegion(COMETCHAT_CONSTANTS.REGION) // Assign the App's Region
- .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY) // Assign the Authentication Key (if applicable)
- .subscribePresenceForAllUsers() // Enable real-time presence updates for all users
- .build(); // Build the final configuration
+ .setAppId(COMETCHAT_CONSTANTS.APP_ID)
+ .setRegion(COMETCHAT_CONSTANTS.REGION)
+ .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
+ .subscribePresenceForAllUsers()
+ .build();
-/**
- * Initialize the CometChat UI Kit with the configured settings.
- * Once initialized successfully, you can proceed with user authentication and chat features.
- */
CometChatUIKit.init(UIKitSettings)
.then(() => {
console.log("CometChat UI Kit initialized successfully.");
- // You can now call login function to authenticate users
})
.catch((error) => {
- console.error("CometChat UI Kit initialization failed:", error); // Log errors if initialization fails
+ console.error("CometChat UI Kit initialization failed:", error);
});
```
-
-
-
-
-Ensure you replace the placeholders with your actual CometChat credentials.
-
-
-
-***
-
-### **Step 4: User Login**
-
-To authenticate a user, you need a **`UID`**. You can either:
-
-1. **Create new users** on the **[CometChat Dashboard](https://app.cometchat.com)**, **[CometChat SDK Method](/ui-kit/react/methods#create-user)** or **[via the API](https://api-explorer.cometchat.com/reference/creates-user)**.
-
-2. **Use pre-generated test users**:
-
- * `cometchat-uid-1`
- * `cometchat-uid-2`
- * `cometchat-uid-3`
- * `cometchat-uid-4`
- * `cometchat-uid-5`
+
+`init()` must resolve before you call `login()`. Note the `?.then()` — `init()` may return `undefined` if settings are invalid.
+
-The **Login** method returns a **User object** containing all relevant details of the logged-in user.
-
-***
-
-
+---
-**Security Best Practices**
+## Step 4 — Login
-* The **Auth Key** method is recommended for **proof-of-concept (POC) development** and early-stage testing.
-* For **production environments**, it is strongly advised to use an **[Auth Token](/ui-kit/react/methods#login-using-auth-token)** instead of an **Auth Key** to enhance security and prevent unauthorized access.
+After init resolves, log the user in. For development, use one of the pre-created test UIDs:
-
+`cometchat-uid-1` · `cometchat-uid-2` · `cometchat-uid-3` · `cometchat-uid-4` · `cometchat-uid-5`
-```ts
+```ts lines highlight={3}
import { CometChatUIKit } from "@cometchat/chat-uikit-react";
const UID = "UID"; // Replace with your actual UID
CometChatUIKit.getLoggedinUser().then((user: CometChat.User | null) => {
if (!user) {
- // If no user is logged in, proceed with login
CometChatUIKit.login(UID)
.then((user: CometChat.User) => {
console.log("Login Successful:", { user });
- // Mount your app
})
.catch(console.log);
} else {
- // If user is already logged in, mount your app
+ // Already logged in
}
});
```
-
-
-```js
+```js lines highlight={3}
import { CometChatUIKit } from "@cometchat/chat-uikit-react";
const UID = "UID"; // Replace with your actual UID
CometChatUIKit.getLoggedinUser().then((user) => {
if (!user) {
- // If no user is logged in, proceed with login
CometChatUIKit.login(UID)
.then((user) => {
console.log("Login Successful:", { user });
- // Mount your app
})
.catch(console.log);
} else {
- // If user is already logged in, mount your app
+ // Already logged in
}
});
```
-
-
-***
+Key points:
+- `getLoggedinUser()` checks for an existing session so you don't re-login unnecessarily.
+- `login(uid)` skips the API call if a session already exists and returns the cached user.
+- Components must not render until login resolves — use a state flag to gate rendering.
-### **Step 5: Choose a Chat Experience**
-
-Integrate a conversation view that suits your application's **UX requirements**. Below are the available options:
-
-***
+
+For production, use [`loginWithAuthToken()`](/ui-kit/react/methods#login-using-auth-token) instead of Auth Key. Generate tokens server-side via the REST API.
+
-#### **1️⃣ Conversation List + Message View**
+---
-**Best for:** Applications that need a **two-panel layout**, such as web-based chat interfaces (e.g., WhatsApp Web, Slack).
+## Step 5 — Add the CSS Import
-**Features:**
+Add this line at the top of your global CSS file (e.g. `app.css`):
-* **Two-panel layout** – Displays the conversation list on the left and the active chat window on the right.
-* **One-to-one & group conversations** – Seamless switching between private and group chats.
-* **Multiple conversations** – Effortlessly switch between different chat windows.
-* **Easy navigation** – Intuitive UI for finding and accessing chats quickly.
-* **Tap-to-view on mobile** – In mobile layouts, tapping a conversation opens the **Message View**, optimizing space.
-* **Real-time updates** – Auto-refreshes messages and conversation lists.
-* **Message sync** – Ensures messages stay updated across all sessions and devices.
+```css title="app.css" lines
+@import url("@cometchat/chat-uikit-react/css-variables.css");
+```
-
-
-
+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)
+
+ Step-by-step guide to build this layout
+
-***
-
-#### **3️⃣ Tab-Based Chat Experience**
+---
-**Best for:** Apps that need a **structured, multi-feature navigation system** for seamless interaction between **chats, calls, users, and settings**.
+### One-to-One / Group Chat
-**Features:**
+Single chat window — no sidebar. Good for support chat, embedded widgets, or focused messaging.
-* **Tab Navigation** – Easily switch between **Chat, Call Logs, Users, and Settings**.
-* **Dedicated Chat Window** – Full-screen messaging experience for focused communication.
-* **No Sidebar** – Unlike multi-panel UI, this design prioritizes individual interactions.
-* **Unified Experience** – Users can seamlessly manage conversations, call history, and settings from a single interface.
-* **Scalable for future features** – Easily extend to include more functionalities such as notifications or contact management.
-* **Optimized for both desktop and mobile** – Ensures a smooth experience across different screen sizes.
+- Dedicated chat window for one-on-one or group messaging
+- No conversation list — users go directly into the chat
+- Full-screen experience optimized for mobile
+- Ideal for support chat or community messaging
-
+
-**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)
+
+ Step-by-step guide to build this layout
+
-***
+---
-## **Build Your Own Chat Experience**
+### Tab-Based Chat
-**Best for:** Developers who need complete control over their chat interface, allowing customization of components, themes, and features to align with their app’s design and functionality. Whether you're enhancing an existing chat experience or building from scratch, this approach provides the flexibility to tailor every aspect to your needs.
+Tabbed navigation — Chat, Call Logs, Users, Settings in separate tabs. Good for full-featured apps.
-**Recommended for:**
+- Tab navigation between Chat, Call Logs, Users, and Settings
+- Full-screen messaging within each tab
+- Unified experience for conversations, call history, and settings
+- Scales well for adding future features like notifications or contacts
-* Apps that require **a fully customized chat experience**.
-* Developers who want to **extend functionalities and modify UI components**.
-* Businesses integrating chat seamlessly into **existing platforms**.
+
+
+
-**Key Areas to Explore:**
+
+ Step-by-step guide to build this layout
+
-* **[React Sample App](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app)** – Fully functional sample applications to accelerate your development.
-* **[Core Features](./core-features)** – Learn about messaging, real-time updates, and other essential capabilities.
-* **[Components](./components-overview)** – Utilize prebuilt UI elements or customize them to fit your design.
-* **[Themes](./theme)** – Adjust colors, fonts, and styles to match your branding.
-* **[Build Your Own UI](./../../../sdk/javascript/overview)** – Prefer a custom UI over our UI Kits? Explore our SDKs to create a tailored chat experience.
+---
-***
+## Build Your Own Chat Experience
-## **Next Steps**
+Need full control over the UI? Use individual components, customize themes, and wire up your own layouts.
-Now that you’ve selected your **chat experience**, proceed to the **integration guide**:
+- [Sample App](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app) — Working reference app to compare against
+- [Components](/ui-kit/react/components-overview) — All prebuilt UI elements with props and customization options
+- [Core Features](/ui-kit/react/core-features) — Messaging, real-time updates, and other capabilities
+- [Theming](/ui-kit/react/theme) — Colors, fonts, dark mode, and custom styling
+- [Build Your Own UI](/sdk/javascript/overview) — Skip the UI Kit entirely and build on the raw SDK
-* **[Integrate Conversation List + Message](/ui-kit/react/react-router-conversation)**
-* **[Integrate One-to-One Chat](/ui-kit/react/react-router-one-to-one-chat)**
-* **[Integrate Tab-Based Chat](/ui-kit/react/react-router-tab-based-chat)**
-* **[Advanced Customizations](/ui-kit/react/theme)**
+---
-***
+## Next Steps
+
+
+
+ Browse all prebuilt UI components
+
+
+ Customize colors, fonts, and styles
+
+
+ Chat features included out of the box
+
+
+ Common issues and fixes
+
+
diff --git a/ui-kit/react/react-router-one-to-one-chat.mdx b/ui-kit/react/react-router-one-to-one-chat.mdx
index adfd56641..579f6d811 100644
--- a/ui-kit/react/react-router-one-to-one-chat.mdx
+++ b/ui-kit/react/react-router-one-to-one-chat.mdx
@@ -1,90 +1,87 @@
---
-title: "Building A One To One/Group Chat Experience"
-sidebarTitle: "One To One/Group Chat"
+title: "One-to-One / Group Chat"
+sidebarTitle: "One-to-One / Group Chat"
+description: "Build a focused one-to-one or group chat experience in React Router with CometChat UI Kit."
---
-The **One-to-One Chat** feature provides a streamlined **direct messaging interface**, making it ideal for **support chats, dating apps, and private messaging platforms**. This setup eliminates distractions by focusing solely on a **dedicated chat window**.
+
-***
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Framework | React Router |
+| Components | `CometChatMessageHeader`, `CometChatMessageList`, `CometChatMessageComposer` |
+| Layout | Single chat window — no sidebar, no conversation list |
+| Prerequisite | Complete [React Router Integration](/ui-kit/react/react-router-integration) Steps 1–5 first |
+| SSR | Lazy import + mounted check — CometChat requires browser APIs |
+| Pattern | Support chat, embedded widgets, focused messaging |
-## **User Interface Preview**
+
+
+This guide builds a single chat window — no sidebar, no conversation list. Users go directly into a one-to-one or group chat. Good for support chat, embedded widgets, or any focused messaging experience.
+
+This assumes you've already completed [React Router Integration](/ui-kit/react/react-router-integration) (project created, UI Kit installed, CSS imported).
-### **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
-
-```
-
-### **Step 2: Build the Message View**
+---
-* Load **chat history** and **real-time messages**.
-* Ensure **smooth scrolling and timestamp visibility**.
+## What You're Building
-```html
-
-```
+Three components stacked vertically:
-### **Step 3: Add the Message Composer**
+1. **Chat header** — displays recipient name, avatar, online status, and optional call buttons
+2. **Message list** — real-time chat history with scrolling
+3. **Message composer** — text input with media, emojis, and reactions
-* Include a **text input field**.
-* Support **media uploads, file attachments, emojis, and reactions**.
-
-```html
-
-```
-
-***
+---
-#### **Implementation**
+## Step 1 — Create the CometChatNoSSR Component
-Now we will create the `CometChatNoSSR.tsx` & `CometChatNoSSR.css` files. Here, we will initialize the CometChat UI Kit, log in a user, and build the messaging experience using `CometChatMessageHeader`, `CometChatMessageList`, and `CometChatMessageComposer` components.
+This component handles init, login, fetches the target user/group, and renders the chat UI. It runs client-side only.
-```
-src/
-│── CometChatNoSSR/
-│ ├── CometChatNoSSR.tsx
-│ ├── CometChatNoSSR.css
-```
+
+
+
+
+
+
+
+
+
+
-```tsx CometChatNoSSR.tsx
+```tsx title="CometChatNoSSR.tsx" lines highlight={13-15, 38, 56, 63}
import React, { useEffect, useState } from "react";
-import { CometChatMessageComposer, CometChatMessageHeader, CometChatMessageList, CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
+import {
+ CometChatMessageComposer,
+ CometChatMessageHeader,
+ CometChatMessageList,
+ CometChatUIKit,
+ UIKitSettingsBuilder,
+} from "@cometchat/chat-uikit-react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import "./CometChatNoSSR.css";
const COMETCHAT_CONSTANTS = {
- APP_ID: "",
- REGION: "",
- AUTH_KEY: "",
+ APP_ID: "", // Replace with your App ID
+ REGION: "", // Replace with your Region
+ AUTH_KEY: "", // Replace with your Auth Key (dev only)
};
const CometChatNoSSR: React.FC = () => {
const [user, setUser] = useState(undefined);
const [selectedUser, setSelectedUser] = useState(undefined);
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
const [selectedGroup, setSelectedGroup] = useState(undefined);
useEffect(() => {
+ if (typeof window === "undefined") return;
+
const UIKitSettings = new UIKitSettingsBuilder()
.setAppId(COMETCHAT_CONSTANTS.APP_ID)
.setRegion(COMETCHAT_CONSTANTS.REGION)
@@ -97,7 +94,7 @@ const CometChatNoSSR: React.FC = () => {
console.log("Initialization completed successfully");
CometChatUIKit.getLoggedinUser().then((loggedInUser) => {
if (!loggedInUser) {
- CometChatUIKit.login("superhero1")
+ CometChatUIKit.login("cometchat-uid-2")
.then((user) => {
console.log("Login Successful", { user });
setUser(user);
@@ -114,26 +111,18 @@ const CometChatNoSSR: React.FC = () => {
useEffect(() => {
if (user) {
- // Fetch user or group from CometChat SDK whose chat you want to load.
-
- /** Fetching User */
+ // Fetch the user whose chat you want to load
const UID = "cometchat-uid-1";
CometChat.getUser(UID).then(
- user => {
- setSelectedUser(user);
- }, error => {
- console.log("User fetching failed with error:", error);
- }
+ (user) => setSelectedUser(user),
+ (error) => console.log("User fetching failed with error:", error)
);
- /** Fetching Group */
- // const GUID = "GUID"
+ // To load a group chat instead, uncomment below:
+ // const GUID = "GUID";
// CometChat.getGroup(GUID).then(
- // group => {
- // setSelectedGroup(group);
- // }, error => {
- // console.log("User fetching failed with error:", error);
- // }
+ // (group) => setSelectedGroup(group),
+ // (error) => console.log("Group fetching failed with error:", error)
// );
}
}, [user]);
@@ -147,7 +136,9 @@ const CometChatNoSSR: React.FC = () => {
) : (
-
Start a conversation by passing valid user or group IDs.
+
+ Set a user or group UID in CometChatNoSSR.tsx to start chatting
+
)}
>
) : undefined;
@@ -157,74 +148,64 @@ export default CometChatNoSSR;
```
-
-```css CometChatNoSSR.css
+```css title="CometChatNoSSR.css" lines
.messages-wrapper {
- width: 100%;
- height: 100%;
- display: flex;
- flex-direction: column;
+ width: 100%;
+ height: 100%;
+ display: flex;
+ flex-direction: column;
}
.empty-conversation {
- height: 100%;
- width: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- background: white;
- color: var(--cometchat-text-color-secondary, #727272);
- font: var(--cometchat-font-body-regular, 400 14px Roboto);
+ height: 100%;
+ width: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ background: white;
+ color: var(--cometchat-text-color-secondary, #727272);
+ font: var(--cometchat-font-body-regular, 400 14px Roboto);
}
.cometchat .cometchat-message-composer {
- border-radius: 0px;
+ border-radius: 0px;
}
```
-
-In the code snippet above, ensure you select either a user or a group based on your chat requirement. You can also determine this dynamically depending on the conversation type.
+Key points:
+- `CometChat.getUser(UID)` fetches the user object from the SDK — you need a real user object, not a manually constructed one.
+- Pass either `user` or `group` to the message components, never both.
+- The highlighted lines show where to set your credentials.
-#### **Fetching a User (One-on-One Chat)**
+---
-```javascript
-const UID = "cometchat-uid-1";
-CometChat.getUser(UID).then(
- user => {
- setSelectedUser(user);
- }, error => {
- console.log("User fetching failed with error:", error);
- }
-);
-```
+## Switching Between User and Group Chat
-#### **Fetching a Group (Group Chat)**
+To load a group chat instead of one-to-one, replace the `getUser` call with `getGroup`:
-```javascript
-const GUID = "GUID"
-CometChat.getGroup(GUID).then(
- group => {
- setSelectedGroup(group);
- }, error => {
- console.log("User fetching failed with error:", error);
- }
-);
+```tsx lines highlight={1}
+const GUID = "GUID"; // Replace with your actual Group ID
+
+CometChat.getGroup(GUID)
+ .then((group) => setSelectedGroup(group))
+ .catch((error) => console.error("Failed to fetch group:", error));
```
-### **Step 4: Disable SSR and Render the CometChat Component**
+---
+
+## Step 2 — Disable SSR and Add the Route
-Create a file CometChat.tsx inside the routes folder:
+Create `CometChat.tsx` inside the `routes` folder:
-```javascript
+```tsx title="routes/CometChat.tsx" lines
import React, { lazy, Suspense, useEffect, useState } from "react";
import "@cometchat/chat-uikit-react/css-variables.css";
-// Lazy import to prevent SSR crash
const CometChatNoSSR = lazy(() => import("../CometChatNoSSR/CometChatNoSSR"));
export default function CometChatRoute() {
@@ -244,101 +225,56 @@ export default function CometChatRoute() {
}
```
-Now, create a route for CometChat in your routes file:
+Add the route:
-```typescript
+```ts title="routes.ts" lines
import { type RouteConfig, index, route } from "@react-router/dev/routes";
export default [
index("routes/home.tsx"),
- route("chat", "routes/CometChat.tsx"), // Chat Route
+ route("chat", "routes/CometChat.tsx"),
] satisfies RouteConfig;
```
-
-
-Why disable SSR? CometChat UI Kit Builder relies on browser APIs such as window, document, and WebSockets. Since React Router renders on the server by default, disabling SSR for this component prevents runtime errors.
-
-
-
-### **Step 5: Update App CSS**
-
-Next, add the following styles to app.css to ensure CometChat UI Kit is properly styled.
-
-```css app.css
-:root {
- --background: #ffffff;
- --foreground: #171717;
-}
-
-@media (prefers-color-scheme: dark) {
- :root {
- --background: #0a0a0a;
- --foreground: #ededed;
- }
-}
-
-/** Give your App a height of `100%`. Keep other CSS properties in the below selector as it is. */
-.root {
- height: 100%;
-}
-
-html,
-body {
- height: 100%;
-}
-
-html,
-body {
- max-width: 100vw;
- overflow-x: hidden;
-}
-
-body {
- color: var(--foreground);
- background: var(--background);
- font-family: Arial, Helvetica, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
+---
-* {
- box-sizing: border-box;
- padding: 0;
- margin: 0;
-}
+## Step 3 — Run the Project
-a {
- color: inherit;
- text-decoration: none;
-}
-
-@media (prefers-color-scheme: dark) {
- html {
- color-scheme: dark;
- }
-}
+
+
+```bash lines
+npm run dev
```
+
+
+```bash lines
+pnpm dev
+```
+
+
+```bash lines
+yarn dev
+```
+
+
-### **Step 6: Run Your Application**
-
-1. **Start the development server**
-
- ```
- npm run dev
- ```
-
-2. **Verify the chat interface**
-
-* In your browser, navigate to the `/chat` route `(e.g., http://localhost:3000/chat)`.
-* Confirm that the chat experience loads as expected.
-
-***
-
-## **Next Steps**
-
-### **Enhance the User Experience**
+Navigate to `/chat` (e.g. `http://localhost:5173/chat`). You should see the chat window load with the conversation for the UID you set.
-* **[Advanced Customizations](/ui-kit/react/theme)** – Personalize the chat UI to align with your brand.
+---
-***
+## Next Steps
+
+
+
+ Customize colors, fonts, and styles to match your brand
+
+
+ Browse all prebuilt UI components
+
+
+ Back to the main setup guide
+
+
+ Chat features included out of the box
+
+
\ No newline at end of file
diff --git a/ui-kit/react/react-router-tab-based-chat.mdx b/ui-kit/react/react-router-tab-based-chat.mdx
index aae298cf8..f388c8aff 100644
--- a/ui-kit/react/react-router-tab-based-chat.mdx
+++ b/ui-kit/react/react-router-tab-based-chat.mdx
@@ -1,86 +1,88 @@
---
-title: "Building A Messaging UI With Tabs, Sidebar, And Message View"
-sidebarTitle: "Tab Based Chat Experience"
+title: "Tab-Based Chat"
+sidebarTitle: "Tab-Based Chat"
+description: "Build a tab-based messaging UI with chats, calls, users, and groups in React Router with CometChat UI Kit."
---
-This guide walks you through creating a **tab-based messaging UI** using **React** and **CometChat UIKit**. The UI will include different sections for **Chats, Calls, Users, and Groups**, allowing seamless navigation.
+
-***
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Framework | React Router |
+| Components | `CometChatConversations`, `CometChatCallLogs`, `CometChatUsers`, `CometChatGroups`, `CometChatMessageHeader`, `CometChatMessageList`, `CometChatMessageComposer` |
+| Layout | Tabbed sidebar (Chats, Calls, Users, Groups) + message view |
+| Prerequisite | Complete [React Router Integration](/ui-kit/react/react-router-integration) Steps 1–5 first |
+| SSR | Lazy import + mounted check — CometChat requires browser APIs |
+| Pattern | Full-featured messaging app with multiple sections |
-## **User Interface Preview**
+
+
+This guide builds a tabbed messaging UI — Chats, Calls, Users, and Groups tabs in the sidebar, with a message view on the right. Good for full-featured apps that need more than just conversations.
+
+This assumes you've already completed [React Router Integration](/ui-kit/react/react-router-integration) (project created, UI Kit installed, CSS imported).
-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
+
+
+
+
+
+
+
+
+
+
+
+
+Tab icons need to be placed in `public/assets/`. Download them from the [CometChat UI Kit assets folder on GitHub](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app/src/assets).
+
+
+
+
+
+
+
+
+
+
+
-```tsx CometChatTabs.tsx
+```tsx title="CometChatTabs.tsx" lines
import { useState } from "react";
import "./CometChatTabs.css";
-// Define icon paths for each tab
const chatsIcon = "/assets/chats.svg";
const callsIcon = "/assets/calls.svg";
const usersIcon = "/assets/users.svg";
const groupsIcon = "/assets/groups.svg";
-// CometChatTabs component to display tab options
export const CometChatTabs = (props: {
- onTabClicked?: (tabItem: { name: string; icon?: string }) => void; // Callback when a tab is clicked
- activeTab?: string; // Name of the currently active tab
+ onTabClicked?: (tabItem: { name: string; icon?: string }) => void;
+ activeTab?: string;
}) => {
- // Destructure props with default fallback
- const {
- onTabClicked = () => {}, // Fallback to no-op if not provided
- activeTab,
- } = props;
-
- // State to track the currently hovered tab
+ const { onTabClicked = () => {}, activeTab } = props;
const [hoverTab, setHoverTab] = useState("");
- // Array of tab items with their labels and icons
const tabItems = [
{ name: "CHATS", icon: chatsIcon },
{ name: "CALLS", icon: callsIcon },
@@ -90,7 +92,6 @@ export const CometChatTabs = (props: {
return (
- {/* Loop through each tab item to render it */}
{tabItems.map((tabItem) => {
const isActive =
activeTab === tabItem.name.toLowerCase() ||
@@ -100,9 +101,8 @@ export const CometChatTabs = (props: {
onTabClicked(tabItem)} // Invoke callback on click
+ onClick={() => onTabClicked(tabItem)}
>
- {/* Icon section with mask styling */}
);
-};
+}
export default App;
```
-
-```css App.css
+```css title="App.css" lines
+@import url("@cometchat/chat-uikit-react/css-variables.css");
+
#root {
text-align: center;
width: 100vw;
@@ -423,6 +463,7 @@ export default App;
background-color: #282c34;
}
+/* Two-panel layout */
.conversations-with-messages {
display: flex;
height: 100%;
@@ -430,6 +471,7 @@ export default App;
flex-direction: row;
}
+/* Left panel — tabs + list */
.conversations-wrapper {
height: 100vh;
width: 480px;
@@ -438,10 +480,11 @@ export default App;
flex-direction: column;
}
-.conversations-wrapper>.cometchat {
+.conversations-wrapper > .cometchat {
overflow: hidden;
}
+/* Right panel — messages */
.messages-wrapper {
width: 100%;
height: 100vh;
@@ -449,6 +492,7 @@ export default App;
flex-direction: column;
}
+/* Empty state */
.empty-conversation {
height: 100vh;
width: 100%;
@@ -466,21 +510,48 @@ export default App;
```
-
-### **Step 4: Run the project**
+How it works:
+- Selections from any tab (Chats, Calls, Users, Groups) flow through the same `onSelectorItemClicked` callback.
+- Conversation items are unwrapped via `getConversationWith()` to extract the underlying `User` or `Group`.
+- Call selections are tracked separately in `selectedCall` — add your own call details UI as needed.
+- Only one of `selectedUser` / `selectedGroup` / `selectedCall` is set at a time — the others are cleared.
-```powershell
-npm start
-```
+---
-***
+## Step 4 — Run the Project
-## **Next Steps**
+
+
+```bash lines
+npm run dev
+```
+
+
+```bash lines
+npm start
+```
+
+
-### **Enhance the User Experience**
+You should see the tab bar at the bottom of the sidebar. Switch between Chats, Calls, Users, and Groups — tapping any item loads the message view on the right.
-* **[Advanced Customizations](/ui-kit/react/theme)** – Personalize the chat UI to align with your brand.
+---
-***
+## Next Steps
+
+
+
+ Customize colors, fonts, and styles to match your brand
+
+
+ Browse all prebuilt UI components
+
+
+ Back to the main setup guide
+
+
+ Chat features included out of the box
+
+
diff --git a/ui-kit/react/search.mdx b/ui-kit/react/search.mdx
index 02879766c..c7ee85d3a 100644
--- a/ui-kit/react/search.mdx
+++ b/ui-kit/react/search.mdx
@@ -1,18 +1,35 @@
---
title: "Search"
+description: "Search across conversations and messages in real time with filtering, scopes, and custom views using the CometChatSearch component."
---
-## Overview
+
+
+
-The `CometChatSearch` component is a powerful and customizable search interface that allows users to search across conversations and messages in real time. It supports a wide variety of filters, scopes, and customization options. `CometChatSearch` helps users find messages, conversations, media, and more through an intuitive and filterable search experience. It can be embedded in multiple contexts — as part of the conversation list, message header, or as a full-screen search experience.
+
-## Usage
+| Field | Value |
+| --- | --- |
+| Purpose | Real-time search across conversations and messages with filtering, scopes, and custom views |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatSearch } from "@cometchat/chat-uikit-react";` |
+| Used in experiences | Conversation list search, message header search, standalone full-screen search |
+| Copy-paste base | See [Base Code](#base-code--stylesheet) below |
+| Primary output | Conversation click (from `onConversationClicked`), message click (from `onMessageClicked`) |
+| Primary hook points | `onConversationClicked`, `onMessageClicked`, `onBack`, `onError`, `conversationsRequestBuilder`, `messagesRequestBuilder`, view slots (`conversationItemView`, `messageItemView`, `messageLeadingView`, `messageTitleView`, `messageSubtitleView`, `messageTrailingView`) |
+| CSS root class | `.cometchat-search` |
+| Real-time events | None emitted |
-### Integration
+
+
+## Base Code and Stylesheet
+
+Renders a search interface for conversations and messages.
-```tsx
+```tsx lines
import { CometChatSearch } from "@cometchat/chat-uikit-react";
function SearchDemo() {
@@ -25,39 +42,98 @@ function SearchDemo() {
export default SearchDemo;
```
-
+
-
-```tsx
-import { SearchDemo } from "./SearchDemo";
+Root CSS class for style overrides:
-export default function App() {
- return (
-
-
-
- );
+```css lines
+.cometchat-search {
+ /* overrides here */
}
```
-
+## Functionality
-
+Props that control component behavior, grouped by surface area.
-***
+### Data
-### Actions
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `user` | `CometChat.User` | `undefined` | Scopes search to a specific user's conversation | — |
+| `group` | `CometChat.Group` | `undefined` | Scopes search to a specific group's conversation | — |
-[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.
+### UI Visibility Toggles
-#### 1. onConversationClicked
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `hideBackButton` | `boolean` | `false` | Hides the back button | — |
+| `hideUserStatus` | `boolean` | `false` | Hides the user's online/offline status indicator | — |
+| `hideGroupType` | `boolean` | `false` | Hides the group type icon in conversation leading view | — |
+| `hideReceipts` | `boolean` | `false` | Disables the display of message read receipts in conversation results | — |
-`onConversationClicked` is triggered when you click on a Conversation from the search result. The `onConversationClicked` action doesn't have a predefined behavior. You can override this action using the following code snippet.
+### Data Scoping
-
-
-```tsx
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `uid` | `string` | `undefined` | Limits search to messages with a specific user | — |
+| `guid` | `string` | `undefined` | Limits search to messages in a specific group | — |
+
+### Search Configuration
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `searchFilters` | `CometChatSearchFilter[]` | All filters | Filters rendered in the search UI (Messages, Photos, Audio, Documents) | — |
+| `initialSearchFilter` | `CometChatSearchFilter` | `undefined` | The filter active by default on load | — |
+| `searchIn` | `CometChatSearchScope[]` | All scopes | Entities in which search is performed (Conversations, Messages) | — |
+
+### Custom Views (Render Props)
+
+| Property | Type | Effect |
+| --- | --- | --- |
+| `initialView` | `JSX.Element` | Shown when no search is performed yet |
+| `loadingView` | `JSX.Element` | Shown while search results are loading |
+| `emptyView` | `JSX.Element` | Shown when no results are found |
+| `errorView` | `JSX.Element` | Shown when an error occurs |
+
+### Date Formatting
+
+| Property | Type | Default | Effect |
+| --- | --- | --- | --- |
+| `messageSentAtDateTimeFormat` | `CalendarObject` | `DD MMM, YYYY` | Customizes the message sent-at timestamp |
+
+### Text Formatting
+
+| Property | Type | Default | Effect |
+| --- | --- | --- | --- |
+| `textFormatters` | `CometChatTextFormatter[]` | `[]` | Custom text formatters for message content (e.g., emoji, links, mentions) |
+
+
+If a property is not passed in the CalendarObject, the component checks the [global configuration](/ui-kit/react/localize#customisation) first, then falls back to the component's default formatting.
+
+
+## Actions
+
+[Actions](/ui-kit/react/components-overview#actions) split into predefined (built-in triggers) and user-defined (callbacks).
+
+### Predefined Actions
+
+The component handles search execution, result rendering, and pagination internally.
+
+### User-Defined Actions
+
+#### onConversationClicked
+
+Fires when a conversation is clicked from the search results.
+
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks a conversation in search results |
+| Payload type | `(conversation: CometChat.Conversation, searchKeyword?: string) => void` |
+| What devs typically do next | Navigate to the conversation, open chat view |
+
+```ts lines
import { CometChatSearch } from "@cometchat/chat-uikit-react";
const openConversation = (conversation: CometChat.Conversation) => {
@@ -67,41 +143,37 @@ const openConversation = (conversation: CometChat.Conversation) => {
;
```
-
-
-
-
-***
+#### onMessageClicked
-#### 2. onMessageClicked
+Fires when a message is clicked from the search results.
-`onMessageClicked` is triggered when you click on a Message from the search result. The `onMessageClicked` action doesn't have a predefined behavior. You can override this action using the following code snippet.
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks a message in search results |
+| Payload type | `(message: CometChat.BaseMessage, searchKeyword?: string) => void` |
+| What devs typically do next | Navigate to the message in context, scroll to message |
-
-
-```tsx
+```ts lines
import { CometChatSearch } from "@cometchat/chat-uikit-react";
const goToMessage = (message: CometChat.BaseMessage) => {
- console.log("Message Selected:", conversation);
+ console.log("Message Selected:", message);
};
;
```
-
-
-
-
-***
+#### onBack
-#### 3. OnBack
+Fires when the back button is clicked.
-`OnBack` is triggered when you click on the back button of the Message Header component. You can override this action using the following code snippet.
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks the back button |
+| Payload type | `() => void` |
+| What devs typically do next | Navigate back to previous view |
-
-
-```tsx
+```ts lines
import { CometChatSearch } from "@cometchat/chat-uikit-react";
const onBack = () => {
@@ -111,19 +183,17 @@ const onBack = () => {
;
```
-
+#### onError
-
+Fires when the component encounters an error.
-***
+| Detail | Value |
+| --- | --- |
+| When it fires | Any internal error during search or rendering |
+| Payload type | `(error: CometChat.CometChatException) => void` |
+| What devs typically do next | Log to error tracking service |
-#### 4. onError
-
-This action doesn't change the behavior of the component but rather listens for any errors that occur in the Conversations component.
-
-
-
-```tsx
+```ts lines
import { CometChatSearch } from "@cometchat/chat-uikit-react";
const handleOnError = (error: CometChat.CometChatException) => {
@@ -133,21 +203,15 @@ const handleOnError = (error: CometChat.CometChatException) => {
;
```
-
+## Filters
-
-
-***
-
-### Filters
+Control which results appear using `ConversationsRequestBuilder` and `MessagesRequestBuilder`.
-#### 1. ConversationsRequestBuilder
+### ConversationsRequestBuilder
-You can set the `ConversationsRequestBuilder` in the Search Component to filter the search result. You can modify the builder as per your specific requirements with multiple options available to know more refer to [ConversationRequestBuilder](/sdk/javascript/retrieve-conversations).
+Filter conversation search results. Refer to [ConversationsRequestBuilder](/sdk/javascript/retrieve-conversations) for the full API.
-
-
-```tsx
+```ts lines
import { CometChatSearch } from "@cometchat/chat-uikit-react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
@@ -158,19 +222,11 @@ import { CometChat } from "@cometchat/chat-sdk-javascript";
/>;
```
-
-
-
-
-***
-
-#### 2. MessagesRequestBuilder
+### MessagesRequestBuilder
-You can set the `MessagesRequestBuilder` in the Search Component to filter the search result. You can modify the builder as per your specific requirements with multiple options available to know more refer to [MessagesRequestBuilder](/sdk/javascript/additional-message-filtering).
+Filter message search results. Refer to [MessagesRequestBuilder](/sdk/javascript/additional-message-filtering) for the full API.
-
-
-```tsx
+```ts lines
import { CometChatSearch } from "@cometchat/chat-uikit-react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
@@ -179,206 +235,51 @@ import { CometChat } from "@cometchat/chat-sdk-javascript";
/>;
```
-
-
-
-
-***
-
-### Events
-
-[Events](/ui-kit/react/components-overview#events) are emitted by a `Component`. By using event you can extend existing functionality. Being global events, they can be applied in multiple locations and are capable of being added or removed.
-
-The `CometChatSearch` component does not produce any events.
-
-***
-
-## Customization
-
-To fit your app's design requirements, you can customize the appearance of the `CometChatSearch` component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.
-
-### Style
-
-To customize the appearance, you can customise css of `CometChatSearch`
-
-**Example**
-
-
-
-
-
-
-
-```tsx
-import React from "react";
-import { CometChatSearch } from "@cometchat/chat-uikit-react";
-
-;
-```
-
-
-
-
-```css
-.cometchat-search * {
- font-family: 'Times New Roman', Times !important;
-}
-
-.cometchat-search {
- gap: 0;
-}
-
-.cometchat-search__header {
- background-color: var(--cometchat-primary-color);
-}
-
-.cometchat-search__back-button .cometchat-button .cometchat-button__icon {
- background: var(--cometchat-static-white);
-}
-
-.cometchat-search__body {
- padding-block: var(--cometchat-padding-3);
- background-color: var(--cometchat-primary-color);
-}
-
-.cometchat-search-conversations__see-more .cometchat-button,
-.cometchat-search-messages__see-more .cometchat-button {
- text-decoration: underline;
- text-decoration-color: var(--cometchat-primary-color);
- text-underline-offset: 2px;
-}
-
-.cometchat-search-conversations__see-more .cometchat-button .cometchat-button__text,
-.cometchat-search-messages__see-more .cometchat-button .cometchat-button__text {
- font-weight: 300;
-}
-
-.cometchat-search__conversations {
- padding-top: var(--cometchat-padding-3);
- background-color: var(--cometchat-extended-primary-color-100);
-}
-
-.cometchat-search__messages {
- margin-top: var(--cometchat-margin-4);
-}
-
-.cometchat-search__conversations .cometchat-list__header {
- background-color: var(--cometchat-extended-primary-color-100);
-}
-
-.cometchat-search__conversations .cometchat-list__header-title {
- background-color: var(--cometchat-extended-primary-color-100);
-}
-
-.cometchat-search__conversations .cometchat-list-item {
- background-color: var(--cometchat-extended-primary-color-100);
-}
-
-.cometchat-search-messages__date-separator {
- display: none;
-}
-
-.cometchat-search__body-filter .cometchat-button__text {
- color: var(--cometchat-text-color-secondary);
-}
-
-.cometchat-search .cometchat-list__header-title {
- color: var(--cometchat-text-color-primary);
- font-weight: 700;
-}
-```
-
-
-
-
-
-### Functionality
-
-These are a set of small functional customizations that allow you to fine-tune the overall experience of the component. With these, you can change text, set custom icons, and toggle the visibility of UI elements.
-
-Here is a code snippet demonstrating how you can customize the functionality of the Message Header component.
-
-
-
-```tsx
-import { CometChatSearch } from "@cometchat/chat-uikit-react";
-
-;
-```
-
-
-
-
+## Events
-Following is a list of customizations along with their corresponding code snippets:
+### UI Events
-| Property | Description | Code |
-| ------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
-| **User** | A `CometChat.User` object representing the user in whose conversation the search will be performed. | `user={chatUser}` |
-| **Group** | A `CometChat.Group` object representing the group in whose conversation the search will be performed. | `group={chatGroup}` |
-| **Hide Back Button** | Hides the back button in the Search component. | `hideBackButton={true}` |
-| **Hide User Status** | Hides the user's online/offline status indicator. | `hideUserStatus={true}` |
-| **Hide Group Type** | Hides the group type icon in conversation leading view. | `hideGroupType={false}` |
-| **Hide Receipts** | Disables the display of message read receipts in conversation result. | `hideReceipts={false}` |
-| **Search Filters** | List of filters to be rendered in the Search component. | `searchFilters={[CometChatSearchFilter.Messages, CometChatSearchFilter.Photos, CometChatSearchFilter.Audio, CometChatSearchFilter.Documents]}` |
-| **Initial Search Filter** | The filter which will be active by default on load. | `initialSearchFilter={CometChatSearchFilter.Messages}` |
-| **Search In** | List of entities in which the search should be performed. | `searchIn={[CometChatSearchScope.Conversations]}` |
-| **Initial View** | Custom view to be shown when CometChat Search is rendered & no search is performed. | `initialView={<>Custom Initial View>}` |
-| **Loading View** | A custom component to display during the loading state. | `loadingView={<>Custom Loading View>}` |
-| **Empty View** | A custom component to display when there are no conversations available. | `emptyView={<>Custom Empty View>}` |
-| **Error View** | A custom component to display when an error occurs. | `errorView={<>Custom Error View>}` |
+The `CometChatSearch` component does not emit any UI events.
-### Advanced
+### SDK Events (Real-Time)
-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.
+The component does not attach SDK listeners. Search is on-demand, not real-time.
-***
+## Advanced: Custom View Slots
-#### ConversationItemView
+Customization override points for the search UI. The component exposes separate slots for conversation results and message results.
-With this function, you can assign a custom list item view to an conversation in the search result. For more information, refer to the [itemView](/ui-kit/react/conversations#itemview) prop of the `CometChatConversations` component.
+### Slot Catalog
-#### ConversationLeadingView
+| Slot | Params | What it replaces | Section |
+| --- | --- | --- | --- |
+| `conversationItemView` | `(conversation: CometChat.Conversation) => JSX.Element` | Entire conversation list item | Conversation results |
+| `conversationLeadingView` | `(conversation: CometChat.Conversation) => JSX.Element` | Conversation avatar / left section | Conversation results |
+| `conversationTitleView` | `(conversation: CometChat.Conversation) => JSX.Element` | Conversation title text | Conversation results |
+| `conversationSubtitleView` | `(conversation: CometChat.Conversation) => JSX.Element` | Conversation subtitle text | Conversation results |
+| `conversationTrailingView` | `(conversation: CometChat.Conversation) => JSX.Element` | Conversation right section | Conversation results |
+| `conversationOptions` | `(conversation: CometChat.Conversation) => CometChatActionsIcon[]` | Hover actions on conversation item | Conversation results |
+| `messageItemView` | `(message: CometChat.BaseMessage) => JSX.Element` | Entire message list item | Message results |
+| `messageLeadingView` | `(message: CometChat.BaseMessage) => JSX.Element` | Message avatar / left section | Message results |
+| `messageTitleView` | `(message: CometChat.BaseMessage) => JSX.Element` | Message title text | Message results |
+| `messageSubtitleView` | `(message: CometChat.BaseMessage) => JSX.Element` | Message subtitle text | Message results |
+| `messageTrailingView` | `(message: CometChat.BaseMessage) => JSX.Element` | Message right section | Message results |
-With this function, you can assign a custom leading view of an conversation in the search result. For more information, refer to the [leadingView](/ui-kit/react/conversations#leadingview) prop of the `CometChatConversations` component.
+### Conversation View Slots
-#### ConversationTitleView
+The conversation view slots (`conversationItemView`, `conversationLeadingView`, `conversationTitleView`, `conversationSubtitleView`, `conversationTrailingView`, `conversationOptions`) follow the same pattern as the [CometChatConversations](/ui-kit/react/conversations) component. Refer to the Conversations component documentation for detailed examples.
-With this function, you can assign a custom title view to an conversation in the search result. For more information, refer to the [titleView](/ui-kit/react/conversations#titleview) prop of the `CometChatConversations` component.
+### messageItemView
-#### ConversationSubtitleView
-
-With this function, you can assign a custom subtitle view to an conversation in the search result. For more information, refer to the [subtitleView](/ui-kit/react/conversations#subtitleview) prop of the `CometChatConversations` component.
-
-#### ConversationTrailingView
-
-With this function, you can assign a custom trailing view to an conversation in the search result. For more information, refer to the [trailingView](/ui-kit/react/conversations#trailingview) prop of the `CometChatConversations` component.
-
-#### ConversationOptions
-
-A function that returns a list of actions available when hovering over a conversation item in the search result. For more information, refer to the [options](/ui-kit/react/conversations#options) prop of the `CometChatConversations` component.
-
-#### MessageItemView
-
-With this function, you can assign a custom item view of a message in the search result.
-
-Shown below is the default message search interface.
-
-
-
-
-
-The customized message search interface is displayed below.
+Replace the entire message list item in search results.
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatSearch } from "@cometchat/chat-uikit-react";
@@ -395,15 +296,11 @@ const getMessageItemView = (message: CometChat.BaseMessage) => {
);
};
-;
+;
```
-
-
-
-```css
+
+```css lines
.cometchat-search__message-list-item {
background: var(--cometchat-extended-primary-color-100);
border-bottom: 1px solid var(--cometchat-border-color-highlight);
@@ -423,34 +320,20 @@ const getMessageItemView = (message: CometChat.BaseMessage) => {
font: var(--cometchat-font-body-regular);
}
```
-
-
-***
-
-#### MessageLeadingView
+### messageLeadingView
-With this function, you can assign a custom leading view of a message in the search result.
-
-Shown below is the default message leading view interface.
-
-
-
-
-
-The customized message leading view interface is displayed below.
+Replace the message avatar / left section in search results.
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatSearch } from "@cometchat/chat-uikit-react";
@@ -462,15 +345,11 @@ const getMessageLeadingView = (message: CometChat.BaseMessage) => {
);
};
-;
+;
```
-
-
-
-```css
+
+```css lines
.cometchat-search__message-list-item-leading-view {
height: 48px;
width: 48px;
@@ -486,34 +365,20 @@ const getMessageLeadingView = (message: CometChat.BaseMessage) => {
width: 32px;
}
```
-
-
-***
-
-#### MessageTitleView
+### messageTitleView
-With this function, you can assign a custom title view of a message in the search result.
-
-Shown below is the default message title view interface.
-
-
-
-
-
-The customized message title view interface is displayed below.
+Replace the message title text in search results.
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatSearch } from "@cometchat/chat-uikit-react";
@@ -531,15 +396,11 @@ const getMessageTitleView = (message: CometChat.BaseMessage) => {
);
};
-;
+;
```
-
-
-
-```css
+
+```css lines
.cometchat-search__message-list-item-title {
display: flex;
align-items: center;
@@ -558,34 +419,20 @@ const getMessageTitleView = (message: CometChat.BaseMessage) => {
text-decoration: underline;
}
```
-
-
-***
-
-#### MessageSubtitleView
-
-With this function, you can assign a custom subtitle view of a message in the search result.
-
-Shown below is the default message subtitle view interface.
-
-
-
-
+### messageSubtitleView
-The customized message subtitle view interface is displayed below.
+Replace the message subtitle text in search results.
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatSearch } from "@cometchat/chat-uikit-react";
@@ -602,15 +449,11 @@ const getMessageSubtitleView = (message: CometChat.BaseMessage) => {
);
};
-;
+;
```
-
-
-
-```css
+
+```css lines
.cometchat-search__message-list-item-subtitle {
background: var(--cometchat-extended-primary-color-100);
padding: var(--cometchat-padding-1);
@@ -630,34 +473,20 @@ const getMessageSubtitleView = (message: CometChat.BaseMessage) => {
font: var(--cometchat-font-body-regular);
}
```
-
-
-***
-
-#### MessageTrailingView
-
-With this function, you can assign a custom trailing view of a message in the search result.
-
-Shown below is the default message trailing view interface.
+### messageTrailingView
-
-
-
-
-The customized message trailing view interface is displayed below.
+Replace the message right section in search results.
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatSearch } from "@cometchat/chat-uikit-react";
@@ -666,23 +495,19 @@ const getMessageTrailingView = (message: CometChat.BaseMessage) => {
const now = new Date();
const time = new Date(timestamp);
- // Calculate time difference
const diffInMs = now.getTime() - time.getTime();
const diffInMinutes = Math.floor(diffInMs / (1000 * 60));
const diffInHours = Math.floor(diffInMs / (1000 * 60 * 60));
- // Determine the labels
- let backgroundColorClass = "cometchat-search__message-trailing-view-min"; // Default (less than 1 hour)
- let topLabel = `${diffInMinutes}`; // Default minutes
- let bottomLabel = `${diffInMinutes === 1 ? "Min ago" : "Mins ago"}`; // Default "Mins ago"
+ let backgroundColorClass = "cometchat-search__message-trailing-view-min";
+ let topLabel = `${diffInMinutes}`;
+ let bottomLabel = `${diffInMinutes === 1 ? "Min ago" : "Mins ago"}`;
if (diffInHours >= 1 && diffInHours <= 10) {
- // 1-10 hours
backgroundColorClass = "cometchat-search__message-trailing-view-hour";
topLabel = `${diffInHours}`;
bottomLabel = `${diffInHours === 1 ? "Hour ago" : "Hours ago"}`;
} else if (diffInHours > 10) {
- // More than 10 hours
backgroundColorClass = "cometchat-search__message-trailing-view-date";
topLabel = time.toLocaleDateString("en-US", { day: "numeric" });
bottomLabel = time.toLocaleDateString("en-US", {
@@ -699,15 +524,11 @@ const getMessageTrailingView = (message: CometChat.BaseMessage) => {
);
};
-;
+;
```
-
-
-
-```css
+
+```css lines
.cometchat-search__message-trailing-view {
display: flex;
flex-direction: column;
@@ -745,57 +566,112 @@ const getMessageTrailingView = (message: CometChat.BaseMessage) => {
color: #6a5b99;
}
```
-
-
-***
+### messageSentAtDateTimeFormat
-#### Message SentAt Date Time Format
+Customize the message sent-at timestamp format using a `CalendarObject`.
-The `MessageSentAtDateTimeFormat` property allows you to customize the **Message Sent At** timestamp displayed in the Search.
-
-Default Date Time Format:
-
-```javascript
-new CalendarObject({
- yesterday: "DD MMM, YYYY", // Example: "04 Jun, 2025"
- otherDays: `DD MMM, YYYY`, // Example: "04 Jun, 2025"
- today: "DD MMM, YYYY" // Example: "04 Jun, 2025"
-});
-```
-
-The following example demonstrates how to modify the **Sent At** timestamp format using a custom [`CalendarObject`](/ui-kit/react/localize#calendarobject).
-
-
-
-```ts
+```ts lines
import {
CometChatSearch,
CalendarObject
} from "@cometchat/chat-uikit-react";
-// Define a custom date format pattern
function getDateFormat() {
const dateFormat = new CalendarObject({
- today: `DD MMM, hh:mm A`, // Example: "25 Jan, 10:30 AM"
- yesterday: `DD MMM, hh:mm A`, // Example: "25 Jan, 10:30 AM"
- otherDays: `DD MMM, hh:mm A`, // Example: "25 Jan, 10:30 AM"
+ today: `DD MMM, hh:mm A`,
+ yesterday: `DD MMM, hh:mm A`,
+ otherDays: `DD MMM, hh:mm A`,
});
return dateFormat;
}
-// Apply the custom format to the CometChatSearch component
;
```
-
+
+If a property is not passed in the CalendarObject, the component checks the [global configuration](/ui-kit/react/localize#customisation) first, then falls back to the component's default formatting.
+
-
+## Theme and Styling
-***
+Using CSS, customize the look and feel of the component. The root CSS class is `.cometchat-search`.
-#### Text Formatters
+
+
+
+
+```tsx lines
+
+```
+
+```css lines
+.cometchat-search * {
+ font-family: 'Times New Roman', Times !important;
+}
-Assigns the list of text formatters. If the provided list is not null, it sets the list. Otherwise, it assigns the default text formatters retrieved from the data source.
+.cometchat-search {
+ gap: 0;
+}
+
+.cometchat-search__header {
+ background-color: var(--cometchat-primary-color);
+}
+
+.cometchat-search__back-button .cometchat-button .cometchat-button__icon {
+ background: var(--cometchat-static-white);
+}
+
+.cometchat-search__body {
+ padding-block: var(--cometchat-padding-3);
+ background-color: var(--cometchat-primary-color);
+}
+
+.cometchat-search-conversations__see-more .cometchat-button,
+.cometchat-search-messages__see-more .cometchat-button {
+ text-decoration: underline;
+ text-decoration-color: var(--cometchat-primary-color);
+ text-underline-offset: 2px;
+}
+
+.cometchat-search-conversations__see-more .cometchat-button .cometchat-button__text,
+.cometchat-search-messages__see-more .cometchat-button .cometchat-button__text {
+ font-weight: 300;
+}
+
+.cometchat-search__conversations {
+ padding-top: var(--cometchat-padding-3);
+ background-color: var(--cometchat-extended-primary-color-100);
+}
+
+.cometchat-search__messages {
+ margin-top: var(--cometchat-margin-4);
+}
+
+.cometchat-search__conversations .cometchat-list__header {
+ background-color: var(--cometchat-extended-primary-color-100);
+}
+
+.cometchat-search__conversations .cometchat-list__header-title {
+ background-color: var(--cometchat-extended-primary-color-100);
+}
+
+.cometchat-search__conversations .cometchat-list-item {
+ background-color: var(--cometchat-extended-primary-color-100);
+}
+
+.cometchat-search-messages__date-separator {
+ display: none;
+}
+
+.cometchat-search__body-filter .cometchat-button__text {
+ color: var(--cometchat-text-color-secondary);
+}
+
+.cometchat-search .cometchat-list__header-title {
+ color: var(--cometchat-text-color-primary);
+ font-weight: 700;
+}
+```
diff --git a/ui-kit/react/shortcut-formatter-guide.mdx b/ui-kit/react/shortcut-formatter-guide.mdx
index b6c5d3810..95e64d24d 100644
--- a/ui-kit/react/shortcut-formatter-guide.mdx
+++ b/ui-kit/react/shortcut-formatter-guide.mdx
@@ -1,7 +1,22 @@
---
title: "ShortCut Formatter"
+description: "Implement !shortcut style text expansions with extension APIs or dialogs in CometChat React UI Kit."
---
+
+
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Key class | `ShortcutFormatter` (extends `CometChatTextFormatter`) |
+| Init | `CometChatUIKit.init(UIKitSettings)` then `CometChatUIKit.login("UID")` |
+| Track character | `!` — triggers shortcut expansion in the message composer |
+| Sample app | [GitHub](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app) |
+| Related | [Custom Text Formatter](/ui-kit/react/custom-text-formatter-guide) · [All Guides](/ui-kit/react/guide-overview) |
+
+
+
+
## Overview
The `ShortCutFormatter` class extends the [CometChatTextFormatter](/ui-kit/react/custom-text-formatter-guide) class to provide a mechanism for handling shortcuts within messages. This guide will walk you through the process of using `ShortCutFormatter` to implement shortcut extensions in your CometChat application.
@@ -16,13 +31,13 @@ Here are the steps to create a `ShortCutFormatter` for CometChat using the Comet
1. Firstly, you need to import `CometChatTextFormatter` from the CometChat UI Kit react library.
-```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`.
-```java
+```javascript lines
class ShortCutFormatter extends CometChatTextFormatter {
...
}
@@ -30,13 +45,13 @@ class ShortCutFormatter extends CometChatTextFormatter {
3. Set up the `trackCharacter` and define any necessary private fields.
-```javascript
+```javascript lines
this.setTrackingCharacter("!");
```
4. Implement the `onKeyDown` method to handle key events and trigger actions based on defined shortcuts.
-```javascript
+```javascript lines
onKeyDown(event: KeyboardEvent) {
// Your implementation
}
@@ -44,7 +59,7 @@ onKeyDown(event: KeyboardEvent) {
5. Implement any additional methods required for your custom formatter, such as opening and closing dialogs, handling button clicks, and formatting text.
-```typescript
+```typescript lines
openDialog(buttonText: string) {
// Your implementation
}
@@ -80,7 +95,7 @@ Below is an example demonstrating how to use a custom formatter class in compone
-```ts
+```ts lines
import { CometChatTextFormatter } from "@cometchat/chat-uikit-react";
import DialogHelper from "./Dialog";
import { CometChat } from "@cometchat/chat-sdk-javascript";
@@ -196,7 +211,7 @@ export default ShortcutFormatter;
-```tsx
+```tsx lines
import React from "react";
import ReactDOM from "react-dom";
import { CometChatUIEvents, PanelAlignment } from "@cometchat/chat-uikit-react";
@@ -259,7 +274,7 @@ export default class DialogHelper {
-```tsx
+```tsx lines
import ShortcutFormatter from "./ShortCutFormatter";
import { CometChatMessageComposer } from "@cometchat/chat-uikit-react";
@@ -271,3 +286,22 @@ import { CometChatMessageComposer } from "@cometchat/chat-uikit-react";
***
+
+## Next Steps
+
+
+
+ Build custom inline text patterns.
+
+
+ Customize the message input component.
+
+
+ Browse all feature and formatter guides.
+
+
+ Full working sample application on GitHub.
+
+
+
+***
diff --git a/ui-kit/react/sound-manager.mdx b/ui-kit/react/sound-manager.mdx
index d0b5f0c20..a47157e5e 100644
--- a/ui-kit/react/sound-manager.mdx
+++ b/ui-kit/react/sound-manager.mdx
@@ -1,62 +1,101 @@
---
title: "Sound Manager"
+description: "Manage and customize audio cues for incoming/outgoing calls and messages in CometChat React UI Kit."
---
-## 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 calls.
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatSoundManager } from "@cometchat/chat-uikit-react";` |
+| Play sound | `CometChatSoundManager.play(CometChatSoundManager.Sound.incomingCall)` — or pass custom audio path as second arg |
+| Pause sound | `CometChatSoundManager.pause()` |
+| Sound events | `incomingCall`, `outgoingCall`, `incomingMessage`, `incomingMessageFromOther`, `outgoingMessage` |
+| Source | [GitHub](https://github.com/cometchat/cometchat-uikit-react/blob/v6/src/resources/CometChatSoundManager/CometChatSoundManager.ts) |
+
+
+
+`CometChatSoundManager` is a helper class for managing and playing audio cues in the UI Kit — incoming/outgoing calls and messages.
+
+`Sound` is a frozen object on `CometChatSoundManager`, not a separate export. Access sound event keys via `CometChatSoundManager.Sound`.
+
+---
## Methods
-### Play Sound
+### play
-`CometChatSoundManager.play` method plays the default audio resource for incoming & outgoing calls. It also allows for customisation of the audio resources. You can pass a mp3 file asset path of your choice.
+Plays the default or custom audio resource for a given sound event.
-Here are the available methods for triggering sound playback:
+| Parameter | Type | Description |
+| --- | --- | --- |
+| `sound` | `"incomingCall" \| "incomingMessage" \| "incomingMessageFromOther" \| "outgoingCall" \| "outgoingMessage"` | Sound event key |
+| `customSound` | `string \| null` | Optional custom audio file URL. Defaults to `null` (uses built-in sound). |
-* `play(sound: Sound)`: This method plays predefined sounds for various events such as incoming and outgoing calls and messages.
+### pause
-* `play(sound: Sound, filePath: string)`: This method is capable of playing a custom sound for a particular event by specifying the path to a custom MP3 file.
+Pauses the currently playing sound and resets playback position.
-### Pause Sound
+### onIncomingMessage
-The `CometChatSoundManager.pause` method pauses the currently playing sound in the CometChatSoundManager.
+Plays the incoming message sound directly. Accepts an optional `customSound` URL.
-* `pause()`: This method pauses any sound currently being played.
+### onIncomingOtherMessage
-## Usage
+Plays the incoming message from another user sound directly. Accepts an optional `customSound` URL.
-Here is how to use CometChatSoundManager:
+### onOutgoingMessage
-
-
-```js
-//Trigger the audio sound for an incoming call.
-CometChatSoundManager.play(Sound.incomingCall);
+Plays the outgoing message sound directly. Accepts an optional `customSound` URL.
-//Trigger the audio sound of your choice for an incoming call.
-CometChatSoundManager.play(Sound.incomingCall, "MP3_FILE_ASSET_PATH");
+### onIncomingCall
-//Pause the ongoing audio sound
-CometChatSoundManager.pause();
-```
+Plays the incoming call sound (loops). Accepts an optional `customSound` URL.
-
+### onOutgoingCall
-
-```ts
-//Trigger the audio sound for an incoming call
-CometChatSoundManager.play(Sound.incomingCall);
+Plays the outgoing call sound (loops). Accepts an optional `customSound` URL.
-//Trigger the audio sound of your choice for an incoming call
-CometChatSoundManager.play(Sound.incomingCall, "MP3_FILE_ASSET_PATH");
+### hasInteracted
-//Pause the ongoing audio sound
-CometChatSoundManager.pause();
-```
+Returns `boolean` — checks whether the user has interacted with the page (required by browser autoplay policies).
+
+---
+
+## Sound Events
-
+| Event Key | When it plays |
+| --- | --- |
+| `incomingCall` | Incoming call detected |
+| `outgoingCall` | Outgoing call initiated |
+| `incomingMessage` | New message received from the current conversation |
+| `incomingMessageFromOther` | New message received from a different conversation |
+| `outgoingMessage` | Message sent |
-
+Access via `CometChatSoundManager.Sound.incomingCall`, etc.
+
+---
+
+## Usage
+
+```ts lines
+import { CometChatSoundManager } from "@cometchat/chat-uikit-react";
+
+// Play default incoming call sound
+CometChatSoundManager.play(CometChatSoundManager.Sound.incomingCall);
+
+// Play custom sound for incoming message
+CometChatSoundManager.play(CometChatSoundManager.Sound.incomingMessage, "MP3_FILE_ASSET_PATH");
+
+// Play incoming message from other conversation
+CometChatSoundManager.play(CometChatSoundManager.Sound.incomingMessageFromOther);
+
+// Pause the ongoing sound
+CometChatSoundManager.pause();
+
+// Use individual method directly
+CometChatSoundManager.onIncomingCall();
+CometChatSoundManager.onOutgoingMessage("CUSTOM_AUDIO_PATH");
+```
-By using the CometChatSoundManager, you can enhance the user experience in your chat application by integrating audible cues for chat interactions.
diff --git a/ui-kit/react/theme.mdx b/ui-kit/react/theme.mdx
index 98f164289..6a0644651 100644
--- a/ui-kit/react/theme.mdx
+++ b/ui-kit/react/theme.mdx
@@ -1,43 +1,112 @@
---
title: "Customizing UI With Theming"
sidebarTitle: "Overview"
+description: "Customize the CometChat React UI Kit appearance using CSS variables for colors, fonts, dark mode, and component-specific styling."
---
-Theming allows you to define the **look and feel** of your app by adjusting **colors, fonts, and other styles**. Using **CSS variables**, you can create a consistent and **on-brand** chat experience.
+
-***
+| Field | Value |
+| --- | --- |
+| Goal | Customize UI Kit appearance (colors, fonts, dark mode) via CSS variables |
+| Where | `App.css` (global) — imported in app entry via `import "./App.css";` |
+| Step 1 | Import base stylesheet: `@import url("@cometchat/chat-uikit-react/css-variables.css");` |
+| Step 2 | Override variables on `.cometchat` (global) or `.cometchat-` (component-specific) |
+| Step 3 (dark mode) | Override on `.cometchat-root[data-theme="dark"] .cometchat` or use `@media (prefers-color-scheme: dark)` |
+| Key tokens | `--cometchat-primary-color`, `--cometchat-neutral-color-300`, `--cometchat-font-family`, `--cometchat-background-color-03` |
+| Constraints | Global CSS only (no CSS Modules), no `!important`, component-level overrides beat global |
+| Full token list | [Color Resources](/ui-kit/react/theme/color-resources) | [GitHub source](https://github.com/cometchat/cometchat-uikit-react/blob/v6/src/styles/css-variables.css) |
-## **Importing the Stylesheet**
+
-To enable theming, first, **import the base stylesheet** containing default styles and variables.
+Theming controls the look and feel of the chat UI — colors, fonts, and other styles — through CSS variables.
-
-
-```css
-@import url("@cometchat/chat-uikit-react/css-variables.css");
+
+Prerequisites:
+1. Import the base stylesheet: `@import url("@cometchat/chat-uikit-react/css-variables.css");` in `App.css`
+2. Import the CSS file at the app entry: `import "./App.css";` in `App.tsx`
+3. All selectors assume the UI Kit renders under a `.cometchat` root wrapper
+4. Use global CSS (not CSS Modules with hashed class names) — hashed selectors won't match
+
+
+---
+
+## Root Wrapper (`.cometchat`)
+
+All selectors in this doc are scoped under `.cometchat`, the class the UI Kit renders on its root element.
+
+```tsx lines
+export default function App() {
+ return (
+
+ {/* UI Kit components */}
+
+ );
+}
```
-
+For `data-theme`, place it on the wrapper and scope dark theme overrides to `.cometchat` inside.
-
+---
+
+## Theming Contract
+
+**Inputs**
+- Base stylesheet import: `@import url("@cometchat/chat-uikit-react/css-variables.css");`
+- Global CSS variables on `.cometchat`
+- Component-scoped variables on `.cometchat .cometchat-`
+- Optional element-level CSS overrides for specific selectors
+- Optional theme mode selector: `.cometchat-root[data-theme="dark"] .cometchat` or `@media (prefers-color-scheme: dark)`
-***
+**Precedence**
+1. Element-level CSS overrides (most specific)
+2. Component-scoped variables (`.cometchat .cometchat-conversations { --var }`)
+3. Global variables (`.cometchat { --var }`)
+4. Defaults from `css-variables.css` (least specific)
-## **Global Theming with CSS Variables**
+**Outputs**
+- Primary tokens change outgoing bubbles, buttons, and active states
+- Background tokens change panels and surfaces
+- Text/icon tokens change highlight accents
+- Font tokens change typography across the UI
-Customize the **entire chat UI** by overriding CSS variables in your **global stylesheet**.
+---
+
+## Importing the Stylesheet
+
+```css title="App.css" lines
+@import url("@cometchat/chat-uikit-react/css-variables.css");
+```
+
+---
-### **Example: Changing Colors & Fonts**
+## Global Theming with CSS Variables
-The following **CSS variables** customize colors, fonts, and other elements.
+Override CSS variables in the global stylesheet to customize the entire chat UI.
+
+Use `App.css` for global overrides scoped under `.cometchat`. Use the runtime `setProperty` approach only for live theme changes without a reload.
+
+
-
-```tsx
+
+```css lines
+.cometchat {
+ --cometchat-primary-color: #f76808;
+ --cometchat-neutral-color-300: #E8E8E8;
+ --cometchat-background-color-03: #feede1;
+ --cometchat-extended-primary-color-500: #fbaa75;
+ --cometchat-icon-color-highlight: #f76808;
+ --cometchat-text-color-highlight: #f76808;
+}
+```
+
+
+```tsx lines
import { useEffect } from "react";
const App = () => {
@@ -48,43 +117,46 @@ const App = () => {
);
}, []);
- return
{/* Your chat UI here */}
;
+ return
{/* Chat UI here */}
;
};
export default App;
```
-
+
-
-```css
-.cometchat {
- --cometchat-primary-color: #f76808;
- --cometchat-neutral-color-300: #fff;
- --cometchat-background-color-03: #feede1;
- --cometchat-extended-primary-color-500: #fbaa75;
- --cometchat-icon-color-highlight: #f76808;
- --cometchat-text-color-highlight: #f76808;
-}
-```
+All primary-colored elements (outgoing bubbles, buttons, active states, links) change to orange (#f76808). Background panels change to light peach (#feede1). Font changes to Times New Roman.
-
+---
-
+## Top Tokens (Quick Mapping)
+
+For the complete list, see [Color Resources](/ui-kit/react/theme/color-resources).
+
+| Token | Common usage |
+| --- | --- |
+| `--cometchat-primary-color` | Primary accent color (buttons, outgoing bubbles, active states) |
+| `--cometchat-extended-primary-color-900` | Darker primary shade (outgoing bubble shade) |
+| `--cometchat-extended-primary-color-500` | Mid primary shade (secondary accents/hover) |
+| `--cometchat-neutral-color-300` | Neutral surface (incoming bubbles/panels) |
+| `--cometchat-background-color-03` | Panel background surface |
+| `--cometchat-text-color-highlight` | Highlight text color |
+| `--cometchat-icon-color-highlight` | Highlight icon color |
+| `--cometchat-message-seen-color` | Seen/read indicator color |
+| `--cometchat-font-family` | Global font family (`'Roboto', 'Inter'` default) |
+| `--cometchat-radius-max` | Maximum corner radius used across UI elements |
-***
+---
-## **Component-Specific Theming**
+## Component-Specific Theming
-Want to apply **different styles to specific components**? Override **CSS variables within the component’s class**.
+Override CSS variables within a component's class to apply different styles to specific components.
-
-
-```css
+```css title="App.css" lines
.cometchat .cometchat-conversations {
--cometchat-primary-color: #f76808;
--cometchat-extended-primary-color-500: #fbaa75;
@@ -94,44 +166,40 @@ Want to apply **different styles to specific components**? Override **CSS variab
}
```
-
-
-
+Only the Conversations component changes — primary color becomes orange, highlight text becomes amber, avatars get 12px border radius. Other components remain unchanged.
-***
+---
-## **Advanced Customization with CSS Overrides**
+## Advanced Customization with CSS Overrides
-For full control over component styling, use **CSS overrides**.
+Target specific elements directly for full control over component styling.
-
-
-```css
+```css title="App.css" lines
.cometchat-conversations .cometchat-avatar,
.cometchat-conversations .cometchat-avatar__image {
border-radius: 12px;
}
```
-
-
-
+Avatar images in the Conversations list change from circular to rounded-square (12px radius).
-***
+---
-## **Dark & Light Theme Support**
+## Dark and Light Theme Support
-You can **switch** between light and dark modes.
+
+Choose ONE dark mode strategy:
+1. App-controlled: set `data-theme` on the wrapper (e.g., `.cometchat-root`) and scope overrides like `.cometchat-root[data-theme="dark"] .cometchat { ... }`
+2. OS-controlled: use `@media (prefers-color-scheme: dark)` scoped to `.cometchat`
+
-### **Example: Enabling Dark Mode**
+### Enabling Dark Mode
-
-
-```tsx
+```tsx title="App.tsx" lines
import { useEffect, useState } from "react";
const App = () => {
@@ -155,27 +223,19 @@ const App = () => {
export default App;
```
-
+The wrapper tracks the user's OS preference and sets `data-theme`, which switches palettes in CSS.
-
-
-***
-
-## **Customizing Light & Dark Theme**
-
-Define different **color schemes** for **light and dark modes**.
+### Customizing Light and Dark Theme
-
-
-```css
+```css title="App.css" lines
/* Default (Light) Theme */
.cometchat {
--cometchat-primary-color: #f76808;
- --cometchat-neutral-color-300: #fff;
+ --cometchat-neutral-color-300: #E8E8E8;
--cometchat-background-color-03: #feede1;
--cometchat-extended-primary-color-500: #fbaa75;
--cometchat-icon-color-highlight: #f76808;
@@ -183,44 +243,89 @@ Define different **color schemes** for **light and dark modes**.
}
/* Dark Theme */
-@media (prefers-color-scheme: dark) {
- .cometchat {
- --cometchat-primary-color: #f76808;
- --cometchat-neutral-color-300: #311502;
- --cometchat-background-color-03: #451d02;
- --cometchat-extended-primary-color-500: #943e05;
- --cometchat-icon-color-highlight: #f76808;
- --cometchat-text-color-highlight: #f76808;
- --cometchat-message-seen-color: #f76808;
- --cometchat-neutral-color-50: #1a1a1a;
- }
+.cometchat-root[data-theme="dark"] .cometchat {
+ --cometchat-primary-color: #f76808;
+ --cometchat-neutral-color-300: #311502;
+ --cometchat-background-color-03: #451d02;
+ --cometchat-extended-primary-color-500: #943e05;
+ --cometchat-icon-color-highlight: #f76808;
+ --cometchat-text-color-highlight: #f76808;
+ --cometchat-message-seen-color: #f76808;
+ --cometchat-neutral-color-50: #1a1a1a;
}
```
-
+For OS-controlled dark mode, wrap the dark overrides in `@media (prefers-color-scheme: dark)` and keep the `.cometchat` scope.
-
+Light mode uses orange (#f76808) with peach backgrounds; dark mode uses the same orange accent but with dark brown backgrounds (#311502, #451d02) for proper contrast.
-***
+---
-## **📚 Helpful Resources**
+## Examples
-Enhance your design and development workflow with the following resources:
+### Brand color swap (global)
-
-
+```css title="App.css" lines
+.cometchat {
+ --cometchat-primary-color: #0f766e;
+ --cometchat-extended-primary-color-500: #14b8a6;
+ --cometchat-text-color-highlight: #0f766e;
+ --cometchat-icon-color-highlight: #0f766e;
+}
+```
-Explore the complete list of color variables and hex values on GitHub.
+Primary accents, buttons, and active states switch to teal.
-[View on GitHub](https://github.com/cometchat/cometchat-uikit-react/blob/v6/src/styles/css-variables.css#L198-L419)
+### Dark mode (app-controlled)
-
+```css title="App.css" lines
+.cometchat-root[data-theme="dark"] .cometchat {
+ --cometchat-background-color-03: #121212;
+ --cometchat-neutral-color-300: #1e1e1e;
+ --cometchat-text-color-highlight: #f76808;
+}
+```
-
+Panels and surfaces darken while accents remain visible.
-Access the Figma UI Kit for a fully integrated color palette and seamless customization.
+### Conversations-only override
-[View on Figma](https://www.figma.com/community/file/1442863561340379957/cometchat-ui-kit-for-web)
+```css title="App.css" lines
+.cometchat .cometchat-conversations {
+ --cometchat-primary-color: #f76808;
+ --cometchat-message-seen-color: #f76808;
+ --cometchat-radius-max: 12px;
+}
+```
+
+Only the Conversations component changes; other components stay default.
+### Bubble styling (incoming/outgoing)
+
+```css title="App.css" lines
+.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body {
+ --cometchat-primary-color: #f76808;
+ --cometchat-extended-primary-color-900: #fbaa75;
+}
+
+.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body {
+ --cometchat-neutral-color-300: #f1f5f9;
+}
+```
+
+Outgoing bubbles use orange; incoming bubbles use a light slate. For more variants, see [Message Bubble Styling](/ui-kit/react/theme/message-bubble-styling).
+
+## Resources
+
+
+
+Complete list of color variables and hex values on GitHub.
+
+[View on GitHub](https://github.com/cometchat/cometchat-uikit-react/blob/v6/src/styles/css-variables.css#L198-L419)
+
+
+Figma UI Kit with fully integrated color palette.
+
+[View on Figma](https://www.figma.com/community/file/1442863561340379957/cometchat-ui-kit-for-web)
diff --git a/ui-kit/react/theme/color-resources.mdx b/ui-kit/react/theme/color-resources.mdx
index d52c5779c..071aeb765 100644
--- a/ui-kit/react/theme/color-resources.mdx
+++ b/ui-kit/react/theme/color-resources.mdx
@@ -1,71 +1,215 @@
---
title: "Color Resources"
+description: "Complete reference of all CSS variables and color tokens available in the CometChat React UI Kit, including primary, neutral, and semantic color palettes for light and dark modes."
---
-## Introduction
+
-The **Chat UI Kit** features a carefully crafted **color palette** designed for a **consistent and visually appealing** user experience. It follows the **Block, Element, Modifier (BEM)** methodology, ensuring **scalable styling** and easy **customization** by overriding the Kit’s CSS variables.
+| Field | Value |
+| --- | --- |
+| Goal | Override UI Kit color tokens to match a brand |
+| Where | `App.css` (global) — import in app entry via `import "./App.css";` |
+| Scope | Override variables on `.cometchat` (global) or `.cometchat-` (component-specific) |
+| Key tokens | `--cometchat-primary-color` (brand/accent), `--cometchat-neutral-color-300` (incoming bubbles, default `#E8E8E8`), `--cometchat-background-color-01` (main background) |
+| Dark mode | Source uses `[data-theme="dark"]` on `:root`. App-controlled: `.cometchat-root[data-theme="dark"] .cometchat` |
+| Source file | [css-variables.css on GitHub](https://github.com/cometchat/cometchat-uikit-react/blob/v6/src/styles/css-variables.css) |
+| Constraints | Global CSS only (no CSS Modules), no `!important`, component-level overrides take precedence over global |
-***
+
+
+The UI Kit's color palette uses CSS variables for consistent styling. Override these tokens on `.cometchat` or `.cometchat-` to match your brand.
+
+{/*
+**Agent Guardrails**
+
+- Use the snippets exactly as shown; only change token values.
+- Keep `.cometchat` and `.cometchat-conversations` intact — these are the tested selectors.
+- Keep overrides in global CSS (`App.css`), not CSS Modules.
+- Dark mode examples assume `data-theme` is set on the wrapper element. If `data-theme` is set elsewhere, update the selector to match.
+ */}
+
+
+Prerequisites:
+1. Import the base stylesheet: `@import url("@cometchat/chat-uikit-react/css-variables.css");` in `App.css`
+2. Import the CSS file at the app entry: `import "./App.css";` in `App.tsx`
+3. All overrides must target `.cometchat` or a `.cometchat-` class
+4. Use global CSS (not CSS Modules with hashed class names) — hashed selectors won't match
+
+
+---
+
+## Selector Contract
+
+Canonical selector patterns for overriding colors.
+
+**Global override**
+```css lines
+.cometchat { --token: value; }
+```
+
+**Component override**
+```css lines
+.cometchat .cometchat-conversations { --token: value; }
+```
+
+**Dark mode override (app-controlled)**
+```css lines
+.cometchat-root[data-theme="dark"] .cometchat { --token: value; }
+```
+
+The source stylesheet defines dark mode defaults on `[data-theme="dark"]` at the `:root` level. When controlling dark mode from the app, place `data-theme` on the wrapper and scope overrides accordingly.
+
+---
+
+## CSS Variable Reference
+
+This table maps every commonly used token to what it visually controls.
+
+| Variable | What It Controls | Default (Light) | Used By |
+| --- | --- | --- | --- |
+| `--cometchat-primary-color` | Brand accent, outgoing bubble bg, active states, links, buttons | `#6852D6` | Outgoing bubbles, send button, active tabs, links |
+| `--cometchat-neutral-color-300` | Incoming bubble background, borders | `#E8E8E8` | Incoming message bubbles, border-color-default |
+| `--cometchat-neutral-color-400` | Secondary backgrounds, dividers | `#DCDCDC` | Borders, secondary panels |
+| `--cometchat-neutral-color-500` | Muted text, placeholders | `#A1A1A1` | Placeholder text, disabled states |
+| `--cometchat-neutral-color-600` | Secondary text | `#727272` | Timestamps, subtitles |
+| `--cometchat-neutral-color-700` | Primary text | `#5B5B5B` | Main body text |
+| `--cometchat-neutral-color-800` | Headings, strong text | `#434343` | Component titles, names |
+| `--cometchat-neutral-color-900` | Strongest text | `#141414` | Text color primary |
+| `--cometchat-neutral-color-50` | White surface | `#FFFFFF` | Background color 01, text-color-white |
+| `--cometchat-background-color-01` | Main app background | `var(--cometchat-neutral-color-50)` | Root container background |
+| `--cometchat-background-color-02` | Secondary/panel background | `var(--cometchat-neutral-color-100)` | Sidebars, panels |
+| `--cometchat-background-color-03` | Tertiary background | `var(--cometchat-neutral-color-200)` | Nested panels, cards |
+| `--cometchat-background-color-04` | Quaternary background | `var(--cometchat-neutral-color-300)` | Additional surface layer |
+| `--cometchat-extended-primary-color-50` through `900` | Primary color scale (lightest to darkest) | See palette below | Hover states, gradients, shades |
+| `--cometchat-font-family` | All text in UI Kit | `'Roboto', 'Inter'` | Global typography |
+| `--cometchat-text-color-highlight` | Highlighted/linked text | `var(--cometchat-primary-color)` | Links, mentions, highlights |
+| `--cometchat-icon-color-highlight` | Highlighted icon color | `var(--cometchat-primary-color)` | Active icons, selected states |
+| `--cometchat-text-color-secondary` | Secondary/caption text | `var(--cometchat-neutral-color-600)` | Timestamps, subtitles, captions |
+| `--cometchat-icon-color-secondary` | Secondary icon color | `var(--cometchat-neutral-color-500)` | Inactive icons |
+| `--cometchat-border-color-default` | Default border color | `var(--cometchat-neutral-color-300)` | Dividers, input borders |
+| `--cometchat-info-color` | Informational states | `#0B7BEA` | Info callouts |
+| `--cometchat-warning-color` | Warning states | `#FFAB00` | Warning callouts |
+| `--cometchat-success-color` | Success states | `#09C26F` | Online indicators, success messages |
+| `--cometchat-error-color` | Error states | `#F44649` | Error messages, validation |
+| `--cometchat-message-seen-color` | Seen/read indicator color | (dark mode only: `#56E8A7`) | Read receipts |
+| `--cometchat-primary-button-background` | Primary button fill | `var(--cometchat-primary-color)` | Send button, action buttons |
+| `--cometchat-primary-button-text` | Primary button text | `#FFFFFF` (static white) | Button labels |
+| `--cometchat-primary-button-icon` | Primary button icon | `#FFFFFF` (static white) | Button icons |
+| `--cometchat-secondary-button-background` | Secondary button fill | `var(--cometchat-neutral-color-900)` | Secondary action buttons |
+| `--cometchat-secondary-button-text` | Secondary button text | `var(--cometchat-neutral-color-900)` | Secondary button labels |
+| `--cometchat-secondary-button-icon` | Secondary button icon | `var(--cometchat-neutral-color-900)` | Secondary button icons |
+| `--cometchat-link-button` | Link button color | `var(--cometchat-info-color)` | Inline link buttons |
+| `--cometchat-fab-button-background` | FAB button fill | `var(--cometchat-primary-color)` | Floating action button |
+| `--cometchat-fab-button-icon` | FAB button icon | `#FFFFFF` (static white) | FAB icon |
+| `--cometchat-white-hover` | Hover state on white surfaces | `var(--cometchat-neutral-color-100)` | List item hover |
+| `--cometchat-white-pressed` | Pressed state on white surfaces | `var(--cometchat-neutral-color-300)` | List item press |
+
+---
+
+
+**CSS Specificity & Precedence Rules:**
+1. Component-level overrides (`.cometchat .cometchat-conversations { --var: val }`) take precedence over global overrides (`.cometchat { --var: val }`)
+2. Dark mode overrides (`[data-theme="dark"]`) take precedence over light mode defaults
+3. CSS variable overrides only affect properties the UI Kit theme binds to that variable — they do NOT change layout or spacing
+4. Always keep the `.cometchat` prefix to avoid leaking styles into the host app
+5. `!important` should never be needed — if it is, the selector specificity is wrong
+
+
+---
## Color Palette
-The **primary color** defines key actions, branding, and UI elements, while the **extended primary palette** provides variations for supporting components.
+The primary color defines key actions, branding, and UI elements, while the extended primary palette provides variations for supporting components.
-### **Primary Color**
+### Primary Color
-#### **Light Mode**
+#### Light Mode
-```python
---cometchat-primary-color: #6852d6;
---cometchat-extended-primary-color-50: #f9f8fd;
---cometchat-extended-primary-color-100: #edeafa;
---cometchat-extended-primary-color-200: #dcd7f6;
---cometchat-extended-primary-color-300: #ccc4f1;
---cometchat-extended-primary-color-400: #bbb1ed;
---cometchat-extended-primary-color-500: #aa9ee8;
---cometchat-extended-primary-color-600: #9a8be4;
---cometchat-extended-primary-color-700: #8978df;
---cometchat-extended-primary-color-800: #7965db;
---cometchat-extended-primary-color-900: #5d49be;
+```css lines
+--cometchat-primary-color: #6852D6;
+--cometchat-extended-primary-color-50: #F9F8FD;
+--cometchat-extended-primary-color-100: #EDEAFA;
+--cometchat-extended-primary-color-200: #DCD7F6;
+--cometchat-extended-primary-color-300: #CCC4F1;
+--cometchat-extended-primary-color-400: #BBB1ED;
+--cometchat-extended-primary-color-500: #AA9EE8;
+--cometchat-extended-primary-color-600: #9A8BE4;
+--cometchat-extended-primary-color-700: #8978DF;
+--cometchat-extended-primary-color-800: #7965DB;
+--cometchat-extended-primary-color-900: #5D49BE;
```
-***
+---
-#### **Dark Mode**
+#### Dark Mode
-```python
---cometchat-primary-color: #6852d6;
---cometchat-extended-primary-color-50: #15102b;
---cometchat-extended-primary-color-100: #1d173c;
---cometchat-extended-primary-color-200: #251e4d;
---cometchat-extended-primary-color-300: #2e245e;
---cometchat-extended-primary-color-400: #362b6f;
---cometchat-extended-primary-color-500: #3e3180;
+```css lines
+--cometchat-primary-color: #6852D6;
+--cometchat-extended-primary-color-50: #15102B;
+--cometchat-extended-primary-color-100: #1D173C;
+--cometchat-extended-primary-color-200: #251E4D;
+--cometchat-extended-primary-color-300: #2E245E;
+--cometchat-extended-primary-color-400: #362B6F;
+--cometchat-extended-primary-color-500: #3E3180;
--cometchat-extended-primary-color-600: #473892;
---cometchat-extended-primary-color-700: #4f3ea3;
---cometchat-extended-primary-color-800: #5745b4;
---cometchat-extended-primary-color-900: #7460d9;
+--cometchat-extended-primary-color-700: #4F3EA3;
+--cometchat-extended-primary-color-800: #5745B4;
+--cometchat-extended-primary-color-900: #7460D9;
```
-### **Extended Primary Colors**
+### Extended Primary Colors
-#### **Light Mode**
+#### Light Mode
-#### **Dark Mode**
+#### Dark Mode
+
+---
+
+## Complete End-to-End Example: Custom Brand Colors
+
+**Step 1:** Add to `App.css`:
+
+```css lines
+@import url("@cometchat/chat-uikit-react/css-variables.css");
+
+/* Light mode brand override */
+.cometchat {
+ --cometchat-primary-color: #f76808;
+ --cometchat-extended-primary-color-500: #fbaa75;
+ --cometchat-extended-primary-color-900: #c45206;
+ --cometchat-text-color-highlight: #f76808;
+ --cometchat-icon-color-highlight: #f76808;
+}
+
+/* Dark mode brand override */
+.cometchat-root[data-theme="dark"] .cometchat {
+ --cometchat-primary-color: #f76808;
+ --cometchat-extended-primary-color-500: #7a3404;
+ --cometchat-extended-primary-color-900: #fbaa75;
+}
+```
+
+**Step 2:** Ensure `App.tsx` imports the CSS:
+
+```tsx lines
+import "./App.css";
+// ... render CometChat UI Kit components
+```
+
+**Expected result:** All primary-colored elements (outgoing bubbles, buttons, active states, links) change from purple (#6852D6) to orange (#f76808) in both light and dark modes.
diff --git a/ui-kit/react/theme/message-bubble-styling.mdx b/ui-kit/react/theme/message-bubble-styling.mdx
index d95f2a1c0..9d025d014 100644
--- a/ui-kit/react/theme/message-bubble-styling.mdx
+++ b/ui-kit/react/theme/message-bubble-styling.mdx
@@ -1,14 +1,94 @@
---
title: "Message Bubble Styling"
+description: "Customize incoming and outgoing message bubble colors, backgrounds, and styles using CSS variables and class selectors in the CometChat React UI Kit."
---
-## Introduction
+
-We offer customizable message bubble styling to enhance user experience and match your app’s design. With distinct classes for incoming and outgoing messages, you can easily define colors, borders, and other styles. Each message type, from text to multimedia, has predefined classes for default styling, and developers can further customize using CSS.
+| Field | Value |
+| --- | --- |
+| Goal | Customize message bubble appearance (colors, backgrounds) per direction and message type |
+| Where | `App.css` (global) — imported in app entry via `import "./App.css";` |
+| Base selector | `.cometchat .cometchat-message-bubble-(incoming\|outgoing) .cometchat-message-bubble__body` |
+| Type modifier | Append `.cometchat-message-bubble__-message` to target specific types (`text`, `image`, `video`, `audio`, `file`, `delete`, `meeting`, `whiteboard`, `document`, `poll`, `sticker`) |
+| Key tokens | `--cometchat-primary-color` (outgoing bg), `--cometchat-neutral-color-300` (incoming bg), `--cometchat-extended-primary-color-900` (outgoing shade) |
+| Constraints | Global CSS only (no CSS Modules), no `!important`, type selectors override generic bubble selectors |
+
+
+
+Message bubble styling uses distinct CSS classes for incoming and outgoing messages. Each message type (text, image, video, audio, file, etc.) has predefined classes for default styling, customizable via CSS variable overrides.
+
+
+**Prerequisites before applying any CSS customization:**
+1. Import the base stylesheet: `@import url("@cometchat/chat-uikit-react/css-variables.css");` in your `App.css`
+2. Import your CSS file at the app entry: `import "./App.css";` in `App.tsx`
+3. All selectors assume the UI Kit renders under a `.cometchat` root wrapper
+4. Use **global CSS** (not CSS Modules with hashed class names) — hashed selectors won't match
+
+
+---
+
+## Selector Pattern
+
+Use this table to construct the correct CSS selector for any message bubble target. AI agents should use this pattern to generalize — do not guess selectors.
+
+| Target | Selector Pattern |
+| --- | --- |
+| All bubbles | `.cometchat .cometchat-message-bubble .cometchat-message-bubble__body` |
+| Outgoing bubbles (all types) | `.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body` |
+| Incoming bubbles (all types) | `.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body` |
+| Specific type (outgoing) | `.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body.cometchat-message-bubble__-message` |
+| Specific type (incoming) | `.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body.cometchat-message-bubble__-message` |
+| Action bubbles (no direction) | `.cometchat .cometchat-message-bubble__body .cometchat-action-bubble` |
+
+
+
+``
+
+`` is one of `text`, `image`, `video`, `audio`, `file`, `delete`, `meeting` (direct call), `whiteboard`, `document`, `poll`, `sticker`
+
+
+
+Link Preview Bubbles
+
+It reuse the `text-message` type selector since link previews are rendered inside text messages.
+
+
+---
+
+## CSS Variable Reference
+
+These are the CSS variables (tokens) used across message bubble styling. This table tells you exactly what each token controls — do not assume a token affects something not listed here.
+
+| Variable | What It Controls | Default (Light) | Commonly Used On |
+| --- | --- | --- | --- |
+| `--cometchat-primary-color` | Outgoing bubble background, primary accent | `#6852d6` | Outgoing bubbles (all types), action bubble accent |
+| `--cometchat-neutral-color-300` | Incoming bubble background | `#E8E8E8` | Incoming bubbles (all types) |
+| `--cometchat-extended-primary-color-900` | Outgoing bubble shade/gradient variant | `#5d49be` | Outgoing text bubble, link preview |
+| `--cometchat-extended-primary-color-800` | Outgoing bubble secondary shade | `#5745b4` | Direct call outgoing bubble |
+| `--cometchat-extended-primary-color-700` | Outgoing bubble tertiary shade | `#4f3ea3` | Poll outgoing bubble |
+| `--cometchat-neutral-color-400` | Incoming bubble secondary shade | varies | Link preview incoming |
+| `--cometchat-primary-button-background` | Primary button fill inside bubbles | matches primary | Whiteboard/document incoming buttons |
+| `--cometchat-text-color-secondary` | Secondary/caption text color | varies | Action bubble text |
+| `--cometchat-icon-color-secondary` | Secondary icon color | varies | Action bubble icons |
+| `--cometchat-border-color-default` | Default border color | varies | Action bubble borders |
+
+---
+
+
+**CSS Specificity & Precedence Rules:**
+1. Message-type selectors (e.g., `__text-message`) override "All Message Bubbles" selectors
+2. Always keep the `.cometchat` prefix to avoid leaking styles into the host app
+3. Component-level variable overrides (`.cometchat-message-list { --var: val }`) override global overrides (`.cometchat { --var: val }`)
+4. CSS variable overrides only affect properties the UI Kit theme binds to that variable — they do NOT change layout or spacing
+5. `!important` should never be needed — if it is, your selector specificity is wrong
+
+
+---
## Incoming & Outgoing Messages
-Incoming and outgoing messages have different styling by default, allowing users to visually separate their own messages from others’. Here, we show both the default view and examples of customizations for these message bubbles.
+Incoming and outgoing messages have different styling by default, allowing users to visually separate their own messages from others'. Here, we show both the default view and examples of customizations for these message bubbles.
Shown below is the default chat interface.
@@ -22,6 +102,18 @@ Shown below is the default chat interface.
#### Outgoing Message Bubbles
+**Selectors:**
+```css lines
+.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body
+```
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-primary-color` | Outgoing bubble background |
+| `--cometchat-extended-primary-color-900` | Outgoing bubble shade |
+
The customized chat interface is displayed below.
@@ -30,17 +122,30 @@ The customized chat interface is displayed below.
Use the following code to achieve the customization shown above.
-```css app.css
+```css title="App.css" lines
.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body {
--cometchat-primary-color: #f76808;
--cometchat-extended-primary-color-900: #fbaa75;
}
```
+**Expected result:** All outgoing message bubbles change from purple to orange (#f76808) with a lighter orange shade (#fbaa75).
+
***
#### Incoming Message Bubbles
+**Selectors:**
+```css lines
+.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body
+```
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-neutral-color-300` | Incoming bubble background |
+
The customized chat interface is displayed below.
@@ -49,16 +154,31 @@ The customized chat interface is displayed below.
Use the following code to achieve the customization shown above.
-```css app.css
+```css title="App.css" lines
.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body {
--cometchat-neutral-color-300: #f76808;
}
```
+**Expected result:** All incoming message bubbles change from white/light to orange (#f76808).
+
***
#### All Message Bubbles
+**Selectors:**
+```css lines
+.cometchat .cometchat-message-bubble .cometchat-message-bubble__body
+```
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-neutral-color-300` | Incoming bubble background |
+| `--cometchat-primary-color` | Outgoing bubble background |
+| `--cometchat-extended-primary-color-900` | Outgoing bubble shade |
+
The customized chat interface is displayed below.
@@ -67,7 +187,7 @@ The customized chat interface is displayed below.
Use the following code to achieve the customization shown above.
-```css app.css
+```css title="App.css" lines
.cometchat .cometchat-message-bubble .cometchat-message-bubble__body {
--cometchat-neutral-color-300: #f76808;
--cometchat-primary-color: #f76808;
@@ -75,16 +195,71 @@ Use the following code to achieve the customization shown above.
}
```
+**Expected result:** Both incoming and outgoing bubbles use orange (#f76808), with outgoing shade set to lighter orange (#fbaa75).
+
+***
+
+### Complete End-to-End Example
+
+To apply custom bubble colors in your app:
+
+**Step 1:** Add to `App.css`:
+
+```css lines
+@import url("@cometchat/chat-uikit-react/css-variables.css");
+
+/* Custom outgoing bubbles */
+.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body {
+ --cometchat-primary-color: #f76808;
+ --cometchat-extended-primary-color-900: #fbaa75;
+}
+
+/* Custom incoming bubbles */
+.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body {
+ --cometchat-neutral-color-300: #feede1;
+}
+```
+
+**Step 2:** Ensure `App.tsx` imports the CSS:
+
+```tsx lines
+import "./App.css";
+// ... render CometChat UI Kit components
+```
+
+**Expected result:** Outgoing bubbles use orange (#f76808) with lighter shade (#fbaa75); incoming bubbles use light peach (#feede1).
+
***
## Message Types
-CometChat UI Kit includes classes for various message types. Below are examples of default & customised views for each message type, along with the relevant CSS code snippets so that you can quickly up to the mark with CSS customization.
+CometChat UI Kit includes classes for various message types. Below are examples of default & customised views for each message type, along with the relevant CSS code snippets so that you can quickly get up to speed with CSS customization.
***
### Text Message Bubble
+**Selectors:**
+
+
+```css lines
+.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body.cometchat-message-bubble__text-message
+```
+
+
+```css lines
+.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body.cometchat-message-bubble__text-message
+```
+
+
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-primary-color` | Outgoing text bubble background |
+| `--cometchat-neutral-color-300` | Incoming text bubble background |
+
Shown below is the default chat interface.
@@ -97,10 +272,11 @@ The customized chat interface is displayed below.
-Use the following code to achieve the customization shown above.
-
-```css App.css
+**Complete CSS:**
+
+
+```css lines
/* Outgoing Text Message Bubble */
.cometchat
.cometchat-message-bubble-outgoing
@@ -115,11 +291,36 @@ Use the following code to achieve the customization shown above.
--cometchat-neutral-color-300: #feede1;
}
```
+
+
+
+**Expected result:** Outgoing text bubbles change to orange (#f76808); incoming text bubbles change to light peach (#feede1).
***
### Image Message Bubble
+**Selectors:**
+
+
+```css lines
+.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body.cometchat-message-bubble__image-message
+```
+
+
+```css lines
+.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body.cometchat-message-bubble__image-message
+```
+
+
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-primary-color` | Outgoing image bubble background |
+| `--cometchat-neutral-color-300` | Incoming image bubble background |
+
Shown below is the default chat interface.
@@ -132,10 +333,11 @@ The customized chat interface is displayed below.
-Use the following code to achieve the customization shown above.
-
-```css App.css
+**Complete CSS:**
+
+
+```css lines
/* Outgoing Image Message Bubble */
.cometchat
.cometchat-message-bubble-outgoing
@@ -150,11 +352,36 @@ Use the following code to achieve the customization shown above.
--cometchat-neutral-color-300: #feede1;
}
```
+
+
+
+**Expected result:** Outgoing image bubbles change to orange (#f76808); incoming image bubbles change to light peach (#feede1).
***
### Video Message Bubble
+**Selectors:**
+
+
+```css lines
+.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body.cometchat-message-bubble__video-message
+```
+
+
+```css lines
+.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body.cometchat-message-bubble__video-message
+```
+
+
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-primary-color` | Outgoing video bubble background |
+| `--cometchat-neutral-color-300` | Incoming video bubble background |
+
Shown below is the default chat interface.
@@ -167,10 +394,11 @@ The customized chat interface is displayed below.
-Use the following code to achieve the customization shown above.
-
-```css App.css
+**Complete CSS:**
+
+
+```css lines
/* Outgoing Video Message Bubble */
.cometchat
.cometchat-message-bubble-outgoing
@@ -185,11 +413,36 @@ Use the following code to achieve the customization shown above.
--cometchat-neutral-color-300: #feede1;
}
```
+
+
+
+**Expected result:** Outgoing video bubbles change to orange (#f76808); incoming video bubbles change to light peach (#feede1).
***
### Audio Message Bubble
+**Selectors:**
+
+
+```css lines
+.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body.cometchat-message-bubble__audio-message
+```
+
+
+```css lines
+.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body.cometchat-message-bubble__audio-message
+```
+
+
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-primary-color` | Outgoing audio bubble background, incoming audio accent |
+| `--cometchat-neutral-color-300` | Incoming audio bubble background |
+
Shown below is the default chat interface.
@@ -202,10 +455,11 @@ The customized chat interface is displayed below.
-Use the following code to achieve the customization shown above.
-
-```css App.css
+**Complete CSS:**
+
+
+```css lines
/* Outgoing Audio Message Bubble */
.cometchat
.cometchat-message-bubble-outgoing
@@ -221,11 +475,36 @@ Use the following code to achieve the customization shown above.
--cometchat-neutral-color-300: #feede1;
}
```
+
+
+
+**Expected result:** Outgoing audio bubbles change to orange (#f76808); incoming audio bubbles change to light peach (#feede1) with orange accent for playback controls.
***
### File Message Bubble
+**Selectors:**
+
+
+```css lines
+.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body.cometchat-message-bubble__file-message
+```
+
+
+```css lines
+.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body.cometchat-message-bubble__file-message
+```
+
+
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-primary-color` | Outgoing file bubble background, incoming file accent |
+| `--cometchat-neutral-color-300` | Incoming file bubble background |
+
Shown below is the default chat interface.
@@ -238,10 +517,11 @@ The customized chat interface is displayed below.
-Use the following code to achieve the customization shown above.
-
-```css App.css
+**Complete CSS:**
+
+
+```css lines
/* Outgoing File Message Bubble */
.cometchat
.cometchat-message-bubble-outgoing
@@ -257,11 +537,36 @@ Use the following code to achieve the customization shown above.
--cometchat-neutral-color-300: #feede1;
}
```
+
+
+
+**Expected result:** Outgoing file bubbles change to orange (#f76808); incoming file bubbles change to light peach (#feede1) with orange file icon accent.
***
### Delete Message Bubble
+**Selectors:**
+
+
+```css lines
+.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body.cometchat-message-bubble__delete-message
+```
+
+
+```css lines
+.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body.cometchat-message-bubble__delete-message
+```
+
+
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-primary-color` | Outgoing delete bubble background |
+| `--cometchat-neutral-color-300` | Incoming delete bubble background |
+
Shown below is the default chat interface.
@@ -274,10 +579,11 @@ The customized chat interface is displayed below.
-Use the following code to achieve the customization shown above.
-
-```css App.css
+**Complete CSS:**
+
+
+```css lines
/* Outgoing Delete Bubble */
.cometchat
.cometchat-message-bubble-outgoing
@@ -292,11 +598,30 @@ Use the following code to achieve the customization shown above.
--cometchat-neutral-color-300: #feede1;
}
```
+
+
+
+**Expected result:** Outgoing delete placeholder bubbles change to orange (#f76808); incoming delete placeholder bubbles change to light peach (#feede1).
***
### Action Message Bubble
+Action messages (e.g., "User joined the group") use a different selector pattern — they are not directional (no incoming/outgoing).
+
+**Selector:**
+- `.cometchat .cometchat-message-bubble__body .cometchat-action-bubble`
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-primary-color` | Action bubble accent color |
+| `background-color` | Action bubble background (direct CSS property, not a variable) |
+| `--cometchat-text-color-secondary` | Action bubble text color |
+| `--cometchat-icon-color-secondary` | Action bubble icon color |
+| `--cometchat-border-color-default` | Action bubble border color |
+
Shown below is the default chat interface.
@@ -309,10 +634,11 @@ The customized chat interface is displayed below.
-Use the following code to achieve the customization shown above.
-
-```css App.css
+**Complete CSS:**
+
+
+```css lines
.cometchat .cometchat-message-bubble__body .cometchat-action-bubble {
--cometchat-primary-color: #f76808;
background-color: #feede1;
@@ -321,11 +647,39 @@ Use the following code to achieve the customization shown above.
--cometchat-border-color-default: #f76808;
}
```
+
+
+
+**Expected result:** Action message banners change to light peach background (#feede1) with orange text, icons, and borders (#f76808).
***
### Direct Call Message Bubble
+Direct call messages use the `meeting-message` type selector (not `call-message`).
+
+**Selectors:**
+
+
+```css lines
+.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body.cometchat-message-bubble__meeting-message
+```
+
+
+```css lines
+.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body.cometchat-message-bubble__meeting-message
+```
+
+
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-primary-color` | Bubble accent and background |
+| `--cometchat-extended-primary-color-800` | Outgoing bubble secondary shade |
+| `--cometchat-neutral-color-300` | Incoming bubble background |
+
Shown below is the default chat interface.
@@ -338,10 +692,11 @@ The customized chat interface is displayed below.
-Use the following code to achieve the customization shown above.
-
-```css App.css
+**Complete CSS:**
+
+
+```css lines
/* Outgoing Direct Call Message Bubble */
.cometchat
.cometchat-message-bubble-outgoing
@@ -358,11 +713,34 @@ Use the following code to achieve the customization shown above.
--cometchat-neutral-color-300: #feede1;
}
```
+
+
+
+**Expected result:** Outgoing direct call bubbles change to orange (#f76808) with lighter shade (#fbaa75); incoming direct call bubbles change to light peach (#feede1) with orange accent.
***
### Default Call Message Bubble
+Default call messages (ringing calls) use the same action bubble selector as Action Messages.
+
+**Selector:**
+- `.cometchat .cometchat-message-bubble__body .cometchat-action-bubble`
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-primary-color` | Call action bubble accent |
+| `background-color` | Call action bubble background (direct CSS property) |
+| `--cometchat-text-color-secondary` | Call action text color |
+| `--cometchat-icon-color-secondary` | Call action icon color |
+| `--cometchat-border-color-default` | Call action border color |
+
+
+Styling default call message bubbles also affects Action Message bubbles since they share the same `.cometchat-action-bubble` selector. To style them independently, use more specific parent selectors if available.
+
+
Shown below is the default chat interface.
@@ -375,10 +753,11 @@ The customized chat interface is displayed below.
-Use the following code to achieve the customization shown above.
-
-```css App.css
+**Complete CSS:**
+
+
+```css lines
.cometchat .cometchat-message-bubble__body .cometchat-action-bubble {
--cometchat-primary-color: #f76808;
background-color: #feede1;
@@ -387,6 +766,10 @@ Use the following code to achieve the customization shown above.
--cometchat-border-color-default: #f76808;
}
```
+
+
+
+**Expected result:** Default call action banners change to light peach background (#feede1) with orange text, icons, and borders (#f76808).
***
@@ -394,6 +777,28 @@ Use the following code to achieve the customization shown above.
#### Collaborative Whiteboard Bubble
+**Selectors:**
+
+
+```css lines
+.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body.cometchat-message-bubble__whiteboard-message
+```
+
+
+```css lines
+.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body.cometchat-message-bubble__whiteboard-message
+```
+
+
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-primary-color` | Bubble accent and background |
+| `--cometchat-primary-button-background` | Incoming whiteboard "Open" button fill |
+| `--cometchat-neutral-color-300` | Incoming bubble background |
+
Shown below is the default chat interface.
@@ -406,10 +811,11 @@ The customized chat interface is displayed below.
-Use the following code to achieve the customization shown above.
-
-```css App.css
+**Complete CSS:**
+
+
+```css lines
/* Outgoing Collaborative Whiteboard Bubble */
.cometchat
.cometchat-message-bubble-outgoing
@@ -426,11 +832,37 @@ Use the following code to achieve the customization shown above.
--cometchat-neutral-color-300: #feede1;
}
```
+
+
+
+**Expected result:** Outgoing whiteboard bubbles change to orange (#f76808); incoming whiteboard bubbles change to light peach (#feede1) with orange button and accent.
***
#### Collaborative Document Bubble
+**Selectors:**
+
+
+```css lines
+.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body.cometchat-message-bubble__document-message
+```
+
+
+```css lines
+.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body.cometchat-message-bubble__document-message
+```
+
+
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-primary-color` | Bubble accent and background |
+| `--cometchat-primary-button-background` | Incoming document "Open" button fill |
+| `--cometchat-neutral-color-300` | Incoming bubble background |
+
Shown below is the default chat interface.
@@ -443,10 +875,11 @@ The customized chat interface is displayed below.
-Use the following code to achieve the customization shown above.
-
-```css App.css
+**Complete CSS:**
+
+
+```css lines
/* Outgoing Collaborative Document Bubble */
.cometchat
.cometchat-message-bubble-outgoing
@@ -463,11 +896,37 @@ Use the following code to achieve the customization shown above.
--cometchat-neutral-color-300: #feede1;
}
```
+
+
+
+**Expected result:** Outgoing document bubbles change to orange (#f76808); incoming document bubbles change to light peach (#feede1) with orange button and accent.
***
#### Polls Bubble
+**Selectors:**
+
+
+```css lines
+.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body.cometchat-message-bubble__poll-message
+```
+
+
+```css lines
+.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body.cometchat-message-bubble__poll-message
+```
+
+
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-primary-color` | Bubble accent and background |
+| `--cometchat-extended-primary-color-700` | Outgoing poll progress bar shade |
+| `--cometchat-neutral-color-300` | Incoming bubble background |
+
Shown below is the default chat interface.
@@ -480,10 +939,11 @@ The customized chat interface is displayed below.
-Use the following code to achieve the customization shown above.
-
-```css App.css
+**Complete CSS:**
+
+
+```css lines
/* Outgoing Poll Message Bubble */
.cometchat
.cometchat-message-bubble-outgoing
@@ -500,11 +960,36 @@ Use the following code to achieve the customization shown above.
--cometchat-neutral-color-300: #feede1;
}
```
+
+
+
+**Expected result:** Outgoing poll bubbles change to orange (#f76808) with lighter progress bars (#fbaa75); incoming poll bubbles change to light peach (#feede1) with orange accent.
***
#### Stickers Bubble
+**Selectors:**
+
+
+```css lines
+.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body.cometchat-message-bubble__sticker-message
+```
+
+
+```css lines
+.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body.cometchat-message-bubble__sticker-message
+```
+
+
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-primary-color` | Outgoing sticker bubble background |
+| `--cometchat-neutral-color-300` | Incoming sticker bubble background |
+
Shown below is the default chat interface.
@@ -517,10 +1002,11 @@ The customized chat interface is displayed below.
-Use the following code to achieve the customization shown above.
-
-```css App.css
+**Complete CSS:**
+
+
+```css lines
/* Outgoing Sticker Bubble */
.cometchat
.cometchat-message-bubble-outgoing
@@ -535,11 +1021,44 @@ Use the following code to achieve the customization shown above.
--cometchat-neutral-color-300: #feede1;
}
```
+
+
+
+**Expected result:** Outgoing sticker bubbles change to orange (#f76808); incoming sticker bubbles change to light peach (#feede1).
***
#### Link Preview Bubble
+Link previews render inside text message bubbles, so they use the `text-message` type selector.
+
+**Selectors:**
+
+
+```css lines
+.cometchat .cometchat-message-bubble-outgoing .cometchat-message-bubble__body.cometchat-message-bubble__text-message
+```
+
+
+```css lines
+.cometchat .cometchat-message-bubble-incoming .cometchat-message-bubble__body.cometchat-message-bubble__text-message
+```
+
+
+
+**Tokens used:**
+
+| Token | Controls |
+| --- | --- |
+| `--cometchat-primary-color` | Outgoing link preview bubble background |
+| `--cometchat-extended-primary-color-900` | Outgoing link preview shade |
+| `--cometchat-neutral-color-400` | Incoming link preview secondary shade |
+| `--cometchat-neutral-color-300` | Incoming link preview bubble background |
+
+
+Styling link preview bubbles also affects regular text message bubbles since they share the same `__text-message` selector. This is by design — link previews are a sub-feature of text messages.
+
+
Shown below is the default chat interface.
@@ -552,10 +1071,11 @@ The customized chat interface is displayed below.
-Use the following code to achieve the customization shown above.
-
-```css App.css
+**Complete CSS:**
+
+
+```css lines
/* Outgoing Link Preview Bubble */
.cometchat
.cometchat-message-bubble-outgoing
@@ -572,5 +1092,9 @@ Use the following code to achieve the customization shown above.
--cometchat-neutral-color-300: #feede1;
}
```
+
+
+
+**Expected result:** Outgoing link preview bubbles change to orange (#f76808) with lighter shade (#fbaa75); incoming link preview bubbles change to light peach (#feede1) with orange secondary shade (#fbaa75).
+
-***
diff --git a/ui-kit/react/thread-header.mdx b/ui-kit/react/thread-header.mdx
index 9f4cf3279..d302f2f66 100644
--- a/ui-kit/react/thread-header.mdx
+++ b/ui-kit/react/thread-header.mdx
@@ -1,24 +1,35 @@
---
title: "Thread Header"
+description: "CometChatThreadHeader component displays the parent message of a threaded conversation with reply count, allowing users to view and navigate threaded message discussions."
---
-## Overview
-
-CometChatThreadHeader is a Component that displays the parent message & number of replies of thread.
-
-## Usage
+
+
+| Field | Value |
+| --- | --- |
+| Purpose | Displays the parent message and reply count at the top of a threaded conversation view |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatThreadHeader } from "@cometchat/chat-uikit-react";` |
+| Used in experiences | Thread view header, threaded message panel |
+| Copy-paste base | See [Base Code](#base-code--stylesheet) below |
+| Primary output | Close callback (from `onClose`) |
+| Primary hook points | `onClose`, `onError`, `messageBubbleView`, `template` |
+| CSS root class | `.cometchat-thread-header` |
+| Real-time events | None emitted |
+
+
-### Integration
+## Base Code and Stylesheet
-The following code snippet illustrates how you can directly incorporate the CometChatThreadHeader component into your Application.
+Renders the parent message bubble and reply count for a threaded conversation.
-```tsx
+```tsx lines
import React from "react";
import { CometChatThreadHeader } from "@cometchat/chat-uikit-react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
@@ -42,41 +53,83 @@ export function ThreadHeaderDemo() {
) : null;
}
```
-
-
-```tsx
+```tsx lines
import { ThreadHeaderDemo } from "./ThreadHeaderDemo";
export default function App() {
return (
-
-
-
+
);
}
```
-
-
-***
+Root CSS class for style overrides:
-### Actions
+```css lines
+.cometchat-thread-header {
+ /* overrides here */
+}
+```
-[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.
+## Functionality
-**Example**
+Props that control component behavior, grouped by surface area.
-In this example, we are overriding the `onClose` of the ThreadedMesssage Component.
+### Data
-
-
-```tsx
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `parentMessage` | `CometChat.BaseMessage` | — (required) | Sets the parent message displayed in the thread header | Must be a valid message object |
+| `template` | `CometChatMessageTemplate` | SDK default | Custom template for the parent message bubble rendering | Template `type`/`category` must match the parent message |
+| `textFormatters` | `CometChatTextFormatter[]` | `[]` | Custom text formatters for styling or formatting message text in the thread header | — |
+
+### UI Visibility Toggles
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `hideDate` | `boolean` | `false` | Hides the date header | — |
+| `hideReplyCount` | `boolean` | `false` | Hides the reply count | — |
+| `hideReceipts` | `boolean` | `false` | Hides the receipt indicator in the thread header | — |
+| `showScrollbar` | `boolean` | `false` | Shows the scrollbar in the component | — |
+
+### Date Formatting
+
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `separatorDateTimeFormat` | `CalendarObject` | `DD MMM, YYYY` | Customizes the date separator timestamp | Falls back to global config, then component default |
+| `messageSentAtDateTimeFormat` | `CalendarObject` | `hh:mm A` | Customizes the message sent-at timestamp | Falls back to global config, then component default |
+
+
+If a property is not passed in the CalendarObject, the component checks the [global configuration](/ui-kit/react/localize#customisation) first, then falls back to the component's default formatting.
+
+
+## Actions
+
+[Actions](/ui-kit/react/components-overview#actions) split into predefined (built-in triggers) and user-defined (callbacks).
+
+### Predefined Actions
+
+The component has no built-in navigation behavior. The close button fires `onClose` but does not navigate automatically.
+
+### User-Defined Actions
+
+#### onClose
+
+Fires when the close button is clicked.
+
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks the close button |
+| Payload type | `() => void` |
+| What devs typically do next | Close the thread panel, navigate back to main conversation |
+
+```tsx lines
import React from "react";
import { CometChatThreadHeader } from "@cometchat/chat-uikit-react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
@@ -108,93 +161,57 @@ export function ThreadHeaderDemo() {
}
```
-
-
-
-
-***
+#### onError
-### Events
+Fires when the component encounters an error.
-[Events](/ui-kit/react/components-overview#events) are emitted by a `Component`. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
+| Detail | Value |
+| --- | --- |
+| When it fires | Any internal error during rendering |
+| Payload type | `(error: CometChat.CometChatException) => void` |
+| What devs typically do next | Log to error tracking service |
-The ThreadHeader Component does not emit any events of its own.
+#### onSubtitleClicked
-***
+Fires when the subtitle area is clicked.
-## Customization
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks the subtitle area |
+| Payload type | `() => void` |
+| What devs typically do next | Open thread details, navigate to parent message context |
-To fit your app's design requirements, you can customize the appearance of the conversation component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.
+## Filters
-***
+The ThreadHeader component does not have any exposed filters. It displays a single parent message and reply count.
-### Style
+## Events
-Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-
-**Example**
-
-
-
-
-
-
-
-```tsx
-import React from "react";
-import { CometChatThreadHeader } from "@cometchat/chat-uikit-react";
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-
-export function ThreadHeaderDemo() {
- const [parentMessage, setParentMessage] =
- React.useState();
- const [chatWithUser, setChatWithUser] = React.useState();
-
- React.useEffect(() => {
- CometChat.getUser("uid").then((user) => {
- setChatWithUser(user);
- });
- CometChat.getMessageDetails("Parent Message Id").then((message) => {
- setParentMessage(message);
- });
- }, []);
-
- return chatWithUser && parentMessage ? (
-
- ) : null;
-}
-```
+### UI Events
-
+The ThreadHeader component does not emit any custom UI events.
-
-```css
-.cometchat .cometchat-thread-header {
- background-color: #edeafa;
-}
+### SDK Events (Real-Time)
-.cometchat .cometchat-thread-header__reply-bar-count {
- color: #6852d6;
-}
+The component internally listens to SDK events for real-time reply count updates. No manual attachment needed.
-.cometchat .cometchat-thread-header__reply-bar-divider {
- color: #6852d6;
-}
-```
+## Advanced: Custom View Slots
-
+Customization override points for the thread header UI.
-
+### Slot Catalog
-***
+| Slot | Params | What it replaces | Section |
+| --- | --- | --- | --- |
+| `messageBubbleView` | `(message: CometChat.BaseMessage) => JSX.Element` | Parent message bubble | Whole item |
+| `template` | `CometChatMessageTemplate` | Message template for bubble rendering | Whole item |
+| `subtitleView` | `JSX.Element` | Subtitle text below the thread title | Sub-section (subtitle) |
-### Functionality
+### messageBubbleView
-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.
+Replace the parent message bubble with a custom view.
-
-
-```tsx
+```tsx lines
import React from "react";
import { CometChatThreadHeader } from "@cometchat/chat-uikit-react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
@@ -212,7 +229,6 @@ export function ThreadHeaderDemo() {
CometChat.getUser("uid").then((user) => {
setChatWithUser(user);
});
-
CometChat.getMessageDetails("Parent Message Id").then((message) => {
setParentMessage(message);
});
@@ -227,126 +243,70 @@ export function ThreadHeaderDemo() {
}
```
-
-
-
-
-Below is a list of customizations along with corresponding code snippets
-
-| Property | Description | Code |
-| --------------------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
-| **Parent Message** | Represents the parent message for displaying threaded conversations. | `parentMessage={message}` |
-| **Message Bubble View** | A custom view for rendering the message bubble. | `messageBubbleView={(message: CometChat.BaseMessage) => <>Custom Bubble View>}` |
-| [**Template**](/ui-kit/react/message-template) | Template for customizing the appearance of the message. | `template={"PASS_CUSTOM_MESSAGE_TEMPLATE"}` |
-| **Hide Date** | Hides the visibility of the date header. | `hideDate={true}` |
-| **Hide Reply Count** | Hides the visibility of the reply count. | `hideReplyCount={true}` |
-| **Show Scrollbar** | Controls the visibility of the scrollbar in the component. | `showScrollbar={true}` |
-| **On Error** | Callback function triggered when an error occurs. | `onError={(error: CometChat.CometChatException) => console.log(error)}` |
-
-### Advanced
-
-***
-
-#### Separator DateTime Format
+### Date Time Format Customization
-The `separatorDateTimeFormat` property allows you to customize the **Date Separator** timestamp displayed in the Threaded Message Preview.
+#### separatorDateTimeFormat
-Default Date Time Format:
-
-```ruby
-new CalendarObject({
- today: `DD MMM, YYYY`, // Example: "25 Jan, 2025"
- yesterday: `DD MMM, YYYY`, // Example: "25 Jan, 2025"
- otherDays: `DD MMM, YYYY`, // Example: "25 Jan, 2025"
-});
-```
-
-The following example demonstrates how to modify the **Date Separator** timestamp format using a custom [`CalendarObject`](/ui-kit/react/localize#calendarobject).
-
-
-
-```ts
+```ts lines
import {
CometChatThreadHeader,
- CalendarObject
+ CalendarObject,
} from "@cometchat/chat-uikit-react";
-// 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/05/2025"
+ today: `hh:mm A`,
+ yesterday: `[yesterday]`,
+ otherDays: `DD/MM/YYYY`,
});
return dateFormat;
}
-// Apply the custom format to the CometChatThreadHeader component
;
```
-
-
-
+#### messageSentAtDateTimeFormat
-
-
-**Fallback Mechanism**
-
-* If you **do not** pass any property in the [**CalendarObject**](/ui-kit/react/localize#calendarobject), the component will first check the [**global configuration**](/ui-kit/react/localize#customisation). If the property is **also missing in the global configuration**, it will **fallback to the component's default formatting**.
-
-
-
-***
-
-#### **Message SentAt DateTime Format**
-
-The `messageSentAtDateTimeFormat` property allows you to customize the **Message SentAt** timestamp displayed in the Threaded Message Preview.
-
-Default Date Time Format:
-
-```javascript
-new CalendarObject({
- today: "hh:mm A" // Example: "12:00 PM"
- yesterday: "hh:mm A", // Example: "01:00 AM"
- otherDays: `hh:mm A`, // Example: "09:30 PM"
-});
-```
-
-The following example demonstrates how to modify the **Message SentAt** timestamp format using a custom [`CalendarObject`](/ui-kit/react/localize#calendarobject).
-
-
-
-```ts
+```ts lines
import {
CometChatThreadHeader,
- CalendarObject
+ CalendarObject,
} from "@cometchat/chat-uikit-react";
-// 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/05/2025"
+ today: `hh:mm A`,
+ yesterday: `[yesterday]`,
+ otherDays: `DD/MM/YYYY`,
});
return dateFormat;
}
-// Apply the custom format to the CometChatThreadHeader component
-;
+;
```
-
+## Theme and Styling
-
+Using CSS, customize the look and feel of the component. The root CSS class is `.cometchat-thread-header`.
-
+
+
+
-**Fallback Mechanism**
+```tsx lines
+
+```
-* If you **do not** pass any property in the [**CalendarObject**](/ui-kit/react/localize#calendarobject), the component will first check the [**global configuration**](/ui-kit/react/localize#customisation). If the property is **also missing in the global configuration**, it will **fallback to the component's default formatting**.
+```css lines
+.cometchat .cometchat-thread-header {
+ background-color: #edeafa;
+}
-
+.cometchat .cometchat-thread-header__reply-bar-count {
+ color: #6852d6;
+}
-***
+.cometchat .cometchat-thread-header__reply-bar-divider {
+ color: #6852d6;
+}
+```
\ No newline at end of file
diff --git a/ui-kit/react/troubleshooting.mdx b/ui-kit/react/troubleshooting.mdx
new file mode 100644
index 000000000..30e2aa6ab
--- /dev/null
+++ b/ui-kit/react/troubleshooting.mdx
@@ -0,0 +1,277 @@
+---
+title: "Troubleshooting & FAQ"
+sidebarTitle: "Troubleshooting"
+description: "Aggregated troubleshooting guide and FAQ for the CometChat React UI Kit v6 — covering initialization, rendering, theming, SSR, calling, AI, extensions, localization, events, sound, and common runtime edge cases."
+---
+
+
+
+| Field | Value |
+| --- | --- |
+| Purpose | Centralized troubleshooting reference aggregating all failure modes from across the React UI Kit v6 documentation and source code |
+| Package | `@cometchat/chat-uikit-react` |
+| Related | [Methods](/ui-kit/react/methods), [Events](/ui-kit/react/events), [Theming](/ui-kit/react/theme), [Localize](/ui-kit/react/localize), [Call Features](/ui-kit/react/call-features), [AI Features](/ui-kit/react/ai-features), [Extensions](/ui-kit/react/extensions), [Sound Manager](/ui-kit/react/sound-manager) |
+
+
+
+This page collects every known failure mode from across the React UI Kit v6 docs and source code into a single reference. Use it as a first stop when something isn't working.
+
+---
+
+## Initialization & Authentication
+
+Issues that occur during `CometChatUIKit.init()` or `CometChatUIKit.login()`.
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| `CometChatUIKit.init()` returns `undefined` instead of a Promise | `uiKitSettings` is `null` or `appId` is missing | `init()` calls `checkAuthSettings()` internally — if it returns `false`, the method returns `undefined` (not a rejected Promise). Always check that `appId` is set in your `UIKitSettingsBuilder` |
+| `init()` rejects with SDK error | Invalid App ID, Region, or network issue | Double-check credentials from the [CometChat Dashboard](https://app.cometchat.com/). Verify network connectivity to CometChat servers |
+| `login()` returns the existing user without calling the API | A user session already exists | `login(uid)` internally calls `getLoggedinUser()` first. If a user is already logged in, it returns that user and skips the API call. Call `logout()` first if you need to switch users |
+| `loginWithAuthToken()` creates a duplicate session | Called without checking for existing session | Unlike `login(uid)`, `loginWithAuthToken()` does not check for an existing session — it always calls the SDK. Check `getLoggedinUser()` first to avoid unnecessary API calls |
+| `login()` fails with "UID not found" | UID doesn't exist in your CometChat app | Create the user first via Dashboard, [`createUser()`](/ui-kit/react/methods#create-user), or [API](https://api-explorer.cometchat.com/reference/creates-user) |
+| `getLoggedinUser()` returns `null` | User not logged in or session expired | Call `login()` or `loginWithAuthToken()` first |
+| `createUser()` or `updateUser()` fails | Auth Key not set or invalid | These methods require a valid Auth Key in `UIKitSettings`. Verify it's set in `UIKitSettingsBuilder` |
+| `sendTextMessage()` / `sendMediaMessage()` / `sendCustomMessage()` fails | User not logged in or invalid receiver ID | Ensure login completes before sending messages. Verify the receiver UID/GUID exists |
+| Auth Key exposed in production | Using Auth Key instead of Auth Token | Switch to [`loginWithAuthToken()`](/ui-kit/react/methods#login-using-auth-token) for production. Generate Auth Tokens server-side via the REST API |
+
+
+`init()` auto-detects the browser language and sets it via `CometChatLocalize.setCurrentLanguage()`. If you need a specific language, call `CometChatLocalize.init()` with your language setting after `CometChatUIKit.init()` resolves — otherwise auto-detection may override your preference.
+
+
+
+`CometChatUIKit.init()` must complete before `login()`, and `login()` must complete before rendering any component. The `init()` method returns `undefined` (not a Promise) if settings are invalid — always validate your `UIKitSettings` before calling init.
+
+
+---
+
+## Rendering & Component Issues
+
+Components not appearing, showing blank, or missing data.
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| Component doesn't render | `init()` not called or not awaited before rendering | Ensure `init()` completes before mounting components. See [Methods](/ui-kit/react/methods) |
+| Component renders but shows no data | User not logged in | Call `CometChatUIKit.login("UID")` after init |
+| Blank screen after login | Component mounted before init/login completes | Use state to conditionally render after login resolves |
+| Callback not firing | Wrong prop name or signature | Check the Actions section on the [component page](/ui-kit/react/components-overview) for exact prop name and parameter types |
+| Custom view not appearing | Returning `null` or `undefined` from view prop | Ensure view function returns valid JSX |
+| Passing both `user` and `group` to a component | Components expect one or the other, not both | Pass either `user` or `group` prop, never both simultaneously |
+| `messagesRequestBuilder` UID/GUID ignored | Component overrides UID/GUID internally | The `user` or `group` prop always takes precedence — UID/GUID set on the builder are overridden by the component |
+| Message list shows stale data after switching chats | Component state not resetting | The component resets internally when `user` or `group` prop changes. Ensure you're passing new object references, not mutating existing ones |
+| `activeConversation` highlight not working | Object reference mismatch | `activeConversation` must be a reference-equal object from the SDK. A manually constructed `Conversation` object won't match |
+| Messages not loading | Invalid user/group object passed to component | Ensure you fetch the user/group via the SDK before passing to components. A manually constructed object won't work |
+
+---
+
+## Theming & Styling
+
+CSS variables, dark mode, and visual customization issues.
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| CSS has no effect | CSS file not imported in app entry | Add `import "./App.css";` in `App.tsx` |
+| CSS has no effect | Base stylesheet not imported | Add `@import url("@cometchat/chat-uikit-react/css-variables.css");` at top of `App.css` |
+| Overrides not applying | Missing `.cometchat` scope in selector | Scope overrides under `.cometchat`. See [Theming](/ui-kit/react/theme) |
+| Selectors don't match | Using CSS Modules (hashed class names) | Move rules to a global stylesheet, not `*.module.css` |
+| Component-level override not working | Missing `.cometchat` parent in selector | Use `.cometchat .cometchat-conversations` not just `.cometchat-conversations` |
+| Dark mode unchanged | `data-theme` missing or mismatch | Set `data-theme="dark"` on the wrapper and target `.cometchat-root[data-theme="dark"] .cometchat` |
+| Font not changing | `--cometchat-font-family` set on wrong element | Set on `.cometchat` |
+| Styles leak into host app | Missing `.cometchat` scope prefix | Always scope overrides under `.cometchat` |
+| Token change has no visible effect | Token doesn't control the expected property | Check the [Color Resources](/ui-kit/react/theme/color-resources) table |
+| Only some elements changed color | Only overrode `--cometchat-primary-color` but not extended palette | Override the `extended-primary-color` scale too for full consistency |
+| Wrong bubble styled | Used `__text-message` instead of `__image-message` (or vice versa) | Check the message type class suffix in the [Message Bubble Styling](/ui-kit/react/theme/message-bubble-styling) selector table |
+| Action and Default Call bubbles styled together | Both use `.cometchat-action-bubble` selector | This is expected — they share the same selector. Use more specific parent selectors to differentiate |
+| Link preview styled but text messages also changed | Both use `__text-message` selector | This is expected — link previews render inside text messages |
+
+---
+
+## Server-Side Rendering (SSR)
+
+Issues specific to Next.js, Astro, and other SSR frameworks.
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| SSR hydration error | CometChat components use browser APIs (`window`, `WebSocket`, `document`) on server | Wrap in `useEffect` or use dynamic import with `ssr: false`. See [Next.js Integration](/ui-kit/react/next-js-integration) |
+| CometChat components fail on server (Astro) | Astro SSR tries to render on server | Use `client:only="react"` directive on CometChat islands. See [Astro Integration](/ui-kit/react/astro-integration) |
+
+---
+
+## Calling
+
+Audio and video call issues.
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| Call buttons not appearing in Message Header | `@cometchat/calls-sdk-javascript` not installed | Run `npm install @cometchat/calls-sdk-javascript`. The UI Kit auto-detects it via a `require()` call — if the package isn't found, calling features are silently disabled |
+| Incoming call screen not showing | `CometChatIncomingCall` not mounted in the component tree | Ensure the component is rendered at the app root level so it can listen for incoming calls |
+| `CometChatCalls initialization failed` in console | Calls SDK init failed after UI Kit init | Check that your App ID and Region match between the UI Kit and Calls SDK. The Calls SDK is initialized automatically after login |
+| Call listeners not registering | Calling extension not enabled | Call listeners only attach when `ChatConfigurator.names.includes("calling")` is true. This happens automatically when the Calls SDK is installed and initialized |
+
+---
+
+## AI Features
+
+Smart replies, conversation starters, and AI assistant issues.
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| AI features not appearing | Feature not activated in CometChat Dashboard | Enable the specific AI feature from your [Dashboard](/fundamentals/ai-user-copilot/overview) |
+| Conversation Starter not showing | Feature not enabled or no conversation context | Ensure [Conversation Starter](/fundamentals/ai-user-copilot/conversation-starter) is activated in Dashboard |
+| Smart Replies not appearing in composer | Feature not enabled in Dashboard | Ensure [Smart Replies](/fundamentals/ai-user-copilot/smart-replies) is activated in Dashboard |
+| AI Assistant messages not appearing in real-time | Stream listener not attached for the correct user | The AI stream listener filters by `conversationId` — ensure the logged-in user and target user UIDs match the conversation |
+
+---
+
+## Extensions
+
+Stickers, polls, link preview, and other extension issues.
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| Extension feature not appearing | Extension not activated in CometChat Dashboard | Enable the specific extension from your [Dashboard](/fundamentals/extensions-overview) |
+| Stickers not showing in composer | Sticker extension not enabled | Activate [Sticker Extension](/fundamentals/stickers) in Dashboard |
+| Polls option missing from action sheet | Polls extension not enabled | Activate [Polls Extension](/fundamentals/polls) in Dashboard |
+| Link preview not rendering in messages | Link Preview extension not enabled | Activate [Link Preview Extension](/fundamentals/link-preview) in Dashboard |
+| Custom extensions not loading | Extensions array overrides defaults | When you pass a custom `extensions` array to `UIKitSettingsBuilder.setExtensions()`, it replaces the default extensions entirely. Include all desired extensions in your array |
+
+---
+
+## Conversations
+
+Issues specific to the Conversations component.
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| Custom message not updating conversation list | Custom message missing metadata flag | Custom messages only update the conversation list if `willUpdateConversation()` returns `true`, or the message metadata includes `{ incrementUnreadCount: true }`. Alternatively, enable custom message updates in Dashboard Conversation Update Settings |
+| Conversation not moving to top after sending | `ConversationUpdateSettings` filtering it out | The UI Kit fetches `ConversationUpdateSettings` from the server after login. Check your Dashboard settings for which message types trigger conversation updates |
+| Blocked user conversations still visible | `includeBlockedUsers` not set on builder | By default, blocked user conversations are hidden. If you use a custom `ConversationsRequestBuilder`, check `isIncludeBlockedUsers()` |
+| Conversation deleted via SDK not reflected in UI | Direct SDK call bypasses UI events | When deleting a conversation via the SDK directly (not through the component's context menu), emit `CometChatConversationEvents.ccConversationDeleted` manually for the UI to update |
+| Group conversation not appearing after creation | Conversation not yet created server-side | The component fetches the conversation from the server after `ccGroupCreated` fires. If the conversation doesn't exist yet, it won't appear. Ensure the group is fully created before expecting it in the list |
+
+---
+
+## Message List
+
+Issues specific to the Message List component.
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| Messages missing after reconnection | Connection interrupted during fetch | The component attaches a `ConnectionListener` that refetches messages on reconnect. If messages are still missing, check that WebSocket reconnection is working (look for "ConnectionListener =>connected" in console) |
+| Sent message appears twice | Optimistic UI + delayed server response | The component uses MUID (message unique ID) to match optimistic messages with server responses. If you're sending messages via the raw SDK instead of `CometChatUIKit.sendTextMessage()`, the MUID won't be set and deduplication fails. Always use the UI Kit wrapper methods |
+| Thread replies appearing in main list | `hideReplies` not set on custom builder | The default `MessagesRequestBuilder` sets `hideReplies(true)`. If you pass a custom builder, ensure you call `.hideReplies(true)` unless you want thread replies in the main list |
+| `goToMessageId` not scrolling to message | Message not in the loaded page | The component loads messages in pages of 30. If the target message isn't in the loaded range, the component may not scroll to it. Ensure the message exists and is within the conversation |
+| Reactions optimistic update reverts | API call failed after UI update | Reactions use optimistic UI — the reaction appears immediately, then the API call is made. If the API fails, the reaction is reverted. Check console for `addReaction` errors |
+
+---
+
+## Message Composer
+
+Issues specific to the Message Composer component.
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| Composer not clearing after switching chats | User/group prop reference unchanged | The composer resets when `user` or `group` prop changes. Ensure you're passing new object references |
+| Paste not working as expected | Custom paste handler sanitizes input | The composer intercepts paste events and sanitizes the clipboard text via `CometChatUIKitUtility.sanitizeText()`. HTML content is stripped to plain text. This is by design for security |
+| Mentions not showing suggestion list | `searchMentions` callback not configured | The `CometChatMentionsFormatter` requires `setKeyDownCallBack` and `setKeyUpCallBack` to be set. This happens automatically — if it's not working, ensure `textFormatters` prop isn't overriding the default mentions formatter |
+| Auto-focus not working on mobile | Intentional mobile behavior | The composer only auto-focuses on desktop (`!isMobileDevice()`). On mobile, auto-focus is disabled to prevent the keyboard from opening unexpectedly |
+
+---
+
+## Localization
+
+Translation, date formatting, and language issues.
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| UI text not translated | Language code not matching supported codes | Check the [supported languages table](/ui-kit/react/localize) for exact codes (e.g., `en-US` not `en`) |
+| Custom translations not appearing | `addTranslation` called before `init` | Call `CometChatLocalize.init()` first, then `addTranslation()` |
+| Language resets to browser default | `init()` auto-detects browser language | `CometChatUIKit.init()` calls `CometChatLocalize.setCurrentLanguage(getBrowserLanguage())` internally. Set your preferred language after `CometChatUIKit.init()` resolves |
+| Date/time format unchanged | `disableDateTimeLocalization` set to `true` | Set `disableDateTimeLocalization: false` in init config |
+| Component-level CalendarObject ignored | Prop name mismatch | Check the component docs for the exact prop name (e.g., `separatorDateTimeFormat`, `stickyDateTimeFormat`) |
+| Missing translation key shows raw key | No `missingKeyHandler` configured | Add a `missingKeyHandler` function in init config. See [Localize](/ui-kit/react/localize) |
+
+---
+
+## Events
+
+Event subscription and lifecycle issues.
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| Event listener not firing | Subscribed to wrong event name | Check the [Events](/ui-kit/react/events) reference for exact event names |
+| Duplicate event triggers | Multiple subscriptions without cleanup | Unsubscribe in `useEffect` cleanup or component unmount |
+| Event fires but UI doesn't update | State not updated in event handler | Ensure you call `setState` or equivalent in the handler |
+| SDK events not reaching components | `ChatSdkEventInitializer.attachListeners()` not called | This is called automatically during `initiateAfterLogin()`. If you're seeing this, `init()` or `login()` likely didn't complete successfully |
+
+
+In React 18 StrictMode, `useEffect` runs twice on mount in development. SDK listeners may be registered twice. The component handles cleanup internally, but any additional listeners you add need cleanup in the `useEffect` return function to avoid duplicate event handling.
+
+
+---
+
+## Sound
+
+Audio notification issues.
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| No sound plays | Browser autoplay policy blocks audio before user interaction | `hasInteracted()` must return `true` — the user must interact with the page first |
+| Custom sound not playing | Invalid file path or unsupported format | Ensure the path is correct and the file is a valid audio format (WAV/MP3) |
+| Sound keeps playing | `pause()` not called | Call `CometChatSoundManager.pause()` to stop playback |
+| `Sound` import error | `Sound` is not a separate export | Access via `CometChatSoundManager.Sound`, not `import { Sound }` |
+
+---
+
+## iFrame Embedding
+
+Issues when embedding CometChat inside an ``.
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| Dialogs/portals render outside the iframe | Missing `CometChatFrameProvider` wrapper | Wrap your app tree in `` so all UI Kit internals mount into the correct frame |
+| iframe content not initializing | iframe not yet in DOM when provider mounts | The provider uses `MutationObserver` + exponential backoff (up to 10 retries) to wait for the iframe. If it still fails, ensure the iframe `id` matches the `iframeId` prop |
+| Cross-origin iframe errors | iframe and host on different origins | The provider catches cross-origin access errors gracefully, but CometChat components won't work inside a cross-origin iframe. Host and iframe must share the same origin |
+
+---
+
+## Dependency & Version Issues
+
+| Symptom | Cause | Fix |
+| --- | --- | --- |
+| `rxjs` import errors | `rxjs` not installed | `rxjs` (^7.8.1) is a peer dependency. Run `npm install rxjs` |
+| React version mismatch | UI Kit requires React 18+ | The UI Kit requires `react` and `react-dom` `>=18.0.0` and `<20.0.0`. Check your `package.json` |
+| TypeScript type errors | `@types/react` version mismatch | Ensure `@types/react` and `@types/react-dom` are `>=18.0.0` and `<20.0.0` |
+| `@cometchat/chat-sdk-javascript` version conflict | Incompatible SDK version | The UI Kit depends on `@cometchat/chat-sdk-javascript` ^4.1.6. Check for version conflicts with `npm ls @cometchat/chat-sdk-javascript` |
+
+---
+
+## General Debugging Checklist
+
+If none of the above match your issue, walk through this checklist:
+
+1. **Credentials** — Verify App ID, Region, and Auth Key/Token in the [CometChat Dashboard](https://app.cometchat.com/)
+2. **Init order** — `CometChatUIKit.init()` must resolve before `login()`, and `login()` must resolve before rendering any component. Remember `init()` returns `undefined` if settings are invalid
+3. **CSS import** — `@import url("@cometchat/chat-uikit-react/css-variables.css");` must be at the top of your global CSS file
+4. **Browser console** — Check for errors from `@cometchat/chat-sdk-javascript` or `@cometchat/chat-uikit-react`. Look for `CometChatCalls initialization failed` if calling isn't working
+5. **Network tab** — Verify WebSocket connection to CometChat servers is established. Look for "ConnectionListener =>connected" in console logs
+6. **Package versions** — Run `npm ls @cometchat/chat-sdk-javascript @cometchat/chat-uikit-react rxjs` to verify compatible versions are installed
+7. **Peer dependencies** — Ensure `rxjs` (^7.8.1), `react` (>=18), and `@types/react` (>=18) are installed
+8. **SSR check** — If using Next.js or Astro, confirm CometChat components only render client-side
+9. **Dashboard features** — Extensions, AI features, and calling must be enabled in the Dashboard before they appear in the UI
+10. **Use UI Kit wrappers** — Always use `CometChatUIKit.sendTextMessage()` / `sendMediaMessage()` / `sendCustomMessage()` instead of raw SDK calls. The wrappers manage internal eventing (`ccMessageSent`) that keeps UI components synchronized
+
+---
+
+## Still Stuck?
+
+
+
+ Open a support ticket for direct assistance
+
+
+ Compare your code against the working sample app
+
+
+ Inspect the UI Kit source for deeper debugging
+
+
diff --git a/ui-kit/react/upgrading-from-v5.mdx b/ui-kit/react/upgrading-from-v5.mdx
index c8308a80f..2437a1392 100644
--- a/ui-kit/react/upgrading-from-v5.mdx
+++ b/ui-kit/react/upgrading-from-v5.mdx
@@ -1,6 +1,15 @@
---
-title: "Upgrading From V5"
+title: "Upgrading from V5 to V6"
+description: "Migration guide for upgrading from CometChat React UI Kit v5 to v6 with breaking changes and new patterns."
---
+
+- **Package:** `@cometchat/chat-uikit-react` (replaces v5 packages)
+- **New init pattern:** `UIKitSettingsBuilder` + `CometChatUIKit.init()`
+- **Theming:** CSS variables replace inline style objects. See [Theming](/ui-kit/react/theme)
+- **Localization:** `CometChatLocalize.init(settings)` — language codes changed (e.g., `en` → `en-US`), new `CalendarObject` for date formatting
+- **Key changes:** `setLocale` → `setCurrentLanguage`, `localize` → `getLocalizedString`, `datePattern` → `CalendarObject`-based props
+- **Detailed prop changes:** [Property Changes](/ui-kit/react/property-changes)
+
## Introduction
@@ -27,7 +36,7 @@ The **CometChat v6 React UI Kit** introduces a **revamped localization system**
In CometChat v5 UI Kit, the [`CometChatLocalize.init()`](/ui-kit/react/v5/localize#methods) accepts 2 parameters: `language` & `resources`
-```js V5 UI Kit
+```js title="V5 UI Kit" lines
CometChatLocalize.init("en", {
CHATS: "Chats",
});
@@ -35,7 +44,7 @@ CometChatLocalize.init("en", {
In CometChat v6 UI Kit, the [`CometChatLocalize.init()`](/ui-kit/react/localize#initialize-cometchatlocalize) method accepts a [**localization setting**](/ui-kit/react/localize#localizationsettings) instead of individual parameters.
-```js V6 UI Kit
+```js title="V6 UI Kit" lines
CometChatLocalize.init({
language: "en-US",
translationsForLanguage: {
@@ -73,7 +82,7 @@ There are no changes for any other languages.
In CometChat v5 UI Kit, the only way to add or override translations was by passing them in the [`init()`](/ui-kit/react/v5/localize#methods) method.
-```js V5 UI Kit
+```js title="V5 UI Kit" lines
CometChatLocalize.init("en", {
CHATS: "Chats",
});
@@ -81,7 +90,7 @@ CometChatLocalize.init("en", {
In CometChat v6 UI Kit, translations can be added or overridden using the [`init()`](/ui-kit/react/localize#initialize-cometchatlocalize) method or the [`addTranslation()`](/ui-kit/react/localize#add-custom-translations) method.
-```js V6 UI Kit
+```js title="V6 UI Kit" lines
CometChatLocalize.addTranslation({
"en-US": { conversation_chat_title: "Chats" },
});
@@ -93,7 +102,7 @@ CometChatLocalize.addTranslation({
CometChat v5 UI Kit lacked support for date formatting, but CometChat v6 UI Kit introduces the [`CalendarObject`](/ui-kit/react/localize#calendarobject) for date and time formatting.
-```js V6 UI Kit
+```js title="V6 UI Kit" lines
const formattedDate = new CalendarObject({
today: "[Today at] hh:mm A",
yesterday: "[Yesterday at] hh:mm A",
@@ -110,7 +119,7 @@ CometChatLocalize.init({
CometChat v5 UI Kit did not handle missing translation keys, whereas CometChat v6 UI Kit introduces a [`missingKeyHandler`](/ui-kit/react/localize#initialize-cometchatlocalize) for better control.
-```javascript V6 UI Kit
+```javascript title="V6 UI Kit" lines
CometChatLocalize.init({
missingKeyHandler: (key) => `Missing translation: ${key}`,
});
@@ -122,7 +131,7 @@ CometChatLocalize.init({
In CometChat v5 UI Kit, the language code for English was `en`.
-```json V5 UI Kit
+```json title="V5 UI Kit" lines
{
"en": {
"CHATS": "Chats"
@@ -132,7 +141,7 @@ In CometChat v5 UI Kit, the language code for English was `en`.
In CometChat v6 UI Kit, the language codes have been expanded to distinguish between regional variants: `en-US` & `en-GB`.
-```json V6 UI Kit
+```json title="V6 UI Kit" lines
{
"en-US": {
"conversation": "conversation_chat_title"
@@ -151,3 +160,24 @@ In CometChat v6 UI Kit, the language codes have been expanded to distinguish bet
## Properties & Methods
In CometChat v6 UI Kit, several props and methods in components and the CometChatLocalize class have been updated. For a detailed overview of newly added, renamed, and removed properties/methods, refer to the [Property Changes](/ui-kit/react/property-changes) Documentation.
+
+***
+
+## Next Steps
+
+
+
+ Detailed prop and method renames from v5 to v6.
+
+
+ Fresh v6 setup guide for React.js.
+
+
+ Explore all v6 prebuilt UI components.
+
+
+ New CSS variable-based theming system.
+
+
+
+***
diff --git a/ui-kit/react/url-formatter-guide.mdx b/ui-kit/react/url-formatter-guide.mdx
index 0707d3b05..a7ec781eb 100644
--- a/ui-kit/react/url-formatter-guide.mdx
+++ b/ui-kit/react/url-formatter-guide.mdx
@@ -1,10 +1,25 @@
---
title: "URL Formatter"
+description: "Detect and style plain URLs as clickable links with optional tracking logic in CometChat React UI Kit."
---
+
+
+| Field | Value |
+| --- | --- |
+| Package | `@cometchat/chat-uikit-react` |
+| Key class | `CometChatUrlsFormatter` (extends `CometChatTextFormatter`) |
+| Init | `CometChatUIKit.init(UIKitSettings)` then `CometChatUIKit.login("UID")` |
+| Purpose | Auto-detects URLs in text messages and converts them to clickable links |
+| Sample app | [GitHub](https://github.com/cometchat/cometchat-uikit-react/tree/v6/sample-app) |
+| Related | [Custom Text Formatter](/ui-kit/react/custom-text-formatter-guide) · [All Guides](/ui-kit/react/guide-overview) |
+
+
+
+
## Overview
-`CometChatUrlsFormatter` is a specialized subclass of `CometChatTextFormatter` designed to automatically detect URLs in text messages and convert them into clickable links, allowing users to navigate to the web addresses effortlessly within your CometChat application.
+`CometChatUrlsFormatter` is a specialized subclass of `CometChatTextFormatter` designed to automatically detect URLs in text messages and convert them into clickable links within your CometChat application.
@@ -16,7 +31,7 @@ title: "URL Formatter"
-```ts
+```ts lines
import { CometChatTextFormatter } from "path-to-cometchat-text-formatter";
export class CometChatUrlsFormatter extends CometChatTextFormatter {
@@ -65,7 +80,7 @@ When implementing the CometChatUrlsFormatter, you can customize the appearance o
Apply CSS to style your clickable links, for example:
-```python
+```css lines
.clickable-url {
color: #1a0dab;
text-decoration: underline;
@@ -77,9 +92,28 @@ Apply CSS to style your clickable links, for example:
Implement the onUrlClick method within your formatter class to define custom logic for when a link is clicked:
-```javascript
+```javascript lines
onUrlClick(event) {
const url = event.target.dataset.url;
window.open(url, '_blank');
}
```
+
+## Next Steps
+
+
+
+ Build custom inline text patterns.
+
+
+ Render real-time message threads.
+
+
+ Browse all feature and formatter guides.
+
+
+ Full working sample application on GitHub.
+
+
+
+***
diff --git a/ui-kit/react/users.mdx b/ui-kit/react/users.mdx
index ff44ce47a..72f2be10a 100644
--- a/ui-kit/react/users.mdx
+++ b/ui-kit/react/users.mdx
@@ -1,47 +1,51 @@
---
title: "Users"
+description: "Display and manage the list of all available users with avatars, names, and online/offline status using the CometChatUsers component in the React UI Kit."
---
-## Overview
-
-The Users is a Component, showcasing an accessible list of all available users. It provides an integral search functionality, allowing you to locate any specific user swiftly and easily. For each user listed, the widget displays the user's name by default, in conjunction with their avatar when available. Furthermore, it includes a status indicator, visually informing you whether a user is currently online or offline.
-
-The Users component is composed of the following BaseComponents:
-
-| 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. |
+
-***
+| Field | Value |
+| --- | --- |
+| Purpose | Searchable, scrollable list of all available users with avatar, name, and online/offline status |
+| Package | `@cometchat/chat-uikit-react` |
+| Import | `import { CometChatUsers } from "@cometchat/chat-uikit-react";` |
+| Used in experiences | User directory, contact list, new chat user picker, group member addition |
+| Copy-paste base | See [Base Code](#base-code--stylesheet) below |
+| Primary output | `CometChat.User` object (from `onItemClick`) |
+| Primary hook points | `onItemClick`, `onSelect`, `onEmpty`, `onError`, `usersRequestBuilder`, `searchRequestBuilder`, view slots (`itemView`, `subtitleView`, `trailingView`, `leadingView`, `headerView`, `titleView`) |
+| CSS root class | `.cometchat-users` |
+| Real-time events | None emitted directly. Component auto-reflects SDK user presence changes (`onUserOnline`, `onUserOffline`). |
-## Usage
+
-### Integration
+## Base Code and Stylesheet
-The following code snippet illustrates how you can directly incorporate the Users component into your Application.
+Renders a searchable, scrollable list of all available users.
-```tsx
+```tsx lines
import { CometChatUsers } from "@cometchat/chat-uikit-react";
function UsersDemo() {
- return ;
+ return (
+
+
+
+ );
}
export default UsersDemo;
```
-
-
-```tsx
-import { UsersDemo } from "./UsersDemo";
+```tsx lines
+import UsersDemo from "./UsersDemo";
export default function App() {
return (
@@ -51,645 +55,532 @@ export default function App() {
);
}
```
-
-
-### Actions
-
-[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. onSelect
-
-The `onSelect` action is activated when you select the done icon while in selection mode. This returns a list of all the users that you have selected.
-
-This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
-
-
-
-```ts
-import { CometChatUsers, SelectionMode } from "@cometchat/chat-uikit-react";
-
-function UsersDemo() {
- function handleOnSelect(users: CometChat.User, selected: boolean): void {
- console.log(users);
- //your custom onSelect actions
- }
+Root CSS class for style overrides:
- return (
-
- );
+```css lines
+.cometchat-users {
+ /* overrides here */
}
-
-export default UsersDemo;
```
-
+## Functionality
-
-```js
-import { CometChatUsers, SelectionMode } from "@cometchat/chat-uikit-react";
+Props that control component behavior, grouped by surface area.
-function UsersDemo() {
- function handleOnSelect(users, selected) {
- console.log(users);
- //your custom onSelect actions
- }
+### Data and Loading
- return (
-
- );
-}
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `usersRequestBuilder` | `CometChat.UsersRequestBuilder` | SDK default (30 per page) | Controls which users load and in what order | Pass the builder, not a built request |
+| `searchRequestBuilder` | `CometChat.UsersRequestBuilder` | Same as `usersRequestBuilder` | Controls filtering when the search bar is active | Keeps search results consistent with the main list filters |
+| `activeUser` | `CometChat.User` | `undefined` | Highlights the specified user in the list | Must be a reference-equal object from the SDK |
+| `searchKeyword` | `string` | `""` | Pre-fills the search and filters the user list | — |
-export default UsersDemo;
-```
+### Selection Behavior
-
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `selectionMode` | `SelectionMode` | `SelectionMode.none` | Enables single or multi-select checkboxes on list items | Must pair with `onSelect` to capture selections |
+| `showSelectedUsersPreview` | `boolean` | `false` | Shows a preview strip of selected users when `selectionMode` is `multiple` | Only visible in multi-select mode |
-
+### UI Visibility Toggles
-##### 2. onItemClick
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `hideSearch` | `boolean` | `false` | Hides the default search bar | — |
+| `hideError` | `boolean` | `false` | Hides the default and custom error views | Also suppresses `errorView` if set |
+| `hideUserStatus` | `boolean` | `false` | Hides the online/offline status indicator | — |
+| `showSectionHeader` | `boolean` | `true` | Displays alphabetical section headers (A, B, C…) | — |
+| `showScrollbar` | `boolean` | `false` | Shows the scrollbar in the user list | — |
-The `OnItemClick` event is activated when you click on the UserList item. This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
+### State and UX Behavior
-
-
-```ts
-import { CometChatUsers } from "@cometchat/chat-uikit-react";
+| Property | Type | Default | Effect | Pitfall |
+| --- | --- | --- | --- | --- |
+| `sectionHeaderKey` | `keyof CometChat.User` | `getName` | The property on the user object used to extract the section header character | Only relevant when `showSectionHeader={true}` |
+| `disableLoadingState` | `boolean` | `false` | Disables the loading state while fetching users | Useful when updating the request builder without clearing the list |
-function UsersDemo() {
- function handleOnItemClick(user: CometChat.User): void {
- console.log(user, "your custom on item click action");
- }
- return ;
-}
+### Custom Views (Render Props)
-export default UsersDemo;
-```
+These replace sections of the default UI. See [Custom View Slots](#custom-view-slots) for full examples.
-
+| Property | Type | Effect |
+| --- | --- | --- |
+| `loadingView` | `JSX.Element` | Shown while users are loading |
+| `emptyView` | `JSX.Element` | Shown when there are no users |
+| `errorView` | `JSX.Element` | Shown when an error occurs |
-
-```js
-import { CometChatUsers } from "@cometchat/chat-uikit-react";
+## Actions
-function UsersDemo() {
- function handleOnItemClick(user) {
- console.log(user, "your custom on item click action");
- }
- return ;
-}
+[Actions](/ui-kit/react/components-overview#actions) split into predefined (built-in triggers) and user-defined (callbacks).
-export default UsersDemo;
-```
+### Predefined Actions
-
+The component has no built-in navigation behavior. All interaction handling is delegated to callbacks.
-
+### User-Defined Actions
-##### 3. onEmpty
+#### onItemClick
-This action allows you to specify a callback function to be executed when a certain condition, typically the absence of data or content, is met within the component or element.
+Fires when a user taps a user row. Primary navigation hook.
-
-
-```ts
+| Detail | Value |
+| --- | --- |
+| When it fires | User clicks/taps a user list item |
+| Payload type | `(user: CometChat.User) => void` |
+| What devs typically do next | Set active user in state, navigate to message view |
+
+```tsx lines
import { CometChatUsers } from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
-function UsersDemo() {
- function handleOnEmpty(): void {
- console.log("your custom on Empty action");
- }
- return ;
-}
+const handleOnItemClick = (user: CometChat.User) => {
+ console.log("User clicked:", user.getName());
+ // Your custom action here
+};
-export default UsersDemo;
+;
```
-
+#### onSelect
-
-```js
-import { CometChatUsers } from "@cometchat/chat-uikit-react";
+Fires when a user is selected or deselected in multi-select mode. Requires `selectionMode` to be set.
-function UsersDemo() {
- function handleOnEmpty() {
- console.log("your custom on Empty action");
- }
+| Detail | Value |
+| --- | --- |
+| When it fires | User checks/unchecks a user in selection mode |
+| Payload type | `(user: CometChat.User, selected: boolean) => void` |
+| What devs typically do next | Track selected users for batch operations (create group, broadcast) |
- return ;
-}
+```tsx lines
+import { CometChatUsers, SelectionMode } from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
-export default UsersDemo;
+const handleOnSelect = (user: CometChat.User, selected: boolean) => {
+ console.log("Selected:", user.getName(), selected);
+ // Your custom action on select
+};
+
+;
```
-
+#### onEmpty
-
+Fires when the user list is empty (no users match the current filter/search).
-##### 4. onError
+| Detail | Value |
+| --- | --- |
+| When it fires | User list fetch returns zero results |
+| Payload type | `() => void` |
+| What devs typically do next | Show custom empty state, log analytics |
-This action doesn't change the behavior of the component but rather listens for any errors that occur in the User component.
-
-
-
-```ts
+```tsx lines
import { CometChatUsers } from "@cometchat/chat-uikit-react";
-function UsersDemo() {
- const handleOnError = (error: CometChat.CometChatException) => {
- console.log("Your custom on error actions");
- };
- return ;
-}
+const handleOnEmpty = () => {
+ console.log("No users available");
+};
-export default UsersDemo;
+;
```
-
+#### onError
-
-```js
-import { CometChatUsers } from "@cometchat/chat-uikit-react";
+Fires when the component encounters an error (network failure, auth issue, etc.).
-function UsersDemo() {
- const handleOnError = (error) => {
- console.log("Your custom on error actions");
- };
+| Detail | Value |
+| --- | --- |
+| When it fires | Any internal error during data fetching or rendering |
+| Payload type | `(error: CometChat.CometChatException) => void` |
+| What devs typically do next | Log to error tracking service, show custom toast |
- return ;
-}
+```tsx lines
+import { CometChatUsers } from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
-export default UsersDemo;
-```
+const handleOnError = (error: CometChat.CometChatException) => {
+ console.error("Users error:", error.message);
+ // Your exception handling code
+};
-
+;
+```
-
+## Filters
-### Filters
+Control which users appear using `UsersRequestBuilder`. Pass the builder (not a built request) to the `usersRequestBuilder` prop.
-**Filters** allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.
+Refer to [UsersRequestBuilder](/sdk/javascript/retrieve-users) for the full API.
-##### 1. UserRequestBuilder
+### Filter Recipes
-The [UserRequestBuilder](/sdk/javascript/retrieve-users) enables you to filter and customize the user list based on available parameters in UserRequestBuilder. This feature allows you to create more specific and targeted queries when fetching users. The following are the parameters available in [UserRequestBuilder](/sdk/javascript/retrieve-users)
+| Recipe | Code |
+| --- | --- |
+| Friends only | `new CometChat.UsersRequestBuilder().friendsOnly(true)` |
+| Online users only | `new CometChat.UsersRequestBuilder().setStatus("online")` |
+| Limit to 15 per page | `new CometChat.UsersRequestBuilder().setLimit(15)` |
+| Search by keyword | `new CometChat.UsersRequestBuilder().setSearchKeyword("alice")` |
+| Hide blocked users | `new CometChat.UsersRequestBuilder().hideBlockedUsers(true)` |
+| Filter by roles | `new CometChat.UsersRequestBuilder().setRoles(["admin", "moderator"])` |
+| Filter by tags | `new CometChat.UsersRequestBuilder().setTags(["vip"])` |
+| Specific UIDs | `new CometChat.UsersRequestBuilder().setUIDs(["uid1", "uid2"])` |
-| Methods | Type | Description |
-| -------------------- | ------------- | -------------------------------------------------------------------------------------- |
-| **setLimit** | number | sets the number users that can be fetched in a single request, suitable for pagination |
-| **setSearchKeyword** | String | used for fetching users matching the passed string |
-| **hideBlockedUsers** | boolean | used for fetching all those users who are not blocked by the logged in user |
-| **friendsOnly** | boolean | used for fetching only those users in which logged in user is a member |
-| **setRoles** | List\ | used for fetching users containing the passed tags |
-| **setTags** | List\ | used for fetching users containing the passed tags |
-| **withTags** | boolean | used for fetching users containing tags |
-| **setStatus** | String | used for fetching users by their status online or offline |
-| **setUIDs** | List\ | used for fetching users containing the passed users |
+### Example
-**Example**
+```tsx lines
+import { CometChatUsers } from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
-In the example below, we are applying a filter to the UserList based on Friends.
+;
+```
-
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatUsers } from "@cometchat/chat-uikit-react";
+### Performance Note
-function UsersDemo() {
- return (
-
- );
-}
+The default page size is 30. Reducing it with `setLimit` can improve initial load time on slower connections. The component uses infinite scroll — the next page loads automatically as the user scrolls to the bottom.
-export default UsersDemo;
-```
+### Search Request Builder
-
+The `searchRequestBuilder` uses `UsersRequestBuilder` to filter the search list independently, keeping uniformity between the displayed user list and searched results.
-
-```js
-import { CometChat } from "@cometchat/chat-sdk-javascript";
+```tsx lines
import { CometChatUsers } from "@cometchat/chat-uikit-react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
-function UsersDemo() {
- return (
-
- );
-}
-
-export default UsersDemo;
+;
```
-
+## Events
-
+### UI Events
-##### 2. SearchRequestBuilder
+The CometChatUsers component does not emit any custom UI events.
-The SearchRequestBuilder uses [UserRequestBuilder](/sdk/javascript/retrieve-users) enables you to filter and customize the search list based on available parameters in UserRequestBuilder. This feature allows you to keep uniformity between the displayed UserList and searched UserList.
+The component internally subscribes to user lifecycle events via `CometChatUserEvents`:
-**Example**
+| Event | What it does inside the component |
+| --- | --- |
+| `CometChatUserEvents.ccUserBlocked` | Updates the blocked user in the list |
+| `CometChatUserEvents.ccUserUnblocked` | Updates the unblocked user in the list |
-
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatUsers } from "@cometchat/chat-uikit-react";
+### SDK Events (Real-Time)
-function UsersDemo() {
- return (
-
- );
-}
+The component automatically listens to SDK user presence events internally. No manual attachment needed unless additional side effects are required.
-export default UsersDemo;
-```
+| SDK Listener | What it does inside the component |
+| --- | --- |
+| `onUserOnline` | Updates the user's status dot to online |
+| `onUserOffline` | Updates the user's status dot to offline |
-
+#### Subscribing to presence events externally
-
-```js
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatUsers } from "@cometchat/chat-uikit-react";
+To react to user presence changes elsewhere in the application:
-function UsersDemo() {
- return (
-
- );
-}
+```tsx lines
+import { CometChat } from "@cometchat/chat-sdk-javascript";
-export default UsersDemo;
-```
+const listenerID = "USERS_PRESENCE_LISTENER";
-
+// Subscribe
+CometChat.addUserListener(
+ listenerID,
+ new CometChat.UserListener({
+ onUserOnline: (onlineUser: CometChat.User) => {
+ console.log("User online:", onlineUser.getName());
+ },
+ onUserOffline: (offlineUser: CometChat.User) => {
+ console.log("User offline:", offlineUser.getName());
+ },
+ })
+);
-
+// Unsubscribe (e.g., in useEffect cleanup)
+CometChat.removeUserListener(listenerID);
+```
-***
+#### React StrictMode Note
-### Events
+In React 18 StrictMode, `useEffect` runs twice on mount in development. SDK listeners may be registered twice. The component handles cleanup internally, but any additional listeners added alongside the component need cleanup in the `useEffect` return function to avoid duplicate event handling.
-[Events](/ui-kit/react/components-overview#events) are emitted by a `Component`. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
+## Advanced: Custom View Slots
-To handle events supported by Users you have to add corresponding listeners by using `CometChatUserEvents`
+Customization override points for the user list UI. Each slot receives the user object and returns JSX.
-The `Users` component does not produce any events directly.
+### Slot Catalog
-***
+| Slot | Params | What it replaces | Section |
+| --- | --- | --- | --- |
+| `itemView` | `(user: CometChat.User) => JSX.Element` | Entire list item row | Whole item |
+| `leadingView` | `(user: CometChat.User) => JSX.Element` | Avatar / left section | Sub-section (leading) |
+| `trailingView` | `(user: CometChat.User) => JSX.Element` | Right section | Sub-section (trailing) |
+| `titleView` | `(user: CometChat.User) => JSX.Element` | Name / title text | Sub-section (title) |
+| `subtitleView` | `(user: CometChat.User) => JSX.Element` | Subtitle text | Sub-section (subtitle) |
+| `headerView` | `JSX.Element` | Entire header bar | Whole section |
+| `loadingView` | `JSX.Element` | Loading spinner | Empty/loading/error |
+| `emptyView` | `JSX.Element` | Empty state | Empty/loading/error |
+| `errorView` | `JSX.Element` | Error state | Empty/loading/error |
+| `options` | `(user: CometChat.User) => CometChatOption[]` | Context menu / hover actions | Whole item |
-## Customization
+### itemView
-To fit your app's design requirements, you can customize the appearance of the Users component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.
+Replace the entire list item row.
-### Style
+Default:
-Using CSS you can customize the look and feel of the component in your app like the color, size, shape, and fonts.
+
+
+
-**Example**
+Customized:
-
+
-```ts
-import { CometChatUsers } from "@cometchat/chat-uikit-react";
+```ts lines
+import { CometChat } from "@cometchat/chat-sdk-javascript";
+import { CometChatUsers, CometChatListItem } from "@cometchat/chat-uikit-react";
function UsersDemo() {
- return ;
-}
-
-export default UsersDemo;
-```
-
-
+ const getItemView = (user: CometChat.User) => {
+ const status = user.getStatus();
-
-```js
-import { CometChatUsers } from "@cometchat/chat-uikit-react";
+ return (
+
+
+
+ );
+ };
-function UsersDemo() {
- return ;
+ return ;
}
export default UsersDemo;
```
-
-
-
-```css
-.cometchat .cometchat-users .cometchat-list__header-title {
- background-color: #fce9ea;
- color: #e5484d;
- border: 0px 1px 1px 0px solid #e5484d;
- font-family: "Times New Roman";
-}
-
-.cometchat .cometchat-users .cometchat-search-bar__input::placeholder {
- font-family: "Times New Roman";
- font-size: 16px;
- font-style: normal;
- font-weight: 400;
- line-height: 19.2px;
-}
-
-.cometchat .cometchat-users .cometchat-list-item__body-title {
+
+```css lines
+.cometchat .cometchat-users .cometchat-list-item__body-subtitle {
overflow: hidden;
- color: #141414;
+ color: #727272;
text-overflow: ellipsis;
- font-family: "Times New Roman";
- font-size: 16px;
+ white-space: nowrap;
+ font-family: Roboto;
+ font-size: 14px;
font-style: normal;
font-weight: 400;
- line-height: 19.2px;
-}
-
-.cometchat .cometchat-users__list-item .cometchat-avatar {
- -webkit-mask: url("../assets/user-fill.svg") center center no-repeat;
- mask: url("../assets/user-fill.svg") center center no-repeat;
- display: flex;
- width: 24px;
- height: 24px;
- justify-content: center;
- align-items: center;
- flex-shrink: 0;
- background-color: #ffffff;
-}
-
-.cometchat .cometchat-users__list-item .cometchat-avatar__image {
- display: none;
+ line-height: 16.8px;
}
-.cometchat-list-item__leading-view {
- background: #f0999b;
- border-radius: 9.6px;
+.cometchat
+ .cometchat-users
+ .cometchat-users__list-item-active
+ .cometchat-list-item {
+ background: rgba(9, 194, 111, 0.1);
}
```
-
-
-***
+### leadingView
-### Functionality
+Replace the avatar / left section.
-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.
+
+
+
-```ts
-import { CometChatUsers, TitleAlignment } from "@cometchat/chat-uikit-react";
+```ts lines
+import React from "react";
+import { CometChat } from "@cometchat/chat-sdk-javascript";
+import { CometChatUsers, CometChatAvatar } from "@cometchat/chat-uikit-react";
-function UsersDemo() {
+const customLeadingView = (user: CometChat.User): JSX.Element => {
return (
-
+
+
+
+
+
+
);
-}
+};
-export default UsersDemo;
+;
```
-
+
+```css lines
+.cometchat-users .cometchat-list-item .users__leading-view .cometchat-avatar__image,
+.cometchat-users .cometchat-list-item .users__leading-view .cometchat-avatar {
+ border-radius: 8px;
+ height: 48px;
+ width: 48px;
+ filter: blur(1px);
+}
-
-```js
-import { CometChatUsers, TitleAlignment } from "@cometchat/chat-uikit-react";
+.users__leading-view-role {
+ display: flex;
+ width: 48px;
+ height: 15px;
+ padding: 1px 3px;
+ justify-content: center;
+ align-items: center;
+ font: 600 8px/9.6px Roboto;
+ position: absolute;
+ bottom: -2px;
+}
-function UsersDemo() {
- return (
-
- );
+.users__leading-view {
+ position: relative;
}
-export default UsersDemo;
+.users__leading-view-role img {
+ height: 18px;
+ width: 18px;
+ margin-bottom: 3px;
+}
```
-
-
-Below is a list of customizations along with corresponding code snippets
-
-| Property | Description | Code |
-| ------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------------- |
-| **Hide Search** | Hides the default search bar. | `hideSearch={true}` |
-| **Show Section Header** | Displays an alphabetical section header for the user list. | `showSectionHeader={true}` |
-| **Hide Error** | Hides both the default and custom error view passed in `errorView` prop. | `hideError={true}` |
-| **Hide User Status** | Hides the user's online/offline status indicator. | `hideUserStatus={true}` |
-| **Active User** | The user to be highlighted in the users list. | `activeUser={chatUser}` |
-| **Search Keyword** | The search keyword used to filter the user list. | `searchKeyword="Alice"` |
-| **Section Header Key** | The property on the user object used to extract the section header character. | `sectionHeaderKey={getName}` |
-| **Selection Mode** | Selection mode to use for the default trailing view. | `selectionMode={SelectionMode.multiple}` |
-| **Show Scrollbar** | Controls the visibility of the scrollbar in the list. | `showScrollbar={true}` |
-| **Loading View** | A custom view to display during the loading state. | `loadingView={<>Custom Loading View>}` |
-| **Empty View** | A custom view to display when no users are available in the list. | `emptyView={<>Custom Empty View>}` |
-| **Error View** | A custom view to display when an error occurs. | `errorView={<>Custom Error View>}` |
-| **Show Selected Users Preview** | Shows a preview of selected users when selectionMode is multiple. | `showSelectedUsersPreview={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.
-
-***
-
-#### ItemView
-
-A custom view to render for each user in the fetched list.
-
-Shown below is the default chat interface.
-
-
-
-
+### trailingView
-The customized chat interface is displayed below.
+Replace the right section.
-
+
-Use the following code to achieve the customization shown above.
-
-```ts
-import { CometChat } from "@cometchat/chat-sdk-javascript";
-import { CometChatUsers } from "@cometchat/chat-uikit-react";
-
-function UsersDemo() {
- const getItemView = (user: CometChat.User) => {
- const status = user.getStatus();
-
- return (
-
-}
-
-;
-```
-
-
-
-
-```css
-.users__trailing-view{
- display: flex;
- width: 33px;
- padding: 5px 3px;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- gap: 3px;
- border-radius: 4px;
- background: #6852D6;
-}
-.users__trailing-view-icon{
- width: 10px;
- height: 10px;
-}
-.users__trailing-view-icon img{
- height: inherit;
- width: inherit;
-}
-.users__trailing-view-text{
- font: 600 8px Inter;
- color: white;
-}
-```
-
-
-***
-
-#### Options
+### options
-A function that returns a list of actions available when hovering over a user item.
+Replace the context menu / hover actions on each user item.
-Shown below is the default chat interface.
+Default:
-The customized chat interface is displayed below.
+Customized:
-Use the following code to achieve the customization shown above.
-
-```ts
+```ts lines
+import { CometChat } from "@cometchat/chat-sdk-javascript";
import { CometChatUsers, CometChatOption } from "@cometchat/chat-uikit-react";
function UsersDemo() {
@@ -1074,36 +769,9 @@ function UsersDemo() {
export default UsersDemo;
```
-
-
-
-
-```js
-import { CometChatUsers, CometChatOption } from "@cometchat/chat-uikit-react";
-
-function UsersDemo() {
- const getOptions = (user) => {
- return [
- new CometChatOption({
- id: "delete",
- title: "delete",
- onClick: () => {
- console.log("Custom option clicked for user:", user);
- },
- }),
- ];
- };
-
- return ;
-}
-
-export default UsersDemo;
-```
-
-
-
-```css
+
+```css lines
.cometchat .cometchat-users .cometchat-menu-list__menu {
background: none;
}
@@ -1124,7 +792,75 @@ export default UsersDemo;
mask-size: contain;
}
```
-
-
+
+#### Structure of CometChatOption
+
+| Name | Description |
+| --- | --- |
+| `id` | Unique identifier for each option |
+| `title` | Heading text for each option |
+| `iconURL` | Asset URL of the icon for each option |
+| `onClick` | Method invoked when user clicks the option |
+
+## Theme and Styling
+
+Using CSS, customize the look and feel of the component. The root CSS class is `.cometchat-users`.
+
+
+
+
+
+```tsx lines
+
+```
+
+```css lines
+.cometchat .cometchat-users .cometchat-list__header-title {
+ background-color: #fce9ea;
+ color: #e5484d;
+ border: 0px 1px 1px 0px solid #e5484d;
+ font-family: "Times New Roman";
+}
+
+.cometchat .cometchat-users .cometchat-search-bar__input::placeholder {
+ font-family: "Times New Roman";
+ font-size: 16px;
+ font-style: normal;
+ font-weight: 400;
+ line-height: 19.2px;
+}
+
+.cometchat .cometchat-users .cometchat-list-item__body-title {
+ overflow: hidden;
+ color: #141414;
+ text-overflow: ellipsis;
+ font-family: "Times New Roman";
+ font-size: 16px;
+ font-style: normal;
+ font-weight: 400;
+ line-height: 19.2px;
+}
+
+.cometchat .cometchat-users__list-item .cometchat-avatar {
+ -webkit-mask: url("../assets/user-fill.svg") center center no-repeat;
+ mask: url("../assets/user-fill.svg") center center no-repeat;
+ display: flex;
+ width: 24px;
+ height: 24px;
+ justify-content: center;
+ align-items: center;
+ flex-shrink: 0;
+ background-color: #ffffff;
+}
+
+.cometchat .cometchat-users__list-item .cometchat-avatar__image {
+ display: none;
+}
+
+.cometchat-list-item__leading-view {
+ background: #f0999b;
+ border-radius: 9.6px;
+}
+```
diff --git a/ui-kit/react/v4/call-buttons.mdx b/ui-kit/react/v4/call-buttons.mdx
index af19f06be..16babe97d 100644
--- a/ui-kit/react/v4/call-buttons.mdx
+++ b/ui-kit/react/v4/call-buttons.mdx
@@ -61,7 +61,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onVoiceCallClick
+#### 1. onVoiceCallClick
`onVoiceCallClick` is triggered when you click the voice call button of the `Call Buttons` component. You can override this action using the following code snippet.
@@ -134,7 +134,7 @@ export default CallButtonDemo;
-##### 2. onVideoCallClick
+#### 2. onVideoCallClick
`onVideoCallClick` is triggered when you click the video call button of the `Call Buttons` component. You can override this action using the following code snippet.
@@ -207,7 +207,7 @@ export default CallButtonDemo;
-##### 3. onError
+#### 3. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Call Button component.
@@ -353,7 +353,7 @@ To fit your app's design requirements, you can customize the appearance of the C
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. CallButtons Style
+#### 1. CallButtons Style
To customize the appearance, you can assign a `CallButtonsStyle` object to the `Call Buttons` component.
diff --git a/ui-kit/react/v4/call-log-details.mdx b/ui-kit/react/v4/call-log-details.mdx
index ecbae3009..5f982754b 100644
--- a/ui-kit/react/v4/call-log-details.mdx
+++ b/ui-kit/react/v4/call-log-details.mdx
@@ -91,7 +91,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onBackClick
+#### 1. onBackClick
`onBackClick` is triggered when you click on the back button of the Call Log Details component. You can override this action using the following code snippet.
@@ -241,7 +241,7 @@ To fit your app's design requirements, you have the ability to customize the app
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. CallLogDetails Style
+#### 1. CallLogDetails Style
You can set the `callLogDetailsStyle` to the Call Log Details Component to customize the styling.
@@ -398,7 +398,7 @@ The following properties are exposed by `CallLogDetailsStyle`:
| **nameTextColor** | Used to set name text color | `nameTextColor?: string;` |
| **backIconTint** | Used to set color of the back icon | `backIconTint?: string;` |
-##### 2. Avatar Style
+#### 2. Avatar Style
If you want to apply customized styles to the `Avatar` component within the `Call Log Details` Component, you can use the following code snippet. For more information you can refer [Avatar Styles](/ui-kit/react/v4/avatar#avatar-style).
diff --git a/ui-kit/react/v4/call-log-history.mdx b/ui-kit/react/v4/call-log-history.mdx
index 77433d3b4..cc1c5e12b 100644
--- a/ui-kit/react/v4/call-log-history.mdx
+++ b/ui-kit/react/v4/call-log-history.mdx
@@ -64,7 +64,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onBackClick
+#### 1. onBackClick
`onBackClick` is triggered when you click the Back button Icon of the `Call Log History` component. It does not have a default behavior. However, you can override its behavior using the following code snippet.
@@ -109,7 +109,7 @@ export default CallLogHistoryDemo;
-##### 1. onItemClick
+#### 1. onItemClick
`onItemClick` is triggered when you click on a ListItem of the of the `Call Log History` component. It does not have a default behavior. However, you can override its behavior using the following code snippet.
@@ -154,7 +154,7 @@ export default CallLogHistoryDemo;
-##### 3. onError
+#### 3. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the `Call Log History` component.
@@ -205,7 +205,7 @@ export default CallLogHistoryDemo;
**Filters** allow you to customize the data displayed in a list within a `Component`. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using `RequestBuilders` of Chat SDK.
-##### 1. CallLogRequestBuilder
+#### 1. CallLogRequestBuilder
The [CallLogRequestBuilder](/sdk/javascript/call-logs) enables you to filter and customize the Call Log History based on available parameters in [CallLogRequestBuilder](/sdk/javascript/call-logs). This feature allows you to create more specific and targeted queries when fetching the call logs. The following are the parameters available in [CallLogRequestBuilder](/sdk/javascript/call-logs)
@@ -296,7 +296,7 @@ To fit your app's design requirements, you have the ability to customize the app
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. CallLogHistory Style
+#### 1. CallLogHistory Style
To customize the appearance, you can assign a `CallLogHistoryStyle` object to the `Call Log History` component.
@@ -392,7 +392,7 @@ The following properties are exposed by `CallLogHistoryStyle`:
| **callStatusTextColor** | Used to set call status text color | `callStatusTextColor?: string;` |
| **dividerColor** | Used to set divider color | `dividerColor?: string;` |
-##### 2. ListItem Style
+#### 2. ListItem Style
If you want to apply customized styles to the `ListItemStyle` component within the `Call Log History` Component, you can use the following code snippet. For more information, you can refer [ListItem Styles](/ui-kit/react/v4/list-item#listitemstyle).
diff --git a/ui-kit/react/v4/call-log-participants.mdx b/ui-kit/react/v4/call-log-participants.mdx
index 5e0cbce11..04e09f664 100644
--- a/ui-kit/react/v4/call-log-participants.mdx
+++ b/ui-kit/react/v4/call-log-participants.mdx
@@ -95,7 +95,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onBackClick
+#### 1. onBackClick
`onBackClick` is triggered when you click the Back button Icon of the `Call Log Participants` component. It does not have a default behavior. However, you can override its behavior using the following code snippet.
@@ -211,7 +211,7 @@ export default CallLogParticipantsDemo;
-##### 2. onItemClick
+#### 2. onItemClick
`onItemClick` is triggered when you click on a ListItem of the of the `Call Log Participants` component. It does not have a default behavior. However, you can override its behavior using the following code snippet.
@@ -353,7 +353,7 @@ To fit your app's design requirements, you have the ability to customize the app
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. CallLogParticipants Style
+#### 1. CallLogParticipants Style
To customize the appearance, you can assign a `CallLogParticipantsStyle` object to the `Call Log Participants` component.
@@ -501,7 +501,7 @@ The following properties are exposed by `CallLogParticipantsStyle`:
| **dateTextFont** | Used to set date text font | `dateTextFont?: string;` |
| **dateTextColor** | Used to set date text color | `dateTextColor?: string;` |
-##### 2. ListItem Style
+#### 2. ListItem Style
If you want to apply customized styles to the `ListItemStyle` component within the `Call Log Participants` Component, you can use the following code snippet. For more information, you can refer [ListItem Styles](/ui-kit/react/v4/list-item#listitemstyle).
@@ -620,7 +620,7 @@ export default CallLogParticipantsDemo;
-##### 3. Avatar Style
+#### 3. Avatar Style
If you want to apply customized styles to the `Avatar` component within the `Call Log Participants` Component, you can use the following code snippet. For more information you can refer [Avatar Styles](/ui-kit/react/v4/avatar#avatar-style).
diff --git a/ui-kit/react/v4/call-log-recording.mdx b/ui-kit/react/v4/call-log-recording.mdx
index 7a369d802..9895f6cd1 100644
--- a/ui-kit/react/v4/call-log-recording.mdx
+++ b/ui-kit/react/v4/call-log-recording.mdx
@@ -94,7 +94,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onBackClick
+#### 1. onBackClick
`onBackClick` is triggered when you click the Back button Icon of the `Call Log Participants` component. It does not have a default behavior. However, you can override its behavior using the following code snippet.
@@ -209,7 +209,7 @@ export default CallLogRecordingsDemo;
-##### 2. onItemClick
+#### 2. onItemClick
`onItemClick` is triggered when you click on a ListItem of the of the `Call Log Participants` component. It does not have a default behavior. However, you can override its behavior using the following code snippet.
@@ -324,7 +324,7 @@ export default CallLogRecordingsDemo;
-##### 2. onDownloadClick
+#### 2. onDownloadClick
`onDownloadClick` is triggered when you click on the download of the of the `Call Log Recordings` component. you can override its behavior using the following code snippet.
@@ -465,7 +465,7 @@ To fit your app's design requirements, you have the ability to customize the app
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. CallLogRecordings Style
+#### 1. CallLogRecordings Style
To customize the appearance, you can assign a `CallLogRecordingsStyle` object to the `Call Log Recordings` component.
@@ -615,7 +615,7 @@ The following properties are exposed by `CallLogRecordingsStyle`:
| **dateTextFont** | Used to set date text font | `dateTextFont?: string;` |
| **dateTextColor** | Used to set date text color | `dateTextColor?: string;` |
-##### 2. ListItem Style
+#### 2. ListItem Style
If you want to apply customized styles to the `ListItemStyle` component within the `Call Log Recordings` Component, you can use the following code snippet. For more information, you can refer [ListItem Styles](/ui-kit/react/v4/list-item#listitemstyle).
diff --git a/ui-kit/react/v4/call-log-with-details.mdx b/ui-kit/react/v4/call-log-with-details.mdx
index 5820ceb95..957b2d20f 100644
--- a/ui-kit/react/v4/call-log-with-details.mdx
+++ b/ui-kit/react/v4/call-log-with-details.mdx
@@ -251,7 +251,7 @@ To fit your app's design requirements, you have the ability to customize the app
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. WithDetailsStyle
+#### 1. WithDetailsStyle
You can set the `withDetailsStyle` to the CallLogsWithDetails Component to customize the styling.
@@ -476,7 +476,7 @@ Below is a list of customizations along with corresponding code snippets:
***
-##### Components
+#### Components
Nearly all functionality customizations available for a Component are also available for the composite component. Using [Configuration](#configurations), you can modify the properties of its components to suit your needs.
diff --git a/ui-kit/react/v4/call-logs.mdx b/ui-kit/react/v4/call-logs.mdx
index 256792a02..7f6dab0a7 100644
--- a/ui-kit/react/v4/call-logs.mdx
+++ b/ui-kit/react/v4/call-logs.mdx
@@ -64,7 +64,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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
+#### 1. onItemClick
`OnItemClick` is triggered when you click on a ListItem of the Call Logs component. By default it initiate a call to the participant associated with the respective ListItem. You can override this action using the following code snippet.
@@ -109,7 +109,7 @@ export default CallLogDemo;
-##### 2. onInfoClick
+#### 2. onInfoClick
`onInfoClick` is triggered when you click the Info button Icon of the `Call Logs` component. It does not have a default behavior. However, you can override its behavior using the following code snippet.
@@ -154,7 +154,7 @@ export default CallLogDemo;
-##### 3. onError
+#### 3. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Call Logs component.
@@ -205,7 +205,7 @@ export default CallLogDemo;
**Filters** allow you to customize the data displayed in a list within a `Component`. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using `RequestBuilders` of Chat SDK.
-##### 1. CallLogRequestBuilder
+#### 1. CallLogRequestBuilder
The [CallLogRequestBuilder](/sdk/javascript/call-logs) enables you to filter and customize the Call Log based on available parameters in [CallLogRequestBuilder](/sdk/javascript/call-logs). This feature allows you to create more specific and targeted queries when fetching the call logs. The following are the parameters available in [CallLogRequestBuilder](/sdk/javascript/call-logs)
@@ -324,7 +324,7 @@ To fit your app's design requirements, you can customize the appearance of the C
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. CallLogs Style
+#### 1. CallLogs Style
To customize the appearance, you can assign a `CallLogsStyle` object to the `Call Logs` component.
@@ -410,7 +410,7 @@ The following properties are exposed by `CallLogsStyle`:
| **dateSeparatorTextFont** | Used to set date separator text font | `dateSeparatorTextFont?: string;` |
| **dateSeparatorTextColor** | Used to set date separator text color | `dateSeparatorTextColor?: string;` |
-##### 2. Avatar Style
+#### 2. Avatar Style
If you want to apply customized styles to the `Avatar` component within the `Call Logs` Component, you can use the following code snippet. For more information you can refer [Avatar Styles](/ui-kit/react/v4/avatar#avatar-style).
@@ -465,7 +465,7 @@ export default CallLogDemo;
-##### 3. ListItem Style
+#### 3. ListItem Style
If you want to apply customized styles to the `ListItemStyle` component within the `Call Logs` Component, you can use the following code snippet. For more information, you can refer [ListItem Styles](/ui-kit/react/v4/list-item#listitemstyle).
diff --git a/ui-kit/react/v4/conversations-with-messages.mdx b/ui-kit/react/v4/conversations-with-messages.mdx
index 4b2c8ba5b..516e0a56a 100644
--- a/ui-kit/react/v4/conversations-with-messages.mdx
+++ b/ui-kit/react/v4/conversations-with-messages.mdx
@@ -260,7 +260,7 @@ export default ConversationsWithMessagesDemo;
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.
-##### user
+#### user
you can utilize the `user` method with a [User](/sdk/javascript/user-management) object as input to the ConversationsWithMessages component. This will automatically direct you to the [Messages](/ui-kit/react/v4/messages) component for the specified `User`.
@@ -302,7 +302,7 @@ export default ConversationsWithMessagesDemo;
***
-##### group
+#### group
you can utilize the `group` method with a [Group](/sdk/javascript/groups-overview) object as input to the ConversationsWithMessages component. This will automatically direct you to the [Messages](/ui-kit/react/v4/messages) component for the specified `Group`.
@@ -345,7 +345,7 @@ export default ConversationsWithMessagesDemo;
***
-##### Components
+#### Components
Nearly all functionality customizations available for a Component are also available for the composite component. Using [Configuration](#configurations), you can modify the properties of its components to suit your needs.
diff --git a/ui-kit/react/v4/conversations.mdx b/ui-kit/react/v4/conversations.mdx
index 10a1f9317..7f2ffd2c9 100644
--- a/ui-kit/react/v4/conversations.mdx
+++ b/ui-kit/react/v4/conversations.mdx
@@ -75,7 +75,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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
+#### 1. OnItemClick
`OnItemClick` is triggered when you click on a ListItem of the Conversations component. The `OnItemClick` action doesn't have a predefined behavior. You can override this action using the following code snippet.
@@ -111,7 +111,7 @@ export default ConversationsDemo;
***
-##### 2. OnSelect
+#### 2. OnSelect
The `OnSelect` event is triggered upon the completion of a selection in `SelectionMode`. It does not have a default behavior. However, you can override its behavior using the following code snippet.
@@ -147,7 +147,7 @@ export default ConversationsDemo;
***
-##### 3. OnError
+#### 3. OnError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Conversations component.
@@ -262,7 +262,7 @@ To fit your app's design requirements, you can customize the appearance of the c
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. Conversation Style
+#### 1. Conversation Style
You can set the `ConversationsStyle` to the `Conversations` Component to customize the styling.
@@ -328,7 +328,7 @@ List of properties exposed by ConversationStyle
| privateGroupIconBackground | Sets the background of the status indicator representing private groups. |
| passwordGroupIconBackground | Sets the background of the status indicator representing password protected groups. |
-##### 2. Avatar Style
+#### 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/react/v4/avatar).
@@ -367,7 +367,7 @@ export default ConversationsDemo;
-##### 3. StatusIndicator Style
+#### 3. StatusIndicator Style
To apply customized styles to the Status Indicator component in the `Conversations` Component, you can use the following code snippet. For more information, visit [Status Indicator Styles](/ui-kit/react/v4/status-indicator).
@@ -406,7 +406,7 @@ export default ConversationsDemo;
-##### 4. Date Style
+#### 4. Date Style
To apply customized styles to the `Date` component in the `Conversations` Component, you can use the following code snippet. For more information, visit [Date Styles](/ui-kit/react/v4/date).
@@ -445,7 +445,7 @@ export default ConversationsDemo;
-##### 5. Badge Style
+#### 5. Badge Style
To apply customized styles to the `Badge` component in the `Conversations` Component, you can use the following code snippet. For more information, visit [Badge Styles](/ui-kit/react/v4/badge).
@@ -464,7 +464,7 @@ border: "1px solid pink",
-##### 6. Receipt Style
+#### 6. Receipt Style
To apply customized styles to the `receipt` component in the `Conversations` Component, you can use the following code snippet. For more information, visit [Receipts](/ui-kit/react/v4/receipt).
@@ -485,7 +485,7 @@ deliveredIconTint:"yellow"
-##### 7. Backdrop Style
+#### 7. Backdrop Style
To apply customized styles to the `Backdrop` component in the `Conversations` Component, you can use the following code snippet, you can use the following code snippet. For more information, visit [Backdrop Styles](/ui-kit/react/v4/backdrop).
@@ -505,7 +505,7 @@ const backdropStyle = new BackdropStyle({
-##### 8. Delete Conversation Dialog Style
+#### 8. Delete Conversation Dialog Style
To apply customized styles to the `delete dialog` component in the `Conversations` Component, you can use the following code snippet. For more information, visit [Delete dialog Styles](/ui-kit/react/v4/confirm-dialog).
@@ -525,7 +525,7 @@ borderRadius:"20px",
-##### 9. LisItem Style
+#### 9. LisItem Style
To apply customized styles to the `ListItemStyle` component in the `Conversations` Component, you can use the following code snippet. For more information, visit [List Item](/ui-kit/react/v4/list-item).
@@ -1258,7 +1258,7 @@ const getSubtitleView = (conversation: CometChat.Conversation) => {
User-defined actions which appears for each conversation on mouseover.
-##### Structure of CometChatOption
+#### Structure of CometChatOption
| Name | Description |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
diff --git a/ui-kit/react/v4/create-group.mdx b/ui-kit/react/v4/create-group.mdx
index 6753d81c9..314783cb5 100644
--- a/ui-kit/react/v4/create-group.mdx
+++ b/ui-kit/react/v4/create-group.mdx
@@ -73,7 +73,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. createClick
+#### 1. createClick
The `createClick` action is activated when you click the create Group button. This returns the created groups. You can override this action using the following code snippet.
@@ -134,7 +134,7 @@ export default CreateGroupDemo;
-##### 2. closeCallback
+#### 2. closeCallback
The `closeCallback` action is activated when you click the close button. You can override this action using the following code snippet.
@@ -195,7 +195,7 @@ export default CreateGroupDemo;
-##### 3. errorCallback
+#### 3. errorCallback
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Groups component.
@@ -310,7 +310,7 @@ To fit your app's design requirements, you can customize the appearance of the C
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. CreateGroup Style
+#### 1. CreateGroup Style
You can set the `CreateGroupStyle` to the `Create Group` Component to customize the styling.
diff --git a/ui-kit/react/v4/group-add-members.mdx b/ui-kit/react/v4/group-add-members.mdx
index edd437a58..22727db3f 100644
--- a/ui-kit/react/v4/group-add-members.mdx
+++ b/ui-kit/react/v4/group-add-members.mdx
@@ -84,7 +84,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onSelect
+#### 1. onSelect
The `onSelect` action is activated when you select the done icon while in selection mode. This returns a list of all the users that you have selected.
@@ -163,7 +163,7 @@ export default AddMembersDemo;
-##### 2. onAddMembersButtonClick
+#### 2. onAddMembersButtonClick
The `onAddMembersButtonClick` action is triggered when you click the add member button after choosing the users you wish to add in the group. By default, it returns the group GUID and an array of members to be added. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
@@ -247,7 +247,7 @@ export default AddMembersDemo;
-##### 3. OnBack
+#### 3. OnBack
`OnBack` is triggered when you click on the back button of the Add Members component. You can override this action using the following code snippet.
@@ -322,7 +322,7 @@ export default AddMembersDemo;
-##### 4. onClose
+#### 4. onClose
`onClose` is triggered when you click on the close button of the Add Members component. You can override this action using the following code snippet.
@@ -397,7 +397,7 @@ export default AddMembersDemo;
-##### 5. onError
+#### 5. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Add Members component.
@@ -478,7 +478,7 @@ export default AddMembersDemo;
**Filters** allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.
-##### 1. UsersRequestBuilder
+#### 1. UsersRequestBuilder
The [UsersRequestBuilder](/sdk/javascript/retrieve-users) enables you to filter and customize the users list based on available parameters in UsersRequestBuilder. This feature allows you to create more specific and targeted queries when fetching users. The following are the parameters available in [UsersRequestBuilder](/sdk/javascript/retrieve-users)
@@ -573,7 +573,7 @@ export default AddMembersDemo;
-##### 2. SearchRequestBuilder
+#### 2. SearchRequestBuilder
The SearchRequestBuilder uses [UserRequestBuilder](/sdk/javascript/retrieve-users) enables you to filter and customize the search list based on available parameters in UserRequestBuilder. This feature allows you to keep uniformity between the displayed UserList and searched UserList.
@@ -702,7 +702,7 @@ To fit your app's design requirements, you can customize the appearance of the A
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. AddMembers Style
+#### 1. AddMembers Style
You can set the `AddMembersStyle` to the Add Members Component to customize the styling.
@@ -845,7 +845,7 @@ List of properties exposed by AddMembersStyle:
| **addMembersButtonTextFont** | Used to set add members button text font | `addMembersButtonTextFont?: string;` |
| **padding** | Used to set padding | `padding?: string;` |
-##### 2. Avatar Style
+#### 2. Avatar Style
To apply customized styles to the `Avatar` component in the Add Members Component, you can use the following code snippet. For further insights on `Avatar` Styles [refer](/ui-kit/react/v4/avatar#avatar-style)
@@ -930,7 +930,7 @@ export default AddMembersDemo;
-##### 3. LisItem Style
+#### 3. LisItem Style
To apply customized styles to the `ListItemStyle` component in the `Add Members` Component, you can use the following code snippet. For further insights on `ListItemStyle` Styles [refer](/ui-kit/react/v4/list-item)
@@ -1015,7 +1015,7 @@ export default AddMembersDemo;
-##### 4. StatusIndicator Style
+#### 4. StatusIndicator Style
To apply customized styles to the Status Indicator component in the Add Members Component, You can use the following code snippet. For further insights on Status Indicator Styles [refer](/ui-kit/react/v4/status-indicator)
diff --git a/ui-kit/react/v4/group-banned-members.mdx b/ui-kit/react/v4/group-banned-members.mdx
index 021d1828e..61fd97e2c 100644
--- a/ui-kit/react/v4/group-banned-members.mdx
+++ b/ui-kit/react/v4/group-banned-members.mdx
@@ -77,7 +77,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onSelect
+#### 1. onSelect
The `onSelect` action is activated when you select the done icon while in selection mode. This returns a list of all the banned members that you have selected.
@@ -159,7 +159,7 @@ export default BannedMembersDemo;
-##### 2. onItemClick
+#### 2. onItemClick
The `OnItemClick` event is activated when you click on the Banned Members List item. This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
@@ -242,7 +242,7 @@ export default BannedMembersDemo;
-##### 3. OnBack
+#### 3. OnBack
`OnBack` is triggered when you click on the back button of the Banned Members component. You can override this action using the following code snippet.
@@ -317,7 +317,7 @@ export default BannedMembersDemo;
-##### 4. onClose
+#### 4. onClose
`onClose` is triggered when you click on the close button of the Banned Members component. You can override this action using the following code snippet.
@@ -392,7 +392,7 @@ export default BannedMembersDemo;
-##### 5. onError
+#### 5. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Banned Members component.
@@ -473,7 +473,7 @@ export default BannedMembersDemo;
**Filters** allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.
-##### 1. BannedMembersRequestBuilder
+#### 1. BannedMembersRequestBuilder
The [BannedMembersRequestBuilder](/sdk/javascript/group-kick-ban-members) enables you to filter and customize the Banned Members list based on available parameters in BannedMembersRequestBuilder. This feature allows you to create more specific and targeted queries when fetching banned members. The following are the parameters available in [BannedMembersRequestBuilder](/sdk/javascript/group-kick-ban-members)
@@ -566,7 +566,7 @@ export default BannedMembersDemo;
-##### 2. SearchRequestBuilder
+#### 2. SearchRequestBuilder
The SearchRequestBuilder uses [BannedMembersRequestBuilder](/sdk/javascript/group-kick-ban-members) enables you to filter and customize the search list based on available parameters in BannedMembersRequestBuilder. This feature allows you to keep uniformity between the displayed Banned Members list and searched Banned Members.
@@ -669,7 +669,7 @@ To fit your app's design requirements, you can customize the appearance of the G
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. BannedMembers Style
+#### 1. BannedMembers Style
You can set the `BannedMembersStyle` to the Banned Members Component to customize the styling.
@@ -798,7 +798,7 @@ List of properties exposed by BannedMembersStyle
| **unbanIconTint** | Used to set unban icon tint | `unbanIconTint?: string;` |
| **padding** | Used to set padding | `padding?: string;` |
-##### 2. Avatar Style
+#### 2. Avatar Style
To apply customized styles to the `Avatar` component in the Banned Members Component, you can use the following code snippet. For further insights on `Avatar` Styles [refer](/ui-kit/react/v4/avatar#avatar-style)
@@ -889,7 +889,7 @@ export default BannedMembersDemo;
-##### 3. LisItem Style
+#### 3. LisItem Style
To apply customized styles to the `ListItemStyle` component in the `Banned Members` Component, you can use the following code snippet. For further insights on `ListItemStyle` Styles [refer](/ui-kit/react/v4/list-item)
@@ -980,7 +980,7 @@ export default BannedMembersDemo;
-##### 4. StatusIndicator Style
+#### 4. StatusIndicator Style
To apply customized styles to the Status Indicator component in the Banned Members Component, You can use the following code snippet. For further insights on Status Indicator Styles [refer](/ui-kit/react/v4/status-indicator)
diff --git a/ui-kit/react/v4/group-details.mdx b/ui-kit/react/v4/group-details.mdx
index b853c135f..a1bfe26d1 100644
--- a/ui-kit/react/v4/group-details.mdx
+++ b/ui-kit/react/v4/group-details.mdx
@@ -78,7 +78,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onClose
+#### 1. onClose
The `onClose` event is typically triggered when the close button is clicked and it carries a default action. However, with the following code snippet, you can effortlessly override this default operation.
@@ -155,7 +155,7 @@ export default GroupDetailsDemo;
-##### 2. onError
+#### 2. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Group Details component.
@@ -298,7 +298,7 @@ To fit your app's design requirements, you can customize the appearance of the D
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. Details Style
+#### 1. Details Style
You can set the `DetailsStyle` to the Details Component to customize the styling.
@@ -406,7 +406,7 @@ List of properties exposed by DetailsStyle
| **passwordGroupIconBackground** | Used to set password group icon background | `passwordGroupIconBackground?: string;` |
| **padding** | Used to set padding | `padding?:string;` |
-##### 2. LeaveDialog Style
+#### 2. LeaveDialog Style
You can set the `leaveDialogStyle` to the Details Component to customize the styling.
@@ -495,7 +495,7 @@ export default GroupDetailsDemo;
-##### 3. DeleteDialog Style
+#### 3. DeleteDialog Style
You can set the `deleteDialogStyle` to the Details Component to customize the styling.
@@ -580,7 +580,7 @@ export default GroupDetailsDemo;
-##### 4. Avatar Style
+#### 4. Avatar Style
To apply customized styles to the `Avatar` component in the Details Component, you can use the following code snippet. For further insights on `Avatar` Styles [refer](/ui-kit/react/v4/avatar#avatar-style)
@@ -663,7 +663,7 @@ export default GroupDetailsDemo;
-##### 5. LisItem Style
+#### 5. LisItem Style
To apply customized styles to the `ListItemStyle` component in the `Details` Component, you can use the following code snippet. For further insights on `ListItemStyle` Styles [refer](/ui-kit/react/v4/list-item)
@@ -740,7 +740,7 @@ export default GroupDetailsDemo;
-##### 6. StatusIndicator Style
+#### 6. StatusIndicator Style
To apply customized styles to the Status Indicator in the Details Component, You can use the following code snippet. For further insights on Status Indicator Styles [refer](/ui-kit/react/v4/status-indicator)
@@ -823,7 +823,7 @@ export default GroupDetailsDemo;
-##### 6. Backdrop Style
+#### 6. Backdrop Style
To apply customized styles to the `Backdrop` component in the `Details` Component, you can use the following code snippet, you can use the following code snippet. For further insights on `Backdrop` Styles [refer](/ui-kit/react/v4/backdrop)
diff --git a/ui-kit/react/v4/group-members.mdx b/ui-kit/react/v4/group-members.mdx
index d41c93caf..8781640dc 100644
--- a/ui-kit/react/v4/group-members.mdx
+++ b/ui-kit/react/v4/group-members.mdx
@@ -77,7 +77,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onSelect
+#### 1. onSelect
The `onSelect` action is activated when you select the done icon while in selection mode. This returns a list of all the group members that you have selected.
@@ -173,7 +173,7 @@ export default GroupMembersDemo;
-##### 2. onItemClick
+#### 2. onItemClick
The `onItemClick` event is activated when you click on the Group Members List item. This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
@@ -254,7 +254,7 @@ export default GroupMembersDemo;
-##### 3. onBack
+#### 3. onBack
`OnBack` is triggered when you click on the back button of the Group Members component. You can override this action using the following code snippet.
@@ -329,7 +329,7 @@ export default GroupMembersDemo;
-##### 4. onClose
+#### 4. onClose
`onClose` is triggered when you click on the close button of the Group Members component. You can override this action using the following code snippet.
@@ -404,7 +404,7 @@ export default GroupMembersDemo;
-##### 5. onEmpty
+#### 5. onEmpty
This action allows you to specify a callback function to be executed when a certain condition, typically the absence of data or content, is met within the component or element.
@@ -479,7 +479,7 @@ export default GroupMembersDemo;
-##### 6. onError
+#### 6. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Group Members component.
@@ -559,7 +559,7 @@ export default GroupMembersDemo;
**Filters** allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.
-##### 1. GroupMembersRequestBuilder
+#### 1. GroupMembersRequestBuilder
The [GroupMembersRequestBuilder](/sdk/javascript/retrieve-group-members) enables you to filter and customize the group members list based on available parameters in GroupMembersRequestBuilder. This feature allows you to create more specific and targeted queries when fetching groups. The following are the parameters available in [GroupMembersRequestBuilder](/sdk/javascript/retrieve-group-members)
@@ -650,7 +650,7 @@ export default GroupMembersDemo;
-##### 2. SearchRequestBuilder
+#### 2. SearchRequestBuilder
The SearchRequestBuilder uses [GroupMembersRequestBuilder](/sdk/javascript/retrieve-group-members) enables you to filter and customize the search list based on available parameters in GroupMembersRequestBuilder. This feature allows you to keep uniformity between the displayed Group Members List and searched Group Members List.
@@ -796,7 +796,7 @@ To fit your app's design requirements, you can customize the appearance of the G
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. GroupMembers Style
+#### 1. GroupMembers Style
You can set the `GroupMembersStyle` to the Group Members Component to customize the styling.
@@ -924,7 +924,7 @@ List of properties exposed by GroupMembersStyle:
| **passwordGroupIconBackground** | Used to set password group icon bg | `passwordGroupIconBackground?: string;` |
| **padding** | Used to set padding | `padding?: string;` |
-##### 2. GroupScope Style
+#### 2. GroupScope Style
You can set the `GroupScope` to the Group Members Component to customize the styling.
@@ -1047,7 +1047,7 @@ List of properties exposed by ChangeScopeStyle:
| **buttonBackground** | Used to set button background color | `buttonBackground?: string;` |
| **closeIconTint** | Used to set close icon tint | `closeIconTint?: string;` |
-##### 3. Avatar Style
+#### 3. Avatar Style
To apply customized styles to the `Avatar` component in the Group Members Component, you can use the following code snippet. For further insights on `Avatar` Styles [refer](/ui-kit/react/v4/avatar#avatar-style)
@@ -1136,7 +1136,7 @@ export default GroupMembersDemo;
-##### 4. ListItem Style
+#### 4. ListItem Style
To apply customized styles to the `ListItemStyle` component in the `Group Members` Component, you can use the following code snippet. For further insights on `ListItemStyle` Styles [refer](/ui-kit/react/v4/list-item)
@@ -1225,7 +1225,7 @@ export default GroupMembersDemo;
-##### 5. StatusIndicator Style
+#### 5. StatusIndicator Style
To apply customized styles to the Status Indicator component in the Group Members Component, You can use the following code snippet. For further insights on Status Indicator Styles [refer](/ui-kit/react/v4/status-indicator)
diff --git a/ui-kit/react/v4/group-transfer-ownership.mdx b/ui-kit/react/v4/group-transfer-ownership.mdx
index 6d37041ff..8a4ac6e31 100644
--- a/ui-kit/react/v4/group-transfer-ownership.mdx
+++ b/ui-kit/react/v4/group-transfer-ownership.mdx
@@ -95,7 +95,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onTransferOwnership
+#### 1. onTransferOwnership
The `onTransferOwnership` action is activated when you select a group member and click on the transfer ownership submit button. you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
@@ -182,7 +182,7 @@ export default TransferOwnerShipDemo;
-##### 2. onClose
+#### 2. onClose
`onClose` is triggered when you click on the close button of the Transfer Ownership component. You can override this action using the following code snippet.
@@ -261,7 +261,7 @@ export default TransferOwnerShipDemo;
-##### 3. onError
+#### 3. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Transfer Ownership component.
@@ -346,7 +346,7 @@ export default TransferOwnerShipDemo;
**Filters** allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.
-##### 1. GroupMembersRequestBuilder
+#### 1. GroupMembersRequestBuilder
The [GroupMembersRequestBuilder](/sdk/javascript/retrieve-group-members) enables you to filter and customize the group members list based on available parameters in GroupMembersRequestBuilder. This feature allows you to create more specific and targeted queries when fetching groups. The following are the parameters available in [GroupMembersRequestBuilder](/sdk/javascript/retrieve-group-members)
@@ -437,7 +437,7 @@ export default TransferOwnerShipDemo;
-##### 2. SearchRequestBuilder
+#### 2. SearchRequestBuilder
The SearchRequestBuilder uses [GroupMembersRequestBuilder](/sdk/javascript/retrieve-group-members) enables you to filter and customize the search list based on available parameters in GroupMembersRequestBuilder. This feature allows you to keep uniformity between the displayed Group Members List and searched Group Members List.
@@ -564,7 +564,7 @@ To fit your app's design requirements, you can customize the appearance of the T
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. TransferOwnership Style
+#### 1. TransferOwnership Style
You can set the `TransferOwnershipStyle` to the Transfer Ownership Component to customize the styling.
@@ -679,7 +679,7 @@ List of properties exposed by TransferOwnershipStyle:
| **cancelButtonTextFont** | Used to set cancel button text font | `cancelButtonTextFont?: string;` |
| **cancelButtonTextColor** | Used to set cancel button text color | `cancelButtonTextColor?: string;` |
-##### 2. Avatar Style
+#### 2. Avatar Style
To apply customized styles to the `Avatar` component in the Transfer Ownership Component, you can use the following code snippet. For further insights on `Avatar` Styles [refer](/ui-kit/react/v4/avatar#avatar-style)
@@ -774,7 +774,7 @@ export default TransferOwnerShipDemo;
-##### 3. GroupMembers Style
+#### 3. GroupMembers Style
You can set the `GroupMembersStyle` to the Transfer Ownership Component to customize the styling, you can use the following code snippet. For further insights on `GroupMembers` Styles [refer](/ui-kit/react/v4/group-members#1-groupmembers-style)
@@ -869,7 +869,7 @@ export default TransferOwnerShipDemo;
-##### 4. ListItem Style
+#### 4. ListItem Style
To apply customized styles to the `ListItemStyle` component in the `Transfer Ownership` Component, you can use the following code snippet. For further insights on `ListItemStyle` Styles [refer](/ui-kit/react/v4/list-item)
@@ -958,7 +958,7 @@ export default TransferOwnerShipDemo;
-##### 5. StatusIndicator Style
+#### 5. StatusIndicator Style
To apply customized styles to the Status Indicator component in the Transfer Ownership Component, You can use the following code snippet. For further insights on Status Indicator Styles [refer](/ui-kit/react/v4/status-indicator)
diff --git a/ui-kit/react/v4/groups-with-messages.mdx b/ui-kit/react/v4/groups-with-messages.mdx
index 223430d21..d14fbf93f 100644
--- a/ui-kit/react/v4/groups-with-messages.mdx
+++ b/ui-kit/react/v4/groups-with-messages.mdx
@@ -59,7 +59,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onError
+#### 1. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the GroupsWithMessages component.
@@ -296,7 +296,7 @@ To fit your app's design requirements, you have the ability to customize the app
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. GroupsWithMessages Style
+#### 1. GroupsWithMessages Style
You can set the `groupsWithMessagesStyle` to the GroupsWithMessages Component to customize the styling.
@@ -478,7 +478,7 @@ These are a set of **small functional customizations** that allow you to **fine-
you can utilize the `group` method with a [Group](/sdk/javascript/create-group) object as input to the GroupsWithMessages component. This will automatically direct you to the [Messages](/ui-kit/react/v4/messages) component for the specified `Group`.
-##### 1. Group
+#### 1. Group
@@ -543,7 +543,7 @@ Below is a list of customizations along with corresponding code snippets:
***
-##### Components
+#### Components
Nearly all functionality customizations available for a Component are also available for the composite component. Using [Configuration](#configurations), you can modify the properties of its components to suit your needs.
diff --git a/ui-kit/react/v4/groups.mdx b/ui-kit/react/v4/groups.mdx
index 03eafb83a..5910635c3 100644
--- a/ui-kit/react/v4/groups.mdx
+++ b/ui-kit/react/v4/groups.mdx
@@ -66,7 +66,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onSelect
+#### 1. onSelect
The `onSelect` action is activated when you select the done icon while in selection mode. This returns the `group` object along with the boolean flag `selected` to indicate if the group was selected or unselected.
@@ -126,7 +126,7 @@ export default GroupsDemo;
-##### 2. onItemClick
+#### 2. onItemClick
The `onItemClick` event is activated when you click on the Group List item. This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
@@ -172,7 +172,7 @@ export default GroupsDemo;
-##### 3. onError
+#### 3. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Groups component.
@@ -222,7 +222,7 @@ export default GroupsDemo;
**Filters** allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.
-##### 1. GroupsRequestBuilder
+#### 1. GroupsRequestBuilder
The [GroupsRequestBuilder](/sdk/javascript/retrieve-groups) enables you to filter and customize the group list based on available parameters in [GroupsRequestBuilder](/sdk/javascript/retrieve-groups). This feature allows you to create more specific and targeted queries when fetching groups. The following are the parameters available in [GroupsRequestBuilder](/sdk/javascript/retrieve-groups)
@@ -287,7 +287,7 @@ export default GroupsDemo;
-##### 2. SearchRequestBuilder
+#### 2. SearchRequestBuilder
The SearchRequestBuilder uses [GroupsRequestBuilder](/sdk/javascript/retrieve-groups) enables you to filter and customize the search list based on available parameters in GroupsRequestBuilder. This feature allows you to keep uniformity between the displayed Groups List and searched Group List.
@@ -362,7 +362,7 @@ To fit your app's design requirements, you can customize the appearance of the G
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. Groups Style
+#### 1. Groups Style
You can set the `GroupsStyle` to the Groups Component to customize the styling.
@@ -448,7 +448,7 @@ List of properties exposed by GroupsStyle
| **subTitleTextFont** | Used to customise the font of the subtitle text. | `subTitleTextFont?: string;` |
| **subTitleTextColor** | Used to customise the color of the subtitle text. | `subTitleTextColor?: string;` |
-##### 2. Avatar Style
+#### 2. Avatar Style
To apply customized styles to the `Avatar` component in the Groups Component, you can use the following code snippet. For further insights on `Avatar` Styles [refer](/ui-kit/react/v4/avatar#avatar-style)
@@ -503,7 +503,7 @@ export default GroupsDemo;
-##### 3. StatusIndicator Style
+#### 3. StatusIndicator Style
To apply customized styles to the Status Indicator component in the Groups Component, You can use the following code snippet. For further insights on Status Indicator Styles [refer](/ui-kit/react/v4/status-indicator)
@@ -552,7 +552,7 @@ export default GroupsDemo;
-##### 4. ListItem Style
+#### 4. ListItem Style
To apply customized styles to the `ListItemStyle` component in the `Groups` Component, you can use the following code snippet. For further insights on `ListItemStyle` Styles [refer](/ui-kit/react/v4/list-item)
diff --git a/ui-kit/react/v4/incoming-call.mdx b/ui-kit/react/v4/incoming-call.mdx
index df61c07a7..94d2ded33 100644
--- a/ui-kit/react/v4/incoming-call.mdx
+++ b/ui-kit/react/v4/incoming-call.mdx
@@ -64,7 +64,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onAccept
+#### 1. onAccept
`onAccept` is triggered when you click the accept button of the `Incoming Call` component. You can override this action using the following code snippet.
@@ -111,7 +111,7 @@ export default IncomingCallsDemo;
-##### 2. onDecline
+#### 2. onDecline
`onDecline` is triggered when you click the Decline button of the `Incoming Call` component. You can override this action using the following code snippet.
@@ -158,7 +158,7 @@ export default IncomingCallsDemo;
-##### 3. onError
+#### 3. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Incoming Call component.
@@ -277,7 +277,7 @@ To fit your app's design requirements, you can customize the appearance of the I
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. IncomingCall Style
+#### 1. IncomingCall Style
To customize the appearance, you can assign a `IncomingCallStyle` object to the `Incoming Call` component.
@@ -368,7 +368,7 @@ The following properties are exposed by IncomingCallStyle:
| **declineButtonBorderRadius** | Used to set decline button border radius | `declineButtonBorderRadius?: string;` |
| **declineButtonBorder** | Used to set decline button border | `declineButtonBorder?: string;` |
-##### 2. Avatar Style
+#### 2. Avatar Style
If you want to apply customized styles to the `Avatar` component within the `Incoming Call` Component, you can use the following code snippet. For more information you can refer [Avatar Styles](/ui-kit/react/v4/avatar#avatar-style).
@@ -431,7 +431,7 @@ export default IncomingCallsDemo;
-##### 3. ListItem Style
+#### 3. ListItem Style
If you want to apply customized styles to the `ListItemStyle` component within the `Incoming Call` Component, you can use the following code snippet. For more information, you can refer [ListItem Styles](/ui-kit/react/v4/list-item#listitemstyle).
diff --git a/ui-kit/react/v4/join-protected-group.mdx b/ui-kit/react/v4/join-protected-group.mdx
index 7d065d71e..7ff0effb7 100644
--- a/ui-kit/react/v4/join-protected-group.mdx
+++ b/ui-kit/react/v4/join-protected-group.mdx
@@ -83,7 +83,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. joinClick
+#### 1. joinClick
The `joinClick` action is activated when you click the join Group button. This returns the join groups.
@@ -163,7 +163,7 @@ export default JoinProtectedGroupDemo;
-##### 2. errorCallback
+#### 2. errorCallback
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Groups component.
@@ -295,7 +295,7 @@ To fit your app's design requirements, you can customize the appearance of the J
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. JoinGroup Style
+#### 1. JoinGroup Style
You can set the `JoinGroupStyle` to the `Join Group` Component to customize the styling.
diff --git a/ui-kit/react/v4/message-composer.mdx b/ui-kit/react/v4/message-composer.mdx
index 8c9c13d5a..a49d1ccaf 100644
--- a/ui-kit/react/v4/message-composer.mdx
+++ b/ui-kit/react/v4/message-composer.mdx
@@ -77,7 +77,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. OnSendButtonClick
+#### 1. OnSendButtonClick
The `OnSendButtonClick` event gets activated when the send message button is clicked. It has a predefined function of sending messages entered in the composer `EditText`. However, you can overide this action with the following code snippet.
@@ -113,7 +113,7 @@ import { CometChatMessageComposer } from "@cometchat/chat-uikit-react";
-##### 2. onError
+#### 2. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the MessageList component.
@@ -224,7 +224,7 @@ To fit your app's design requirements, you can customize the appearance of the M
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. MessageComposer Style
+#### 1. MessageComposer Style
To modify the styling, you can apply the MessageComposerStyle to the MessageComposer Component using the `messageComposerStyle` property.
@@ -299,7 +299,7 @@ The following properties are exposed by MessageComposerStyle:
| **closePreviewTint** | used to set close preview color | `closePreviewTint?: string;` |
| **maxInputHeight** | used to set max input height | `maxInputHeight?: string;` |
-##### 2. MediaRecorder Style
+#### 2. MediaRecorder Style
To customize the styles of the MediaRecorder component within the MessageComposer Component, use the `mediaRecorderStyle` property. For more details, please refer to [MediaRecorder](/ui-kit/react/v4/media-recorder) styles.
@@ -339,7 +339,7 @@ import { CometChatMessageComposer, MediaRecorderStyle } from "@cometchat/chat-ui
-##### 3. MentionsWarning Style
+#### 3. MentionsWarning Style
To customize the styles of the MentionsWarning within the MessageComposer Component, use the `mentionsWarningStyle` property.
diff --git a/ui-kit/react/v4/message-header.mdx b/ui-kit/react/v4/message-header.mdx
index 94c6eb2b4..0a9cec485 100644
--- a/ui-kit/react/v4/message-header.mdx
+++ b/ui-kit/react/v4/message-header.mdx
@@ -75,7 +75,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. OnBack
+#### 1. OnBack
`OnBack` is triggered when you click on the back button of the Message Header component. You can override this action using the following code snippet.
@@ -161,7 +161,7 @@ export default MessageHeaderDemo;
***
-##### 2. OnError
+#### 2. OnError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Message Header component.
@@ -269,7 +269,7 @@ To fit your app's design requirements, you can customize the appearance of the M
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. MessageHeader Style
+#### 1. MessageHeader Style
To customize the appearance, you can assign a `MessageHeaderStyle` object to the `MessageHeader` component.
@@ -388,7 +388,7 @@ The properties exposed by `MessageHeaderStyle` are as follows:
| **privateGroupIconBackground** | Used to set private groups icon backgound | `privateGroupIconBackground?: string` |
| **passwordGroupIconBackground** | Used to set protected groups icon backgound | `passwordGroupIconBackground?: string` |
-##### 2. Avatar Style
+#### 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/react/v4/avatar#avatar-style).
@@ -474,7 +474,7 @@ export function MessageHeaderDemo() {
-##### 3. ListItem Style
+#### 3. ListItem Style
If you want to apply customized styles to the `ListItemStyle` component within the `MessageHeader` Component, you can use the following code snippet. For more information, you can refer [ListItem Styles](/ui-kit/react/v4/list-item#listitemstyle).
@@ -557,7 +557,7 @@ export function MessageHeaderDemo() {
-##### 4. StatusIndicator Style
+#### 4. StatusIndicator Style
If you want to apply customized styles to the `Status Indicator` component within the `MessageHeader` Component, you can use the following code snippet. For more information you can refer [StatusIndicator Styles](/ui-kit/react/v4/status-indicator).
diff --git a/ui-kit/react/v4/message-information.mdx b/ui-kit/react/v4/message-information.mdx
index 652cadc25..ef4e3cb1c 100644
--- a/ui-kit/react/v4/message-information.mdx
+++ b/ui-kit/react/v4/message-information.mdx
@@ -92,7 +92,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onClose
+#### 1. onClose
The `onClose` event is typically triggered when the close button is clicked and it carries a default action. However, with the following code snippet, you can effortlessly override this default operation.
@@ -149,7 +149,7 @@ export default MessageInformationDemo;
-##### 2. onError
+#### 2. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the MessageInformation component.
@@ -228,7 +228,7 @@ To fit your app's design requirements, you can customize the appearance of the M
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. MessageInformationStyle
+#### 1. MessageInformationStyle
To modify the styling, you can apply the MessageInformationStyle to the MessageInformation Component using the `messageInformationStyle` property.
@@ -317,7 +317,7 @@ The following properties are exposed by MessageInformationStyle:
***
-##### 2. ListItemStyle
+#### 2. ListItemStyle
To apply customized styles to the `ListItemStyle` component in the MessageInformation Component, you can use the following code snippet. For further insights on `ListItemStyle` Styles [refer](/ui-kit/react/v4/list-item)
diff --git a/ui-kit/react/v4/message-list.mdx b/ui-kit/react/v4/message-list.mdx
index b2726833d..94534796f 100644
--- a/ui-kit/react/v4/message-list.mdx
+++ b/ui-kit/react/v4/message-list.mdx
@@ -80,7 +80,7 @@ To fetch messages for a specific entity, you need to supplement it with `User` o
[Actions](/ui-kit/react/v4/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. onThreadRepliesClick
+#### 1. onThreadRepliesClick
`onThreadRepliesClick` is triggered when you click on the threaded message bubble. The `onThreadRepliesClick` action doesn't have a predefined behavior. You can override this action using the following code snippet.
@@ -155,7 +155,7 @@ export function MessageListDemo() {
-##### 2. onError
+#### 2. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the MessageList component.
@@ -442,7 +442,7 @@ To fit your app's design requirements, you can customize the appearance of the M
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. MessageList Style
+#### 1. MessageList Style
You can set the MessageListStyle to the MessageList Component Component to customize the styling.
@@ -557,7 +557,7 @@ List of properties exposed by MessageListStyle
| **threadReplyUnreadTextFont** | used to set thread reply unread text font | `threadReplyUnreadTextFont?: string;` |
| **threadReplyUnreadBackground** | used to set thread reply unread background | `threadReplyUnreadBackground?: string;` |
-##### 2. Avatar Style
+#### 2. Avatar Style
To apply customized styles to the `Avatar` component in the `Message List` Component, you can use the following code snippet. For further insights on `Avatar` Styles [refer](/ui-kit/react/v4/avatar#avatar-style)
@@ -642,7 +642,7 @@ export function MessageListDemo() {
-##### 3. DateSeparator Style
+#### 3. DateSeparator Style
To apply customized styles to the `DateSeparator` in the `Message list` Component, you can use the following code snippet.
@@ -721,7 +721,7 @@ export function MessageListDemo() {
-##### 4. EmojiKeyboard Style
+#### 4. EmojiKeyboard Style
To apply customized styles to the `EmojiKeyBoard` in the `Message list` Component, you can use the following code snippet.
diff --git a/ui-kit/react/v4/messages.mdx b/ui-kit/react/v4/messages.mdx
index c7a635a0a..18dc49dc1 100644
--- a/ui-kit/react/v4/messages.mdx
+++ b/ui-kit/react/v4/messages.mdx
@@ -318,7 +318,7 @@ To fit your app's design requirements, you can customize the appearance of the M
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. Messages Style
+#### 1. Messages Style
You can customize the appearance of the Messages Component by applying the MessagesStyle to it using the following code snippet.
@@ -411,7 +411,7 @@ List of properties exposed by MessagesStyle
| **height** | Sets the height of the component | `height:"string"` |
| **width** | Sets the width of the component | `width:"string"` |
-##### 2. Component's Styles
+#### 2. Component's Styles
Being a [Composite component](/ui-kit/react/v4/components-overview#composite-components), the Messages Component allows you to customize the styles of its components using their respective Configuration objects.
diff --git a/ui-kit/react/v4/ongoing-call.mdx b/ui-kit/react/v4/ongoing-call.mdx
index 459679ed3..bbad6388f 100644
--- a/ui-kit/react/v4/ongoing-call.mdx
+++ b/ui-kit/react/v4/ongoing-call.mdx
@@ -60,7 +60,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onError
+#### 1. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Ongoing component.
@@ -216,7 +216,7 @@ To fit your app's design requirements, you can customize the appearance of the O
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. Ongoing Call Style
+#### 1. Ongoing Call Style
To customize the appearance, you can assign a `CallscreenStyle` object to the `Ongoing Call` component.
diff --git a/ui-kit/react/v4/outgoing-call.mdx b/ui-kit/react/v4/outgoing-call.mdx
index c147f73ae..a63880adc 100644
--- a/ui-kit/react/v4/outgoing-call.mdx
+++ b/ui-kit/react/v4/outgoing-call.mdx
@@ -83,7 +83,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onCloseClicked
+#### 1. onCloseClicked
The `onCloseClicked` event gets activated when the close button is clicked. It does not have a default behavior. However, you can override its behavior using the following code snippet.
@@ -182,7 +182,7 @@ export default OutgoingCallDemo;
-##### 2. onError
+#### 2. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Outgoing Call component.
@@ -299,7 +299,7 @@ To fit your app's design requirements, you can customize the appearance of the O
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. OutgoingCall Style
+#### 1. OutgoingCall Style
To customize the appearance, you can assign a `OutgoingCallStyle` object to the `Outgoing Call` component.
@@ -445,7 +445,7 @@ The following properties are exposed by OutgoingCallStyle:
***
-##### 2. Avatar Style
+#### 2. Avatar Style
If you want to apply customized styles to the `Avatar` component within the `Outgoing Call` Component, you can use the following code snippet. For more information you can refer [Avatar Styles](/ui-kit/react/v4/avatar#avatar-style).
diff --git a/ui-kit/react/v4/overview.mdx b/ui-kit/react/v4/overview.mdx
index 38007861b..e3ae577c1 100644
--- a/ui-kit/react/v4/overview.mdx
+++ b/ui-kit/react/v4/overview.mdx
@@ -11,7 +11,7 @@ With CometChat's **UI Kit** for React, you can effortlessly build a chat app equ
-##### **Before Getting Started**
+#### **Before Getting Started**
Before you begin, it's essential to grasp the fundamental concepts and features offered by CometChat's APIs, SDK, and UI Kit. You can find detailed information in [Key Concepts](/fundamentals/key-concepts) documentation.
diff --git a/ui-kit/react/v4/reaction-info.mdx b/ui-kit/react/v4/reaction-info.mdx
index 53ca3989e..5cb140eea 100644
--- a/ui-kit/react/v4/reaction-info.mdx
+++ b/ui-kit/react/v4/reaction-info.mdx
@@ -163,7 +163,7 @@ To fit your app's design requirements, you can customize the appearance of the R
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. reactionInfoStyle
+#### 1. reactionInfoStyle
To customize the appearance, you can assign a `reactionInfoStyle` object to the `Reactions Info` component.
diff --git a/ui-kit/react/v4/reaction-list.mdx b/ui-kit/react/v4/reaction-list.mdx
index 7045042fd..cc746a790 100644
--- a/ui-kit/react/v4/reaction-list.mdx
+++ b/ui-kit/react/v4/reaction-list.mdx
@@ -92,7 +92,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. reactionItemClicked
+#### 1. reactionItemClicked
The `reactionItemClicked` event gets activated when a user clicks on a reaction item within the CometChat Reaction List component. This event provides a way to capture and respond to user interactions with specific reactions.
@@ -218,7 +218,7 @@ To fit your app's design requirements, you can customize the appearance of the R
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. reactionListStyle
+#### 1. reactionListStyle
To customize the appearance, you can assign a `reactionListStyle` object to the `Reactions List` component.
@@ -305,7 +305,7 @@ List of properties exposed by ReactionsListStyle
***
-##### 2. Avatar Style
+#### 2. Avatar Style
If you want to apply customized styles to the `Avatar` component within the `Reaction List` Component, you can use the following code snippet. For more information you can refer [Avatar Styles](/ui-kit/react/v4/avatar#avatar-style).
@@ -362,7 +362,7 @@ export default ReactionListDemo;
-##### 3. ListItem Style
+#### 3. ListItem Style
If you want to apply customized styles to the `ListItemStyle` component within the `Reaction List` Component, you can use the following code snippet. For more information, you can refer [ListItem Styles](/ui-kit/react/v4/list-item#listitemstyle).
diff --git a/ui-kit/react/v4/reaction.mdx b/ui-kit/react/v4/reaction.mdx
index cfd9f09a4..1c0dc33d7 100644
--- a/ui-kit/react/v4/reaction.mdx
+++ b/ui-kit/react/v4/reaction.mdx
@@ -88,7 +88,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. reactionClick
+#### 1. reactionClick
`reactionClick` is triggered when you click on each Reaction in the footer view of message bubble. You can override this action using the following code snippet.
@@ -217,7 +217,7 @@ To fit your app's design requirements, you can customize the appearance of the R
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. reactionsStyle
+#### 1. reactionsStyle
To customize the appearance, you can assign a `reactionsStyle` object to the `Reactions` component.
diff --git a/ui-kit/react/v4/threaded-messages.mdx b/ui-kit/react/v4/threaded-messages.mdx
index a159d6ffe..8e7496d49 100644
--- a/ui-kit/react/v4/threaded-messages.mdx
+++ b/ui-kit/react/v4/threaded-messages.mdx
@@ -217,7 +217,7 @@ To fit your app's design requirements, you can customize the appearance of the c
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. threadedMessagesStyle
+#### 1. threadedMessagesStyle
To modify the styling, you can apply the ThreadedMessageStyle to the ThreadedMessage Component using the `threadedMessagesStyle` property.
diff --git a/ui-kit/react/v4/user-member-wrapper.mdx b/ui-kit/react/v4/user-member-wrapper.mdx
index 6081f34a4..e31603ee0 100644
--- a/ui-kit/react/v4/user-member-wrapper.mdx
+++ b/ui-kit/react/v4/user-member-wrapper.mdx
@@ -58,7 +58,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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
+#### 1. onItemClick
`onItemClick` is triggered when you click on a ListItem of UserMemberWrapper component. You can override this action using the following code snippet.
@@ -85,7 +85,7 @@ export default UserMemberWrapperDemo;
***
-##### 2. onError
+#### 2. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the UserMemberWrapper component.
@@ -112,7 +112,7 @@ export default UserMemberWrapperDemo;
***
-##### 3. onEmpty
+#### 3. onEmpty
This action allows you to specify a callback function to be executed when a certain condition, typically the absence of data or content, is met within the component or element.
@@ -218,7 +218,7 @@ To fit your app's design requirements, you can customize the appearance of the `
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. Avatar Style
+#### 1. Avatar Style
If you want to apply customized styles to the `Avatar` component within the `UserMemberWrapper` Component, you can use the following code snippet. For more information you can refer [Avatar Styles](/ui-kit/react/v4/avatar#avatar-style).
@@ -257,7 +257,7 @@ export default UserMemberWrapperDemo;
***
-##### 2. StatusIndicator Style
+#### 2. StatusIndicator Style
To apply customized styles to the Status Indicator component in the `UserMemberWrapper` Component, you can use the following code snippet. For further insights on Status Indicator Styles [refer](/ui-kit/react/v4/status-indicator)
diff --git a/ui-kit/react/v4/users-details.mdx b/ui-kit/react/v4/users-details.mdx
index 6b7643c54..65b64a2c8 100644
--- a/ui-kit/react/v4/users-details.mdx
+++ b/ui-kit/react/v4/users-details.mdx
@@ -75,7 +75,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onClose
+#### 1. onClose
The `onClose` event is typically triggered when the close button is clicked and it carries a default action. However, with the following code snippet, you can effortlessly override this default operation.
@@ -135,7 +135,7 @@ export default UserDetailsDemo;
-##### 2. onError
+#### 2. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the User component.
@@ -255,7 +255,7 @@ To fit your app's design requirements, you can customize the appearance of the d
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
-##### 1. Details Style
+#### 1. Details Style
You can set the `DetailsStyle` to the User Details Component to customize the styling.
@@ -338,7 +338,7 @@ List of properties exposed by DetailsStyle
| **subtitleTextColor** | Sets the color of the subtitle text | `subtitleTextColor?: string;` |
| **closeButtonIconTint** | Sets the color of the close icon of the component | `closeButtonIconTint?: string;` |
-##### 2. Avatar Style
+#### 2. Avatar Style
To apply customized styles to the `Avatar` component in the Details Component, you can use the following code snippet. For further insights on `Avatar` Styles [refer](/ui-kit/react/v4/avatar#avatar-style)
@@ -407,7 +407,7 @@ export default UserDetailsDemo;
-##### 3. StatusIndicator Style
+#### 3. StatusIndicator Style
To apply customized styles to the Status Indicator component in the Details Component, You can use the following code snippet. For further insights on Status Indicator Styles [refer](/ui-kit/react/v4/status-indicator)
@@ -480,7 +480,7 @@ export default UserDetailsDemo;
-##### 4. ListItem Style
+#### 4. ListItem Style
To apply customized styles to the `ListItemStyle` component in the `Details` Component, you can use the following code snippet. For further insights on `ListItemStyle` Styles [refer](/ui-kit/react/v4/list-item)
@@ -547,7 +547,7 @@ export default UserDetailsDemo;
-##### 5. Backdrop Style
+#### 5. Backdrop Style
To apply customized styles to the `Backdrop` component in the `Details` Component, you can use the following code snippet, you can use the following code snippet. For further insights on `Backdrop` Styles [refer](/ui-kit/react/v4/backdrop)
diff --git a/ui-kit/react/v4/users-with-messages.mdx b/ui-kit/react/v4/users-with-messages.mdx
index dbd164c11..1c403337f 100644
--- a/ui-kit/react/v4/users-with-messages.mdx
+++ b/ui-kit/react/v4/users-with-messages.mdx
@@ -59,7 +59,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onError
+#### 1. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the UserWithMessages component.
@@ -300,7 +300,7 @@ To fit your app's design requirements, you have the ability to customize the app
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. UsersWithMessages Style
+#### 1. UsersWithMessages Style
You can set the `UsersWithMessagesStyle` to the UsersWithMessages Component to customize the styling.
@@ -480,7 +480,7 @@ These are a set of **small functional customizations** that allow you to **fine-
you can utilize the `user` method with a [User](/sdk/javascript/user-management) object as input to the UsersWithMessages component. This will automatically direct you to the [Messages](/ui-kit/react/v4/messages) component for the specified `User`.
-##### user
+#### user
@@ -543,7 +543,7 @@ Below is a list of customizations along with corresponding code snippets:
***
-##### Components
+#### Components
Nearly all functionality customizations available for a Component are also available for the composite component. Using [Configuration](#configurations), you can modify the properties of its components to suit your needs.
diff --git a/ui-kit/react/v4/users.mdx b/ui-kit/react/v4/users.mdx
index 144f360c2..b26a26c2e 100644
--- a/ui-kit/react/v4/users.mdx
+++ b/ui-kit/react/v4/users.mdx
@@ -63,7 +63,7 @@ export default function App() {
[Actions](/ui-kit/react/v4/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. onSelect
+#### 1. onSelect
The `onSelect` action is activated when you select the done icon while in selection mode. This returns a list of all the users that you have selected.
@@ -122,7 +122,7 @@ export default UsersDemo;
-##### 2. onItemClick
+#### 2. onItemClick
The `OnItemClick` event is activated when you click on the UserList item. This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
@@ -166,7 +166,7 @@ export default UsersDemo;
-##### 3. onEmpty
+#### 3. onEmpty
This action allows you to specify a callback function to be executed when a certain condition, typically the absence of data or content, is met within the component or element.
@@ -210,7 +210,7 @@ export default UsersDemo;
-##### 4. onError
+#### 4. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the User component.
@@ -258,7 +258,7 @@ export default UsersDemo;
**Filters** allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.
-##### 1. UserRequestBuilder
+#### 1. UserRequestBuilder
The [UserRequestBuilder](/sdk/javascript/retrieve-users) enables you to filter and customize the user list based on available parameters in UserRequestBuilder. This feature allows you to create more specific and targeted queries when fetching users. The following are the parameters available in [UserRequestBuilder](/sdk/javascript/retrieve-users)
@@ -325,7 +325,7 @@ export default UsersDemo;
-##### 2. SearchRequestBuilder
+#### 2. SearchRequestBuilder
The SearchRequestBuilder uses [UserRequestBuilder](/sdk/javascript/retrieve-users) enables you to filter and customize the search list based on available parameters in UserRequestBuilder. This feature allows you to keep uniformity between the displayed UserList and searched UserList.
@@ -398,7 +398,7 @@ To fit your app's design requirements, you can customize the appearance of the U
Using **Style** you can **customize** the look and feel of the component in your app, These parameters typically control elements such as the **color**, **size**, **shape**, and **fonts** used within the component.
-##### 1. Users Style
+#### 1. Users Style
You can set the `UsersStyle` to the Users Component to customize the styling.
@@ -482,7 +482,7 @@ List of properties exposed by UsersStyle
| **sectionHeaderTextFont** | Used to customise the font of the section header text. | `sectionHeaderTextFont?: string;` |
| **sectionHeaderTextColor** | Used to customise the color of the section header text. | `sectionHeaderTextColor?: string;` |
-##### 2. Avatar Style
+#### 2. Avatar Style
To apply customized styles to the `Avatar` component in the Users Component, you can use the following code snippet. For further insights on `Avatar` Styles [refer](/ui-kit/react/v4/avatar#avatar-style)
@@ -536,7 +536,7 @@ export default UsersDemo;
-##### 3. StatusIndicator Style
+#### 3. StatusIndicator Style
To apply customized styles to the Status Indicator component in the Users Component, You can use the following code snippet. For further insights on Status Indicator Styles [refer](/ui-kit/react/v4/status-indicator)
@@ -583,7 +583,7 @@ export default UsersDemo;
-##### 4. LisItem Style
+#### 4. LisItem Style
To apply customized styles to the `ListItemStyle` component in the `Users` Component, you can use the following code snippet. For further insights on `ListItemStyle` Styles [refer](/ui-kit/react/v4/list-item)
diff --git a/ui-kit/react/v5/call-buttons.mdx b/ui-kit/react/v5/call-buttons.mdx
index 66115e386..2a44b105f 100644
--- a/ui-kit/react/v5/call-buttons.mdx
+++ b/ui-kit/react/v5/call-buttons.mdx
@@ -59,7 +59,7 @@ export default function App() {
[Actions](/ui-kit/react/v5/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. onError
+#### 1. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Call Button component.
diff --git a/ui-kit/react/v5/call-logs.mdx b/ui-kit/react/v5/call-logs.mdx
index 070119c67..94da06d47 100644
--- a/ui-kit/react/v5/call-logs.mdx
+++ b/ui-kit/react/v5/call-logs.mdx
@@ -62,7 +62,7 @@ export default function App() {
[Actions](/ui-kit/react/v5/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
+#### 1. onItemClick
`onItemClick` is a callback function which triggers when a call log list item is clicked. It does not have a default behavior. However, you can override its behavior using the following code snippet.
@@ -103,7 +103,7 @@ export default CallLogDemo;
-##### 2. onCallButtonClicked
+#### 2. onCallButtonClicked
`onCallButtonClicked` is a callback function which triggers when the call button in the trailing view is clicked.
@@ -144,7 +144,7 @@ export default CallLogDemo;
-##### 3. onError
+#### 3. onError
This is a callback function which is triggered when the component encounters an error.
@@ -192,7 +192,7 @@ export default CallLogDemo;
**Filters** allow you to customize the data displayed in a list within a `Component`. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using `RequestBuilders` of Chat SDK.
-##### 1. CallLogRequestBuilder
+#### 1. CallLogRequestBuilder
The [CallLogRequestBuilder](/sdk/javascript/call-logs) enables you to filter and customize the Call Log based on available parameters in [CallLogRequestBuilder](/sdk/javascript/call-logs). This feature allows you to create more specific and targeted queries when fetching the call logs. The following are the parameters available in [CallLogRequestBuilder](/sdk/javascript/call-logs)
diff --git a/ui-kit/react/v5/conversations.mdx b/ui-kit/react/v5/conversations.mdx
index a8ac4651b..bb54d647b 100644
--- a/ui-kit/react/v5/conversations.mdx
+++ b/ui-kit/react/v5/conversations.mdx
@@ -62,7 +62,7 @@ export default function App() {
[Actions](/ui-kit/react/v5/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
+#### 1. OnItemClick
`OnItemClick` is triggered when you click on a ListItem of the Conversations component. The `OnItemClick` action doesn't have a predefined behavior. You can override this action using the following code snippet.
@@ -85,7 +85,7 @@ const getOnItemClick = (conversation: CometChat.Conversation) => {
***
-##### 2. OnSelect
+#### 2. OnSelect
The `OnSelect` event is triggered upon the completion of a selection in `SelectionMode`. It does not have a default behavior. However, you can override its behavior using the following code snippet.
@@ -117,7 +117,7 @@ const getOnSelect = (
***
-##### 3. OnError
+#### 3. OnError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Conversations component.
@@ -1100,7 +1100,7 @@ const getOptions = (conversation: CometChat.Conversation) => {
-##### Structure of CometChatOption
+#### Structure of CometChatOption
| Name | Description |
| ----------- | ----------------------------------------------------- |
diff --git a/ui-kit/react/v5/group-members.mdx b/ui-kit/react/v5/group-members.mdx
index 8ef71735d..7cb6f470a 100644
--- a/ui-kit/react/v5/group-members.mdx
+++ b/ui-kit/react/v5/group-members.mdx
@@ -65,7 +65,7 @@ export default function App() {
[Actions](/ui-kit/react/v5/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. onSelect
+#### 1. onSelect
The `onSelect` action is activated when you select the done icon while in selection mode. This returns a list of all the group members that you have selected.
@@ -159,7 +159,7 @@ export default GroupMembersDemo;
-##### 2. onItemClick
+#### 2. onItemClick
The `onItemClick` event is activated when you click on the Group Members List item. This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
@@ -238,7 +238,7 @@ export default GroupMembersDemo;
-##### 3. onEmpty
+#### 3. onEmpty
This action allows you to specify a callback function to be executed when a certain condition, typically the absence of data or content, is met within the component or element.
@@ -311,7 +311,7 @@ export default GroupMembersDemo;
-##### 4. onError
+#### 4. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Group Members component.
@@ -390,7 +390,7 @@ export default GroupMembersDemo;
**Filters** allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.
-##### 1. GroupMembersRequestBuilder
+#### 1. GroupMembersRequestBuilder
The [GroupMembersRequestBuilder](/sdk/javascript/retrieve-group-members) enables you to filter and customize the group members list based on available parameters in GroupMembersRequestBuilder. This feature allows you to create more specific and targeted queries when fetching groups. The following are the parameters available in [GroupMembersRequestBuilder](/sdk/javascript/retrieve-group-members)
@@ -479,7 +479,7 @@ export default GroupMembersDemo;
-##### 2. SearchRequestBuilder
+#### 2. SearchRequestBuilder
The SearchRequestBuilder uses [GroupMembersRequestBuilder](/sdk/javascript/retrieve-group-members) enables you to filter and customize the search list based on available parameters in GroupMembersRequestBuilder. This feature allows you to keep uniformity between the displayed Group Members List and searched Group Members List.
diff --git a/ui-kit/react/v5/groups.mdx b/ui-kit/react/v5/groups.mdx
index 93befaaf0..1be8ddf63 100644
--- a/ui-kit/react/v5/groups.mdx
+++ b/ui-kit/react/v5/groups.mdx
@@ -65,7 +65,7 @@ export default function App() {
[Actions](/ui-kit/react/v5/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. onSelect
+#### 1. onSelect
The `onSelect` action is activated when you select the done icon while in selection mode. This returns the `group` object along with the boolean flag `selected` to indicate if the group was selected or unselected.
@@ -121,7 +121,7 @@ export default GroupsDemo;
-##### 2. onItemClick
+#### 2. onItemClick
The `onItemClick` event is activated when you click on the Group List item. This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
@@ -163,7 +163,7 @@ export default GroupsDemo;
-##### 3. onError
+#### 3. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Groups component.
@@ -209,7 +209,7 @@ export default GroupsDemo;
**Filters** allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.
-##### 1. GroupsRequestBuilder
+#### 1. GroupsRequestBuilder
The [GroupsRequestBuilder](/sdk/javascript/retrieve-groups) enables you to filter and customize the group list based on available parameters in [GroupsRequestBuilder](/sdk/javascript/retrieve-groups). This feature allows you to create more specific and targeted queries when fetching groups. The following are the parameters available in [GroupsRequestBuilder](/sdk/javascript/retrieve-groups)
@@ -270,7 +270,7 @@ export default GroupsDemo;
-##### 2. SearchRequestBuilder
+#### 2. SearchRequestBuilder
The SearchRequestBuilder uses [GroupsRequestBuilder](/sdk/javascript/retrieve-groups) enables you to filter and customize the search list based on available parameters in GroupsRequestBuilder. This feature allows you to keep uniformity between the displayed Groups List and searched Group List.
diff --git a/ui-kit/react/v5/incoming-call.mdx b/ui-kit/react/v5/incoming-call.mdx
index a8d50765a..ed0a6f1a7 100644
--- a/ui-kit/react/v5/incoming-call.mdx
+++ b/ui-kit/react/v5/incoming-call.mdx
@@ -62,7 +62,7 @@ export default function App() {
[Actions](/ui-kit/react/v5/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. onAccept
+#### 1. onAccept
`onAccept` is triggered when you click the accept button of the `Incoming Call` component. You can override this action using the following code snippet.
@@ -105,7 +105,7 @@ export default IncomingCallsDemo;
-##### 2. onDecline
+#### 2. onDecline
`onDecline` is triggered when you click the Decline button of the `Incoming Call` component. You can override this action using the following code snippet.
@@ -148,7 +148,7 @@ export default IncomingCallsDemo;
-##### 3. onError
+#### 3. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Incoming Call component.
diff --git a/ui-kit/react/v5/message-composer.mdx b/ui-kit/react/v5/message-composer.mdx
index aea91db67..8caa3f6be 100644
--- a/ui-kit/react/v5/message-composer.mdx
+++ b/ui-kit/react/v5/message-composer.mdx
@@ -66,7 +66,7 @@ export default function App() {
[Actions](/ui-kit/react/v5/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. OnSendButtonClick
+#### 1. OnSendButtonClick
The `OnSendButtonClick` event gets activated when the send message button is clicked. It has a predefined function of sending messages entered in the composer `EditText`. However, you can overide this action with the following code snippet.
@@ -102,7 +102,7 @@ export function MessageComposerDemo() {
-##### 2. onError
+#### 2. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the MessageList component.
@@ -138,7 +138,7 @@ export function MessageComposerDemo() {
-##### 3. onTextChange
+#### 3. onTextChange
This event is triggered as the user starts typing in the Message Composer.
diff --git a/ui-kit/react/v5/message-header.mdx b/ui-kit/react/v5/message-header.mdx
index eacfd7726..113fdd88b 100644
--- a/ui-kit/react/v5/message-header.mdx
+++ b/ui-kit/react/v5/message-header.mdx
@@ -69,7 +69,7 @@ export default function App() {
[Actions](/ui-kit/react/v5/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. OnBack
+#### 1. OnBack
`OnBack` is triggered when you click on the back button of the Message Header component. You can override this action using the following code snippet.
@@ -143,7 +143,7 @@ export default MessageHeaderDemo;
***
-##### 2. OnError
+#### 2. OnError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Message Header component.
diff --git a/ui-kit/react/v5/message-list.mdx b/ui-kit/react/v5/message-list.mdx
index 59135a042..4445f1073 100644
--- a/ui-kit/react/v5/message-list.mdx
+++ b/ui-kit/react/v5/message-list.mdx
@@ -76,7 +76,7 @@ To fetch messages for a specific entity, you need to supplement it with `User` o
[Actions](/ui-kit/react/v5/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. onThreadRepliesClick
+#### 1. onThreadRepliesClick
`onThreadRepliesClick` is triggered when you click on the threaded message bubble. The `onThreadRepliesClick` action doesn't have a predefined behavior. You can override this action using the following code snippet.
@@ -146,7 +146,7 @@ export function MessageListDemo() {
-##### 2. onError
+#### 2. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the MessageList component.
@@ -210,7 +210,7 @@ export function MessageListDemo() {
-##### 3. onReactionClick
+#### 3. onReactionClick
`onReactionClick` is triggered when you click on the reaction item of the message bubble. The `onReactionClick` action doesn't have a predefined behavior. You can override this action using the following code snippet.
@@ -274,7 +274,7 @@ export function MessageListDemo() {
-##### 4. onReactionListItemClick
+#### 4. onReactionListItemClick
`onReactionListItemClick` is triggered when you click on the reaction list item of the reaction list. The `onReactionListItemClick` action doesn't have a predefined behavior. You can override this action using the following code snippet.
@@ -340,7 +340,7 @@ export function MessageListDemo() {
### Filters
-##### 1. Messages Request Builder
+#### 1. Messages Request Builder
You can adjust the `MessagesRequestBuilder` in the MessageList Component to customize your message list. Numerous options are available to alter the builder to meet your specific needs. For additional details on `MessagesRequestBuilder`, please visit [MessagesRequestBuilder](/sdk/javascript/additional-message-filtering).
@@ -417,7 +417,7 @@ The following parameters in messageRequestBuilder will always be altered inside
-##### 2. Reactions Request Builder
+#### 2. Reactions Request Builder
You can adjust the `ReactionsRequestBuilder` in the MessageList Component to customize and fetch the reactions for the messages. Numerous options are available to alter the builder to meet your specific needs.
diff --git a/ui-kit/react/v5/outgoing-call.mdx b/ui-kit/react/v5/outgoing-call.mdx
index 56b694e47..3d1f432ad 100644
--- a/ui-kit/react/v5/outgoing-call.mdx
+++ b/ui-kit/react/v5/outgoing-call.mdx
@@ -82,7 +82,7 @@ export default function App() {
[Actions](/ui-kit/react/v5/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. onCallCanceled
+#### 1. onCallCanceled
The `onCallCanceled` event gets activated when the cancel button is clicked. It does not have a default behavior. However, you can override its behavior using the following code snippet.
@@ -176,7 +176,7 @@ export default OutgoingCallDemo;
-##### 2. onError
+#### 2. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the Outgoing Call component.
diff --git a/ui-kit/react/v5/users.mdx b/ui-kit/react/v5/users.mdx
index 06126f693..271042dc6 100644
--- a/ui-kit/react/v5/users.mdx
+++ b/ui-kit/react/v5/users.mdx
@@ -62,7 +62,7 @@ export default function App() {
[Actions](/ui-kit/react/v5/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. onSelect
+#### 1. onSelect
The `onSelect` action is activated when you select the done icon while in selection mode. This returns a list of all the users that you have selected.
@@ -117,7 +117,7 @@ export default UsersDemo;
-##### 2. onItemClick
+#### 2. onItemClick
The `OnItemClick` event is activated when you click on the UserList item. This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
@@ -156,7 +156,7 @@ export default UsersDemo;
-##### 3. onEmpty
+#### 3. onEmpty
This action allows you to specify a callback function to be executed when a certain condition, typically the absence of data or content, is met within the component or element.
@@ -196,7 +196,7 @@ export default UsersDemo;
-##### 4. onError
+#### 4. onError
This action doesn't change the behavior of the component but rather listens for any errors that occur in the User component.
@@ -240,7 +240,7 @@ export default UsersDemo;
**Filters** allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.
-##### 1. UserRequestBuilder
+#### 1. UserRequestBuilder
The [UserRequestBuilder](/sdk/javascript/retrieve-users) enables you to filter and customize the user list based on available parameters in UserRequestBuilder. This feature allows you to create more specific and targeted queries when fetching users. The following are the parameters available in [UserRequestBuilder](/sdk/javascript/retrieve-users)
@@ -303,7 +303,7 @@ export default UsersDemo;
-##### 2. SearchRequestBuilder
+#### 2. SearchRequestBuilder
The SearchRequestBuilder uses [UserRequestBuilder](/sdk/javascript/retrieve-users) enables you to filter and customize the search list based on available parameters in UserRequestBuilder. This feature allows you to keep uniformity between the displayed UserList and searched UserList.