Skip to main content
The CometChatTemplatesService provides centralized template customization across all CometChat list components. Register templates once and have them apply to conversations, users, groups, group members, call logs, and message list components.

Import

Template Priority

Templates are resolved in the following order (highest to lowest):
  1. Component @Input (e.g. [loadingView]="myTemplate")
  2. Component-specific service templates (e.g. setUserTemplates())
  3. Shared service templates (setSharedTemplates())
  4. Component default

Shared Templates

Use setSharedTemplates() to set loading, empty, or error templates that apply to all list components at once. This is the simplest way to brand every list in your app with a single call.

SharedListTemplates Interface

Example: Override Loading State for All Lists

Component-Specific Templates

Each list component has its own typed template interface. Component-specific templates take priority over shared templates.

ConversationTemplates

UserTemplates

GroupTemplates

GroupMemberTemplates

CallLogTemplates

MessageListTemplates

Methods

Shared Template Methods

Conversation Template Methods

User Template Methods

Group Template Methods

Group Member Template Methods

Call Log Template Methods

Message List Template Methods

Bulk Operations

Resolved Template Helper

Usage Examples

Shared Loading + Component-Specific Override

Scoping for Multiple Instances

By default, CometChatTemplatesService is a singleton (providedIn: 'root'). If you need different templates for different parts of your app, scope it via a wrapper component:

Clearing Templates at Runtime

Reactive Access

Each template section exposes both a signal and an Observable for reactive consumption: