Skip to main content

Architecture

The UI Kit provides a set of independent, composable React components that wire together into complete chat layouts. A typical two-panel layout uses four core components:
  • CometChatConversations — sidebar listing recent conversations
  • CometChatMessageHeader — toolbar showing avatar, name, status, and typing indicator
  • CometChatMessageList — scrollable message feed with reactions, receipts, and threads
  • CometChatMessageComposer — rich text input with attachments, mentions, and voice notes
Data flow: selecting a conversation yields a CometChat.User or CometChat.Group object. Pass that object as a prop (user or group) to the message components. They handle SDK calls internally — the composer sends messages, the list receives them via real-time listeners. All components must be rendered inside a <CometChatProvider> which provides shared context (theme, locale, events). SDK initialization and login must be completed before the provider mounts.
import {
  CometChatProvider,
  CometChatConversations,
  CometChatMessageHeader,
  CometChatMessageList,
  CometChatMessageComposer,
} from "@cometchat/chat-uikit-react";

function ChatApp() {
  const [user, setUser] = useState<CometChat.User | undefined>();

  return (
    <CometChatProvider>
      <div style={{ display: "flex", height: "100vh" }}>
        <CometChatConversations onItemClick={(conv) => setUser(conv.getConversationWith())} />
        <div style={{ flex: 1, display: "flex", flexDirection: "column" }}>
          <CometChatMessageHeader user={user} />
          <CometChatMessageList user={user} />
          <CometChatMessageComposer user={user} />
        </div>
      </div>
    </CometChatProvider>
  );
}

Flat API

All components — both feature and base — support the flat API. Render them in a single line with props, and they handle their layout internally.
<CometChatConversations onItemClick={handleClick} hideSearch />
This is the quickest way to get started. The component renders all its default sub-components (header, list, empty state, loading state, etc.) automatically.

Compound Composition

For full layout control, use the compound pattern. Each feature component is a namespace with sub-components:
<CometChatConversations.Root onItemClick={handleClick}>
  {/* Only render what you need, and omit sub-components to hide them */}
  <CometChatConversations.View />
  <CometChatConversations.EmptyState />
</CometChatConversations.Root>
Key principles:
  • Root initializes state, fetches data, and provides context to children.
  • Sub-components read from context and render when their state is active.
  • Omit a sub-component to hide it, no boolean props needed.
  • Add custom elements anywhere inside Root alongside the sub-components.
Both APIs produce the same result. The flat API is shorthand for rendering Root with all sub-components in their default order.

Component Categories

Components are organized into three categories:

Feature Components

Feature components integrate with the CometChat SDK for data fetching, real-time events, and state management. They follow the compound pattern and support both flat and compound APIs. Feature components:
  • Own their data lifecycle (fetch, paginate, refresh)
  • Subscribe to real-time SDK events (new messages, presence changes, typing indicators)
  • Manage complex state via hooks and reducers
  • Provide context to their sub-components

Base Components

Base components are pure UI building blocks with no SDK integration. They accept props and render UI — no network calls, no real-time events. Feature components compose these internally. Base components support both flat API and compound composition.

Feature Components

All feature components are imported from @cometchat/chat-uikit-react.

Conversations and Lists

ComponentPurposePage
CometChatConversationsScrollable list of recent conversations with real-time updatesConversations
CometChatUsersSearchable list of users with selection supportUsers
CometChatGroupsSearchable list of groups with selection supportGroups
CometChatGroupMembersList of group members with role-based actionsGroup Members

Messages

ComponentPurposePage
CometChatMessageHeaderToolbar with avatar, name, status, typing indicator, and call buttonsMessage Header
CometChatMessageListScrollable message feed with plugin-based bubble renderingMessage List
CometChatMessageComposerRich text input with attachments, emoji, voice recording, and formattingMessage Composer
CometChatMessageBubbleMessage bubble container with alignment, receipts, options, and reactionsMessage Bubble
CometChatThreadHeaderParent message bubble and reply count for threaded conversationsThread Header
CometChatMessageInformationMessage delivery and read receipt details panelMessage Information
CometChatReactionsReaction chips bar with reactor list popoverReactions
CometChatReactionListFull reactor list with tabs and paginationReaction List
CometChatFlagMessageDialogModal dialog for reporting/flagging messages with reason selectionFlag Message Dialog

Message Bubbles

