Skip to main content
FieldValue
Package@cometchat/chat-uikit-react
FrameworkAstro
ComponentsCometChatConversations, CometChatCallLogs, CometChatUsers, CometChatMessageHeader, CometChatMessageList, CometChatMessageComposer
LayoutTabbed sidebar (Chat, Calls, Users) + message view
PrerequisiteComplete Astro Integration first
SSRReact island with client:only="react" directive
PatternFull-featured messaging app with multiple sections
This guide builds a tabbed messaging UI — Chat, Calls, and Users tabs in the sidebar, with a message view on the right. Good for full-featured apps that need more than just conversations. This assumes you’ve already completed Astro Integration (project created, UI Kit installed, init + login working).

What You’re Building

Three sections working together:
  1. Tab bar — switches between Chat, Calls, and Users
  2. Sidebar — renders the list for the active tab
  3. Message view — header + messages + composer for the selected item

Full Code

Create a React island component with the tabbed UI, then render it in an Astro page with client:only="react".
src/components/TabbedChat.tsx
src/pages/chat.astro

How It Works

  1. client:only="react" tells Astro to skip server-rendering and hydrate the component entirely on the client. This is required because CometChat uses browser APIs.
  2. React island — the CometChat UI lives in a self-contained React component. Astro handles the page shell, React handles the interactive chat.
  3. Tab stateactiveTab controls which list component renders in the sidebar.
  4. Conditional rendering — only the active tab’s component mounts. Switching tabs unmounts the previous list and mounts the new one.
  5. Unified selection — all three tabs feed into the same selectedUser / selectedGroup state. Clicking any item (conversation, call log, or user) updates the message panel.
  6. Call log handling — when a call log is clicked, the receiver (user or group) is extracted and passed to the message components.

Adding More Tabs

To add a Groups tab, import CometChatGroups and add another tab button + conditional render:
You can follow the same pattern for any additional tabs (Settings, Contacts, etc.).

Run

Open http://localhost:4321/chat. You should see the tab bar at the top of the sidebar. Switch between Chats, Calls, and Users — clicking any item loads the message view on the right.

Next Steps

Conversation List + Messages

Two-panel layout without tabs

Components Overview

Browse all prebuilt UI components

Theming

Customize colors, fonts, and styles