Skip to main content
This guide builds a tabbed messaging UI — Chats, Calls, Users, and Groups 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, React added, UI Kit installed).

What You’re Building

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

Step 1 — Create the Tab Component

src
components
CometChatTabs
CometChatTabs.tsx
CometChatTabs.css
Tab icons need to be placed in public/assets/. Download them from the CometChat UI Kit assets folder on GitHub.
public
assets
chats.svg
calls.svg
users.svg
groups.svg
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
CometChatSelector.tsx
Key points:
  • The activeTab state drives which list component renders — CometChatConversations, CometChatCallLogs, CometChatUsers, or CometChatGroups.
  • Each list component passes its selection back to the parent via onSelectorItemClicked.
  • CometChatTabs renders 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 via client:only="react".
src
components
TabbedChat.tsx
TabbedChat.css
TabbedChat.tsx
How it works:
  • Selections from any tab (Chats, Calls, Users, Groups) flow through the same onSelectorItemClicked callback.
  • Conversation items are unwrapped via getConversationWith() to extract the underlying User or Group.
  • Only one of selectedUser / selectedGroup is set at a time — the other is cleared.

Step 4 — Render the Astro Page

Import the island and hydrate it client-side using client:only="react".
src/pages/index.astro
The client:only="react" directive ensures the component skips SSR entirely and only renders in the browser.

Step 5 — Run the Project

You should see the tab bar at the bottom of the sidebar. Switch between Chats, Calls, Users, and Groups — tapping any item loads the message view on the right.

Next Steps

Theming

Customize colors, fonts, and styles to match your brand

Components Overview

Browse all prebuilt UI components
Astro

Astro Integration

Back to the main setup guide

Core Features

Chat features included out of the box