AI Agent Component Spec
AI Agent Component Spec
- Package:
@cometchat/chat-uikit-react - Framework: Astro (with
@astrojs/reactislands) - Key component:
CometChatFullScreenView - Required setup:
CometChatUIKit.init(UIKitSettings)thenCometChatUIKit.login("UID")— useclient:only="react"directive - Parent guide: Astro Integration
User Interface Preview

- Sidebar — conversations, users, groups, or call logs
- Messages — header, list, and composer
- Tabs — switch between Chats, Calls, Users, and Groups
Prerequisites
- Astro project with React integration
- CometChat credentials in
.env
Create or open an Astro project
If you already have the sample
astro-tab-based-chat project, open it instead.Initialize CometChat (src/lib/cometchat-init.js)
Create
src/lib/cometchat-init.js to initialize the UI Kit and provide a helper for login.src/lib/cometchat-init.js
Create the Tabs component (src/components/CometChatTabs.jsx)
A simple bottom tab bar used to switch between sections.
src/components/CometChatTabs.jsx
Build the React island (src/components/TabbedChat.jsx)
This component renders the sidebar list based on the active tab and shows the message panel on the right.
src/components/TabbedChat.jsx
Render the page (src/pages/index.astro)
Import the island and styles, then hydrate on the client.
src/pages/index.astro
Troubleshooting
Tabs not switching or empty lists
Tabs not switching or empty lists
Ensure
CometChatTabs is wired via onTabClicked and that the active tab state drives which list is rendered.Missing credentials
Missing credentials
Verify
.env contains PUBLIC_COMETCHAT_APP_ID, PUBLIC_COMETCHAT_REGION, PUBLIC_COMETCHAT_AUTH_KEY, and PUBLIC_COMETCHAT_LOGIN_UID.No messages on right panel
No messages on right panel
The message panel shows only for Chats, Users, or Groups. Calls tab does not open a message panel.