Skip to main content
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 Angular Integration (project created, UI Kit installed, init + login working, CSS imported).

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
Everything goes in AppComponent — no extra files needed.

Step 1 — Update AppComponent

The app fetches a user (or group) on mount, sets it as the active entity via ChatStateService, and renders the three message components. The components auto-subscribe to the service — no prop passing needed.
src/app/app.component.ts
Key points:
  • CometChat.getUser(UID) fetches the user object from the SDK — you need a real user object, not a manually constructed one.
  • chatStateService.setActiveUser(user) sets the active entity — all message components auto-subscribe and render accordingly.
  • Setting a user automatically clears any active group (mutual exclusivity).

Switching Between User and Group Chat

To load a group chat instead of one-to-one, replace the setActiveUser call with setActiveGroup:
You can also determine this dynamically — for example, based on a route parameter or a selection from another part of your app.

Step 2 — Run the Project

You should see the chat window load with the conversation for the UID you set.

Next Steps

Theming

Customize colors, fonts, and styles to match your brand

Components Overview

Browse all prebuilt UI components

Angular Integration

Back to the main setup guide

Core Features

Chat features included out of the box