AI Integration Quick Reference
AI Integration Quick Reference
| 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 Steps 1–5 first |
| SSR | client:only="react" directive — CometChat requires browser APIs |
| Pattern | Full-featured messaging app with multiple sections |

What You’re Building
Three sections working together:- Tab bar — switches between Chats, Calls, Users, and Groups
- Sidebar — renders the list for the active tab
- Message view — header + messages + composer for the selected item
Step 1 — Create the Tab Component
src
components
CometChatTabs
CometChatTabs.tsx
CometChatTabs.css
public/assets/. Download them from the CometChat UI Kit assets folder on GitHub.
public
assets
chats.svg
calls.svg
users.svg
groups.svg
- TypeScript
- CSS
CometChatTabs.tsx
Step 2 — Create the Sidebar Component
The sidebar renders the list for whichever tab is active, plus the tab bar at the bottom.src
components
CometChatSelector
CometChatSelector.tsx
CometChatSelector.css
- TypeScript
- CSS
CometChatSelector.tsx
- The
activeTabstate drives which list component renders —CometChatConversations,CometChatCallLogs,CometChatUsers, orCometChatGroups. - Each list component passes its selection back to the parent via
onSelectorItemClicked. CometChatTabsrenders at the bottom of the sidebar.
Step 3 — Create the TabbedChat Island
This component handles init, login, and renders the full tabbed chat experience. It runs client-side only viaclient:only="react".
src
components
TabbedChat.tsx
TabbedChat.css
- TypeScript
- CSS
TabbedChat.tsx
- Selections from any tab (Chats, Calls, Users, Groups) flow through the same
onSelectorItemClickedcallback. - Conversation items are unwrapped via
getConversationWith()to extract the underlyingUserorGroup. - Only one of
selectedUser/selectedGroupis set at a time — the other is cleared.
Step 4 — Render the Astro Page
Import the island and hydrate it client-side usingclient:only="react".
src/pages/index.astro
client:only="react" directive ensures the component skips SSR entirely and only renders in the browser.
Step 5 — 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
Astro Integration
Back to the main setup guide
Core Features
Chat features included out of the box