Skip to main content
FieldValue
Package@cometchat/chat-uikit-react
FrameworkReact.js
ComponentsCometChatMessageHeader, CometChatMessageList, CometChatMessageComposer
LayoutSingle chat window — no sidebar, no conversation list
PrerequisiteComplete React.js Integration first
PatternSupport chat, embedded widgets, focused messaging
This guide builds a single chat window — no sidebar, no conversation list. Users go directly into a one-to-one or group chat. Good for support chat, embedded widgets, or any focused messaging experience. This assumes you’ve already completed React.js Integration (project created, UI Kit installed, init + login working).

What You’re Building

Three components stacked vertically:
  1. Chat header — displays recipient name, avatar, online status, and optional call buttons
  2. Message list — real-time chat history with scrolling
  3. Message composer — text input with media, emojis, and reactions

Full Code

Replace your src/App.tsx with the following. Init and login must complete before the provider mounts — see the React.js Integration guide for the src/main.tsx setup.
src/App.tsx
src/App.css
Key points:
  • CometChat.getUser(UID) fetches the full user object from the SDK — you need a real user object, not a manually constructed one.
  • Pass either user or group to the message components, never both.
  • The RECIPIENT_UID should be a user that exists in your CometChat app. Use one of the pre-created test UIDs: cometchat-uid-1 through cometchat-uid-5.

Switching to Group Chat

To load a group chat instead of one-to-one, fetch a Group object and pass it to the message components:
src/App.tsx
The only difference: use CometChat.getGroup(GUID) instead of CometChat.getUser(UID), and pass group instead of user.

Run

Open http://localhost:5173. You should see the chat window load with the conversation for the UID or GUID you set.

Next Steps

Conversation List + Messages

Two-panel layout with a sidebar

Tab-Based Chat

Tabbed navigation with Chats, Calls, Users

Components Overview

Browse all prebuilt UI components