AI Agent Component Spec
AI Agent Component Spec
- Package:
@cometchat/chat-uikit-react - Framework: React.js
- Key components:
CometChatConversations+CometChatMessageList - Required setup:
CometChatUIKit.init(UIKitSettings)thenCometChatUIKit.login("UID") - Parent guide: React.js Integration
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.
User Interface Overview

- Sidebar (Conversation List) – Displays active conversations, including users and groups.
- Message View – Shows chat messages for the selected conversation in real-time.
- 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 theSidebar component which will render different conversations.
Folder Structure
Create aCometChatSelector folder inside your src directory and add the following files:
- TypeScript
- CSS
CometChatSelector.tsx
Step 2: Update App
Now we will update theApp.tsx & App.css files to import these new components as below,
- TypeScript
- CSS
App.tsx
Step 3: Run the project
- Vite
- Create React App
Common Failure Modes
Common Failure Modes
Common Failure Modes
| Symptom | Cause | Fix |
|---|---|---|
| Component doesn’t render | CometChatUIKit.init() not called or not awaited | Ensure init completes before rendering. See Methods |
| Component renders but shows no data | User not logged in | Call CometChatUIKit.login("UID") after init |
| CSS/theme not applied | Missing CSS import | Add @import url("@cometchat/chat-uikit-react/css-variables.css"); in your CSS |
| Blank screen after login | Component mounted before init/login completes | Use state to conditionally render after login resolves |
| Messages not loading | Invalid user/group object passed | Ensure you fetch the user/group via SDK before passing to components |
Next Steps
Advanced Customizations
Personalize the chat UI to align with your brand.
Components Overview
Explore all available prebuilt UI components.
React.js Integration
Return to the React.js setup guide.
Core Features
Learn about messaging, real-time updates, and more.