AI Agent Component Spec
AI Agent Component Spec
- Package:
@cometchat/chat-uikit-react - Framework: Next.js
- Key components:
CometChatConversations+CometChatCallLogs+CometChatUsers+CometChatGroups - Required setup:
CometChatUIKit.init(UIKitSettings)thenCometChatUIKit.login("UID") - Parent guide: Next.js Integration
User Interface Preview

- Sidebar (Conversation List) — recent conversations with users and groups
- Message View — messages for the selected chat
- Message Composer — text input with media, emoji, and reaction support
Step-by-Step Guide
Create a Tab Component
Create a
🔗 GitHub Assets Folder
CometChatTabs folder inside src:Download the Icons
These icons are available in the CometChat UI Kit assets folder. You can find them at:🔗 GitHub Assets Folder
Implementation
- TypeScript
- CSS
CometChatTabs.tsx
Create Sidebar
Let’s create the
Sidebar component which will render different conversations.Folder Structure
Create aCometChatSelector folder inside your src/app directory and add the following files:- TypeScript
- CSS
CometChatSelector.tsx
Render Experience
Now we will update the
CometChatNoSSR.tsx & CometChatNoSSR.css files to import these new components as below,- TypeScript
- CSS
CometChatNoSSR.tsx
Disabling SSR for CometChatNoSSR.tsx in Next.js
In this update, we will disable Server-Side Rendering (SSR) for Disabling SSR in
Modify your
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
Modify your index.tsx file to dynamically import the CometChatNoSSR.tsx component with { ssr: false }.index.tsx
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.
Update Global CSS
Next, add the following styles to global.css to ensure CometChat UI Kit is properly styled.
global.css