AI Agent Component Spec
AI Agent Component Spec
- Package:
@cometchat/chat-uikit-react - Key components:
CometChatUsers,CometChatGroups,CometChatJoinGroup,CometChatSelector - Required setup:
CometChatUIKit.init(UIKitSettings)thenCometChatUIKit.login("UID") - Purpose: Unified new chat entry point for starting 1:1 or group conversations
- Sample app: GitHub
- Related: All Guides
Overview
The New Chat feature allows users to initiate conversations with other users or join group conversations, providing a smooth 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.
Prerequisites
See Prerequisites. Additional requirements:- TypeScript support (recommended)
- User authentication and basic chat functionality implemented
- User and group management components available
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 |
Integration Steps
1. New Chat State Management Setup
File: CometChatHome.tsx2. New Chat View Component Integration
File: CometChatHome.tsx3. New Chat View Implementation
File: CometChatHome.tsx4. User Selection and Chat Creation
File: CometChatHome.tsxImplementation Flow
- Fetch Data / Available Users and Groups
- Load User/Group Data / Associated Information
- Create Conversation / Action Handler
- Live Updates / State Management
Customization Options
- Override CSS styles
- Configure tabs
- Customize list UI
- Add search
- Handle group types
- Adjust navigation
Filtering / Edge Cases
- User availability
- Group permissions
- Duplicate chats prevention
- Blocking logic
- Membership checks
- Empty states
Error Handling & State Management
Context-Specific Notes
- Public vs private groups
- Different state logic for user/group chats
- Mobile responsiveness
- Navigation flow control
- Group type handling
Summary / Feature Matrix
| Feature | Component / Method | File Reference |
|---|---|---|
| Open new chat view | onNewChatClicked() | CometChatHome.tsx |
| New chat interface | CometChatNewChatView | CometChatHome.tsx |
| User selection | CometChatUsers | CometChatHome.tsx |
| Group selection | CometChatGroups | CometChatHome.tsx |
| Group joining | joinGroup() | CometChatHome.tsx |
| State management | showNewChat state | appReducer.ts |
| Chat creation | setNewChat() | CometChatHome.tsx |
| Navigation handling | setShowNewChat(false) | CometChatHome.tsx |
Next Steps
Conversations
Display and manage conversation lists.
Groups
Display and manage group lists.
All Guides
Browse all feature and formatter guides.
Sample App
Full working sample application on GitHub.