Message bubble components accept a message object and self-extract all required data (text, attachments, metadata, sender info). Unlike v6 where bubbles were purely presentational, v7 bubbles are self-contained — they derive their rendering state directly from the SDK message.
ComponentMessage TypePurposePage
CometChatTextBubbletextFormatted text with mentions, URLs, markdown, and link previewsText Bubble
CometChatImageBubbleimageImage grid with captions and click-to-fullscreenImage Bubble
CometChatVideoBubblevideoVideo player with thumbnail and captionVideo Bubble
CometChatAudioBubbleaudioWaveform audio player with captionAudio Bubble
CometChatFileBubblefileFile card with name, size, and download buttonFile Bubble
CometChatPollBubbleextension_pollPoll with options, voting, and resultsPoll Bubble
CometChatStickerBubbleextension_stickerSticker image displaySticker Bubble
CometChatCollaborativeDocumentBubbleextension_documentDocument collaboration link with join buttonCollaborative Document Bubble
CometChatCollaborativeWhiteboardBubbleextension_whiteboardWhiteboard collaboration link with join buttonCollaborative Whiteboard Bubble
CometChatGroupActionBubblegroupMemberGroup membership system messages (joined, left, kicked, banned, scope change)Group Action Bubble
CometChatCallActionBubbleaudio, video (call category)Call status system messages (missed, outgoing, incoming, ended)Call Action Bubble
CometChatCallBubblemeeting (custom)Direct call / meeting invitation bubbleCall Bubble

Calling

ComponentPurposePage
CometChatCallButtonsVoice and video call initiation buttonsCall Buttons
CometChatIncomingCallIncoming call notification with accept/declineIncoming Call
CometChatOutgoingCallOutgoing call screen with cancel controlOutgoing Call
CometChatCallLogsScrollable list of call historyCall Logs

Search and AI

ComponentPurposePage
CometChatSearchUnified search across conversations and messagesSearch
CometChatAIAssistantChatAI agent chat with streaming, suggestions, and historyAI Assistant

Base Components

Base components are imported from @cometchat/chat-uikit-react. They don’t have individual doc pages — use the source types and Storybook for reference.
ComponentPurpose
CometChatActionBubbleReusable pill-shaped system message bubble (used by GroupActionBubble and CallActionBubble)
CometChatActionSheetBottom sheet with grouped action items
CometChatAvatarUser/group avatar with image and initials fallback
CometChatButtonStyled button with icon, text, loading, and variant support
CometChatChangeScopeGroup member role/scope change selector
CometChatCheckboxCheckbox input with label and controlled/uncontrolled support
CometChatConfirmDialogConfirmation dialog with customizable message and buttons
CometChatContextMenuOptions menu with top-row icons and overflow dropdown
CometChatConversationStarterAI-generated conversation starter suggestions as clickable pills
CometChatConversationSummaryAI-generated conversation summary display
CometChatDateFormatted date/time display with temporal bucketing
CometChatDeleteBubble”This message was deleted” placeholder bubble
CometChatDownloadButtonDownload button for file and media attachments
CometChatEmojiKeyboardEmoji picker with category tabs and search
CometChatErrorBoundaryError isolation wrapper with fallback UI and retry
CometChatFormattingToolbarRich text formatting toolbar (bold, italic, lists, links, code)
CometChatFullScreenViewerFull-screen image/media viewer with download
CometChatLinkDialogDialog for inserting or editing hyperlinks
CometChatLinkPopoverPopover for previewing and editing links inline
CometChatListItemStandardized list item with avatar, title, subtitle, and tail
CometChatMediaRecorderAudio recording with timer, preview, and submit
CometChatModerationViewContent moderation indicator and action view
CometChatPopoverPositioning utility component for popovers and dropdowns
CometChatRadioButtonRadio button input with label support
CometChatSearchBarSearch input with clear button and keyboard handling
CometChatSmartRepliesAI-powered reply suggestions as clickable chips
CometChatThreadViewInline thread reply indicator with reply count and unread dot
CometChatToastToast notification for transient feedback messages
CometChatTypingIndicatorAnimated typing indicator with user attribution

Component API Pattern

All components share a consistent API surface for customization.

Actions (Callbacks)

Callback props fire on user interactions. Override them to customize behavior:
<CometChatMessageList
  user={chatUser}
  onThreadRepliesClick={(message) => openThreadPanel(message)}
  onError={(error) => logError(error)}
/>

Filters (RequestBuilder)

List components accept RequestBuilder props to control which data loads:
<CometChatConversations
  conversationsRequestBuilder={
    new CometChat.ConversationsRequestBuilder().setLimit(15)
  }
/>
Pass the builder instance — not the result of .build().

View Props

View props replace the visual content inside a component slot while keeping the default behavior wired:
<CometChatMessageComposer
  user={chatUser}
  sendButtonView={<MyCustomSendIcon />}
  headerView={<MyCustomHeader />}
  auxiliaryButtonView={<MyExtraButton />}
/>
For deeper control, use compound composition to replace entire slots including their behavior.

CSS Styling

Components use CSS custom properties (design tokens). Override them on the .cometchat root or on component-specific selectors:
.cometchat {
  --cometchat-primary-color: #6851d6;
  --cometchat-font-family: "Inter", sans-serif;
}

.cometchat-message-list {
  --cometchat-background-color-01: #fafafa;
}
Component class names follow BEM convention: .cometchat-component-name__element--modifier.

Next Steps

Theming

Customize colors, fonts, and spacing with CSS variables

Plugins

Customize message rendering with the plugin system

Event System

Subscribe to real-time events across components

Guides

Task-oriented tutorials for common patterns