Syncfusion Angular Chat UI Component
Component Overview
The Syncfusion Angular Chat UI component provides a complete, feature-rich solution for building conversational interfaces in Angular applications. It enables real-time messaging, user presence indicators, file attachments, typing indicators, and seamless integration with bot frameworks and AI services.
Key Capabilities:
- Message Management - Configure messages with text, rich templates, media, replies, pinning, and forwarding
- User System - Define current user, presence status, avatars with custom styling and mentions
- Appearance Control - Customize width, height, placeholder, CSS classes, compact mode, and suggestions
- Header & Footer - Control visibility, titles, icons, custom templates, and header toolbar with actions
- Events & Interactions - Handle message send, typing indicators, toolbar actions (copy, reply, pin, delete)
- Templates - Customize empty chat, messages, time breaks, typing indicators, and suggestion items
- File Attachments - Enable uploads with type/size restrictions, drag-and-drop, custom paths, attachment click events
- Methods - Programmatically add/update messages, scroll to bottom, scroll to specific message, focus input
- Globalization - Support multiple languages (i18n), RTL text direction, and locale-based formatting
- Advanced Features - Load on demand, state persistence, mentions, message status, time breaks, bot integrations
Documentation and Navigation Guide
Getting Started
📄 Read: references/getting-started.md
- Installation and package setup (Ivy vs ngcc)
- Setup Angular environment with Angular CLI
- Basic component initialization
- Configuring messages and users
- CSS imports and theme configuration
- Running the application
Messages and Users
📄 Read: references/messages-and-users.md
- Message configuration and properties (text, id, author, timestamp)
- User models and avatars
- Defining current user with unique identifier
- Avatar URLs and custom background colors
- User presence status (online, offline, away, busy)
- Message pinning for important messages
- Enhanced MessageReplyModel with complete interface documentation
- Reply with attachments and timestamp formatting
- Dynamic reply creation patterns
- Message forwarding
- Compact mode for group conversations
- Markdown message support
Appearance and Layout
📄 Read: references/appearance-and-layout.md
- Placeholder text customization
- Width and height properties
- CSS class customization for styling
- Compact mode configuration
- Auto-scroll to bottom behavior
- Suggestions display for quick replies
Header and Footer
📄 Read: references/header-and-footer.md
- Header visibility control
- Header text (title) configuration
- Header icon customization with CSS classes
- Header toolbar with custom actions (call, video, settings, profile)
- ToolbarSettingsModel configuration with items and itemClicked event
- Footer visibility and control
- Footer template for custom layouts
Events and Interactions
📄 Read: references/events-and-interactions.md
- Component lifecycle events (created)
- Message send event handling
- User typing event and typing indicators
- Message toolbar configuration
- Complete ToolbarItemModel properties (align, cssClass, disabled, iconCss, tabIndex, template, text, tooltip, type, visible)
- Toolbar items customization (copy, reply, pin, delete, forward)
- Item click event handling
- Toolbar width configuration
- Before/after attachment events
- Header toolbar vs message toolbar differences
Templates and Content
📄 Read: references/templates-and-content.md
- Message template customization
- Empty chat template for initial state
- Time break template for date separators
- Message status and delivery icons
- Timestamp display and visibility
- Timestamp format customization (dd/MM/yyyy hh:mm a)
- Suggestion template customization with context variables (index, suggestion)
- Advanced suggestion examples (category-based, search-highlighted, icon-based)
- Typing indicator template
Attachments and File Handling
📄 Read: references/attachments-and-file-handling.md
- Enable file attachment support
- Attachment settings configuration
- Server endpoints (saveUrl, removeUrl)
- File type restrictions and filters
- File size limits (default 30MB)
- SaveFormat enum (Blob vs Base64) with advantages and use cases
- Custom storage paths with path property for CDN/cloud storage
- Drag-and-drop file upload
- Maximum file count restrictions
- File preview templates
- Attachment templates
- attachmentClick event for custom file interactions (preview, download, metadata)
- attachedFile property for pre-populating messages with files
- Upload event handling (success, failure)
Methods and Programmatic Control
📄 Read: references/methods-and-programmatic-control.md
- addMessage() - Add new messages programmatically
- updateMessage() - Edit existing messages
- scrollToBottom() - Scroll to latest messages
- scrollToMessage(messageId) - Navigate to specific message (pinned messages, search results, deep linking)
- focus() - Set focus to chat input programmatically (auto-focus, modal close, command execution)
- ViewChild component access
- Accessing chat instance for direct control
Globalization and Localization
📄 Read: references/globalization-and-localization.md
- Localization (L10n) and i18n support
- Typing indicator translations
- Multiple language support
- Right-to-Left (RTL) layout for Arabic, Hebrew, Persian
- Locale configuration
- Language-specific string customization
Advanced Features
📄 Read: references/advanced-features.md
- State persistence with enablePersistence (localStorage, cross-tab sync, browser refresh protection)
- Custom persistence implementations for sensitive data
- Load on demand for large message histories (1000+ messages)
- Mention integration with @character
- Trigger character customization
- Predefined mentions in messages
- mentionSelect event handling
- Message status tracking (sent, delivered, read)
- Time breaks between messages for date organization
Bot Integrations
📄 Read: references/bot-integrations.md
- Google Dialogflow integration for AI conversations
- Microsoft Bot Framework integration with Azure
- Direct Line API configuration
- Token server setup for security
- Backend API configuration
- Secure credential handling
- Bot response message handling
- Session management
Quick Start Example
Here's a minimal example to get started:
import { Component } from '@angular/core';
import { ChatUIModule } from '@syncfusion/ej2-angular-interactive-chat';
import { UserModel } from '@syncfusion/ej2-interactive-chat';
@Component({
imports: [ChatUIModule],
standalone: true,
selector: 'app-root',
template: `
<div id="chatui" ejs-chatui
[user]="currentUserModel"
headerText="TeamSync Professionals">
<e-messages>
<e-message text="Hi, how are you?" [author]="currentUserModel"></e-message>
<e-message text="Great! How can I help?" [author]="michaleUserModel"></e-message>
</e-messages>
</div>
`,
styles: [`
#chatui {
height: 500px;
width: 100%;
}
`]
})
export class AppComponent {
public currentUserModel: UserModel = { user: 'Albert', id: 'user1' };
public michaleUserModel: UserModel = { user: 'Michale', id: 'user2' };
}
Installation:
npm install @syncfusion/ej2-angular-interactive-chat
CSS Import (src/styles.css):
@import "../node_modules/@syncfusion/ej2-material3-theme/styles/chat-ui/index.css";
Key Components and Props
Core Component:
<ejs-chatui> - Main chat container
[user] - Current user model (UserModel)
[messages] - Message collection
headerText - Header title
[headerToolbar] - Header toolbar with custom actions
[height] / [width] - Dimensions
[enableAttachments] - File upload support
[enablePersistence] - State persistence across sessions
[enableRtl] - Right-to-left layout
[attachmentSettings] - File upload configuration
[messageToolbarSettings] - Message-level toolbar
[suggestions] - Quick reply suggestions
[suggestionTemplate] - Custom suggestion rendering
Message Element:
<e-message> - Individual message
text - Message content
[author] - User who sent message
[timeStamp] - Message timestamp
[timeStampFormat] - Custom timestamp format
[isPinned] - Pin importance
[replyTo] - Thread context (MessageReplyModel)
[isForwarded] - Forwarded indicator
[attachedFile] - Pre-populated file attachments (FileInfo)
[status] - Message delivery status (MessageStatusModel)
[mentionUsers] - Users mentioned in message
User Model Properties:
id - Unique user identifier
user - Display name
avatarUrl - Avatar image
avatarBgColor - Avatar background color
statusIconCss - Presence status icon
Common Use Cases
1. Customer Support Chat
- Configure header with support team name
- Enable file attachments for screenshots/documents
- Use message status for delivery tracking
- Integrate with Dialogflow for AI-powered responses
2. Team Messaging App
- Multiple users with presence status
- Mention teammates with @mentions
- Pin important decisions/announcements
- Use timestamp format for timezone support
3. AI Assistant
- Integrate with Microsoft Bot Framework or Dialogflow
- Show typing indicator while bot responds
- Suggest quick replies with suggestions array
- Handle bot-specific message formatting
4. Load Performance
- Enable load on demand for 1000+ message conversations
- Implement auto-scroll for smooth scrolling
- Use compact mode to reduce vertical space
- Lazy load attachments and media
5. Internationalization (i18n)
- Provide localized typing indicators ("X is typing")
- Enable RTL for Arabic/Hebrew/Persian users
- Customize date/time format per locale
- Translate button labels and placeholders
1---2name: syncfusion-angular-chat-ui3description: Implement the Syncfusion Angular Chat UI component. Use this skill whenever users need to implement messaging, real-time conversations, file attachments, typing indicators, user mentions, or bot integrations (Dialogflow, Microsoft Bot Framework) in Angular applications. Essential for customer support chatbots, team messaging apps, AI-powered assistants, and collaborative communication interfaces.4---56# Syncfusion Angular Chat UI Component78## Component Overview910The Syncfusion Angular Chat UI component provides a complete, feature-rich solution for building conversational interfaces in Angular applications. It enables real-time messaging, user presence indicators, file attachments, typing indicators, and seamless integration with bot frameworks and AI services.1112**Key Capabilities:**13- **Message Management** - Configure messages with text, rich templates, media, replies, pinning, and forwarding14- **User System** - Define current user, presence status, avatars with custom styling and mentions15- **Appearance Control** - Customize width, height, placeholder, CSS classes, compact mode, and suggestions16- **Header & Footer** - Control visibility, titles, icons, custom templates, and header toolbar with actions17- **Events & Interactions** - Handle message send, typing indicators, toolbar actions (copy, reply, pin, delete)18- **Templates** - Customize empty chat, messages, time breaks, typing indicators, and suggestion items19- **File Attachments** - Enable uploads with type/size restrictions, drag-and-drop, custom paths, attachment click events20- **Methods** - Programmatically add/update messages, scroll to bottom, scroll to specific message, focus input21- **Globalization** - Support multiple languages (i18n), RTL text direction, and locale-based formatting22- **Advanced Features** - Load on demand, state persistence, mentions, message status, time breaks, bot integrations2324## Documentation and Navigation Guide2526### Getting Started27📄 **Read:** [references/getting-started.md](references/getting-started.md)28- Installation and package setup (Ivy vs ngcc)29- Setup Angular environment with Angular CLI30- Basic component initialization31- Configuring messages and users32- CSS imports and theme configuration33- Running the application3435### Messages and Users36📄 **Read:** [references/messages-and-users.md](references/messages-and-users.md)37- Message configuration and properties (text, id, author, timestamp)38- User models and avatars39- Defining current user with unique identifier40- Avatar URLs and custom background colors41- User presence status (online, offline, away, busy)42- Message pinning for important messages43- **Enhanced MessageReplyModel** with complete interface documentation44- **Reply with attachments** and timestamp formatting45- **Dynamic reply creation** patterns46- Message forwarding47- Compact mode for group conversations48- Markdown message support4950### Appearance and Layout51📄 **Read:** [references/appearance-and-layout.md](references/appearance-and-layout.md)52- Placeholder text customization53- Width and height properties54- CSS class customization for styling55- Compact mode configuration56- Auto-scroll to bottom behavior57- Suggestions display for quick replies5859### Header and Footer60📄 **Read:** [references/header-and-footer.md](references/header-and-footer.md)61- Header visibility control62- Header text (title) configuration63- Header icon customization with CSS classes64- **Header toolbar with custom actions** (call, video, settings, profile)65- **ToolbarSettingsModel configuration** with items and itemClicked event66- Footer visibility and control67- Footer template for custom layouts6869### Events and Interactions70📄 **Read:** [references/events-and-interactions.md](references/events-and-interactions.md)71- Component lifecycle events (created)72- Message send event handling73- User typing event and typing indicators74- Message toolbar configuration75- **Complete ToolbarItemModel properties** (align, cssClass, disabled, iconCss, tabIndex, template, text, tooltip, type, visible)76- Toolbar items customization (copy, reply, pin, delete, forward)77- Item click event handling78- Toolbar width configuration79- Before/after attachment events80- **Header toolbar vs message toolbar differences**8182### Templates and Content83📄 **Read:** [references/templates-and-content.md](references/templates-and-content.md)84- Message template customization85- Empty chat template for initial state86- Time break template for date separators87- Message status and delivery icons88- Timestamp display and visibility89- Timestamp format customization (dd/MM/yyyy hh:mm a)90- **Suggestion template customization** with context variables (index, suggestion)91- **Advanced suggestion examples** (category-based, search-highlighted, icon-based)92- Typing indicator template9394### Attachments and File Handling95📄 **Read:** [references/attachments-and-file-handling.md](references/attachments-and-file-handling.md)96- Enable file attachment support97- Attachment settings configuration98- Server endpoints (saveUrl, removeUrl)99- File type restrictions and filters100- File size limits (default 30MB)101- **SaveFormat enum** (Blob vs Base64) with advantages and use cases102- **Custom storage paths** with path property for CDN/cloud storage103- Drag-and-drop file upload104- Maximum file count restrictions105- File preview templates106- Attachment templates107- **attachmentClick event** for custom file interactions (preview, download, metadata)108- **attachedFile property** for pre-populating messages with files109- Upload event handling (success, failure)110111### Methods and Programmatic Control112📄 **Read:** [references/methods-and-programmatic-control.md](references/methods-and-programmatic-control.md)113- addMessage() - Add new messages programmatically114- updateMessage() - Edit existing messages115- scrollToBottom() - Scroll to latest messages116- **scrollToMessage(messageId)** - Navigate to specific message (pinned messages, search results, deep linking)117- **focus()** - Set focus to chat input programmatically (auto-focus, modal close, command execution)118- ViewChild component access119- Accessing chat instance for direct control120121### Globalization and Localization122📄 **Read:** [references/globalization-and-localization.md](references/globalization-and-localization.md)123- Localization (L10n) and i18n support124- Typing indicator translations125- Multiple language support126- Right-to-Left (RTL) layout for Arabic, Hebrew, Persian127- Locale configuration128- Language-specific string customization129130### Advanced Features131📄 **Read:** [references/advanced-features.md](references/advanced-features.md)132- **State persistence** with enablePersistence (localStorage, cross-tab sync, browser refresh protection)133- **Custom persistence implementations** for sensitive data134- Load on demand for large message histories (1000+ messages)135- Mention integration with @character136- Trigger character customization137- Predefined mentions in messages138- mentionSelect event handling139- Message status tracking (sent, delivered, read)140- Time breaks between messages for date organization141142### Bot Integrations143📄 **Read:** [references/bot-integrations.md](references/bot-integrations.md)144- Google Dialogflow integration for AI conversations145- Microsoft Bot Framework integration with Azure146- Direct Line API configuration147- Token server setup for security148- Backend API configuration149- Secure credential handling150- Bot response message handling151- Session management152153---154155## Quick Start Example156157Here's a minimal example to get started:158159```typescript160import { Component } from '@angular/core';161import { ChatUIModule } from '@syncfusion/ej2-angular-interactive-chat';162import { UserModel } from '@syncfusion/ej2-interactive-chat';163164@Component({165 imports: [ChatUIModule],166 standalone: true,167 selector: 'app-root',168 template: `169 <div id="chatui" ejs-chatui 170 [user]="currentUserModel" 171 headerText="TeamSync Professionals">172 <e-messages>173 <e-message text="Hi, how are you?" [author]="currentUserModel"></e-message>174 <e-message text="Great! How can I help?" [author]="michaleUserModel"></e-message>175 </e-messages>176 </div>177 `,178 styles: [`179 #chatui {180 height: 500px;181 width: 100%;182 }183 `]184})185export class AppComponent {186 public currentUserModel: UserModel = { user: 'Albert', id: 'user1' };187 public michaleUserModel: UserModel = { user: 'Michale', id: 'user2' };188}189```190191**Installation:**192```bash193npm install @syncfusion/ej2-angular-interactive-chat194```195196**CSS Import (src/styles.css):**197```css198@import "../node_modules/@syncfusion/ej2-material3-theme/styles/chat-ui/index.css";199```200201---202203## Key Components and Props204205**Core Component:**206- `<ejs-chatui>` - Main chat container207 - `[user]` - Current user model (UserModel)208 - `[messages]` - Message collection209 - `headerText` - Header title210 - `[headerToolbar]` - Header toolbar with custom actions211 - `[height]` / `[width]` - Dimensions212 - `[enableAttachments]` - File upload support213 - `[enablePersistence]` - State persistence across sessions214 - `[enableRtl]` - Right-to-left layout215 - `[attachmentSettings]` - File upload configuration216 - `[messageToolbarSettings]` - Message-level toolbar217 - `[suggestions]` - Quick reply suggestions218 - `[suggestionTemplate]` - Custom suggestion rendering219220**Message Element:**221- `<e-message>` - Individual message222 - `text` - Message content223 - `[author]` - User who sent message224 - `[timeStamp]` - Message timestamp225 - `[timeStampFormat]` - Custom timestamp format226 - `[isPinned]` - Pin importance227 - `[replyTo]` - Thread context (MessageReplyModel)228 - `[isForwarded]` - Forwarded indicator229 - `[attachedFile]` - Pre-populated file attachments (FileInfo)230 - `[status]` - Message delivery status (MessageStatusModel)231 - `[mentionUsers]` - Users mentioned in message232233**User Model Properties:**234- `id` - Unique user identifier235- `user` - Display name236- `avatarUrl` - Avatar image237- `avatarBgColor` - Avatar background color238- `statusIconCss` - Presence status icon239240---241242## Common Use Cases243244**1. Customer Support Chat**245- Configure header with support team name246- Enable file attachments for screenshots/documents247- Use message status for delivery tracking248- Integrate with Dialogflow for AI-powered responses249250**2. Team Messaging App**251- Multiple users with presence status252- Mention teammates with @mentions253- Pin important decisions/announcements254- Use timestamp format for timezone support255256**3. AI Assistant**257- Integrate with Microsoft Bot Framework or Dialogflow258- Show typing indicator while bot responds259- Suggest quick replies with suggestions array260- Handle bot-specific message formatting261262**4. Load Performance**263- Enable load on demand for 1000+ message conversations264- Implement auto-scroll for smooth scrolling265- Use compact mode to reduce vertical space266- Lazy load attachments and media267268**5. Internationalization (i18n)**269- Provide localized typing indicators ("X is typing")270- Enable RTL for Arabic/Hebrew/Persian users271- Customize date/time format per locale272- Translate button labels and placeholders273274---