AI Integration Quick Reference
AI Integration Quick Reference
| 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 Steps 1–5 first |
| SSR | Dynamic import with ssr: false — CometChat requires browser APIs |
| Pattern | Support chat, embedded widgets, focused messaging |

Fork the sandbox, insert your CometChat credentials (App ID, Region, Auth Key), and preview the UI in real time.
What You’re Building
Three components stacked vertically:- Chat header — displays recipient name, avatar, online status, and optional call buttons
- Message list — real-time chat history with scrolling
- Message composer — text input with media, emojis, and reactions
Step 1 — Create the CometChatNoSSR Component
This component handles init, login, fetches the target user/group, and renders the chat UI. It runs client-side only.src
app
CometChatNoSSR
CometChatNoSSR.tsx
CometChatNoSSR.css
- TypeScript
- CSS
CometChatNoSSR.tsx
CometChat.getUser(UID)fetches the user object from the SDK — you need a real user object, not a manually constructed one.- Pass either
userorgroupto the message components, never both. - The highlighted lines show where to set your credentials.
Switching Between User and Group Chat
To load a group chat instead of one-to-one, replace thegetUser call with getGroup:
Step 2 — Disable SSR in Your Page
Dynamically importCometChatNoSSR with ssr: false so it only loads client-side.
index.tsx
Step 3 — Run the Project
- npm
- pnpm
- yarn
Next Steps
Theming
Customize colors, fonts, and styles to match your brand
Components Overview
Browse all prebuilt UI components
Next.js Integration
Back to the main setup guide
Core Features
Chat features included out of the box