Component Overview
The Syncfusion AI AssistView is a powerful Angular component that provides a ready-to-use interface for building conversational AI applications.
Key Capabilities:
- Conversation Management - Manage prompt-response pairs with history, persistence, and markdown rendering
- AI Service Integration - Connect to OpenAI, Gemini, Ollama, Lite-LLM, and MCP providers with streaming support
- Chain of Thoughts - Visualize AI reasoning as collapsible thinking blocks with multi-stage, dynamic status updates via the injectable
AssistThinkingmodule - Generative UI - Render interactive tools, charts, and custom components within AI responses using
blocksandregisterToolUI - Speech Features - Built-in speech-to-text with 11 configurable properties and 4 events
- Toolbar System - Four toolbar types (header, prompt, response, footer) with custom actions and tag directives
- Telemetry - Built-in per-response telemetry button with metrics (status, duration, tool calls, tokens, model),
beforeReportevent for customization, and aTelemetryDataargument onaddPromptResponseto surface usage data - Mentions - Trigger-character-based mention picker in the prompt editor with local or
DataManagerdata sources, filtering, highlighting, popup sizing, and display/item/no-records templates - View Management - Multiple views with programmatic
activeViewcontrol and dynamic switching - Events & Interactions - Typed event arguments (PromptRequestEventArgs, PromptChangedEventArgs, StopRespondingEventArgs)
- File Attachments - Support for file uploads with type/size restrictions and the full attachment lifecycle events:
beforeAttachmentUpload,attachmentUploadSuccess,attachmentUploadFailure,attachmentRemoved,attachmentRemoving, andattachmentClick - Templates - Customize prompts, responses, suggestions, banners, footers, and response animations with flexible templates including a per-response
responseAnimationTemplatefor branded loading states - Methods - Programmatically add/update responses, execute prompts, and control component behavior
- Globalization - Full RTL support and localization for 12+ languages with locale-based formatting
- Customizable UI - Height, width, CSS classes, HTML attributes, and theme customization
Documentation and Navigation Guide
Getting Started
📄 Read: references/getting-started.md
- Installation and dependency setup
- Angular environment configuration
- Basic component initialization
- CSS imports and theme configuration
- First working example
Core Features & Conversation Management
📄 Read: references/assist-view-basics.md
- Setting prompt text and placeholders
- Managing prompt-response collections
- Markdown response rendering
- Configuring prompt suggestions
- Customizing user and assistant avatars
- UI controls (clear button, scroll-to-bottom)
- Component configuration (height, width, showHeader, cssClass, htmlAttributes)
- State persistence with
enablePersistence - Globalization and localization (locale property with 12+ languages)
- RTL support with
enableRtlfor Arabic, Hebrew, Persian, Urdu
Appearance & Styling
📄 Read: references/appearance-customization.md
- Setting component width and height
- Applying custom CSS classes
- Theme customization
- Responsive design patterns
Multiple Views & Custom Content
📄 Read: references/custom-views.md
- Adding custom view models
- View types (Assist and Custom)
- View configuration and naming
- Managing multiple views within one component
- Programmatic view switching with
activeViewproperty - Dynamic view navigation patterns
- View history and breadcrumb navigation
- Workflow-based view switching
- Conditional view display based on user roles
Programmatic Control & Methods
📄 Read: references/methods-and-actions.md
- Adding prompt responses (string and object
- Complete event arguments reference section
- PromptRequestEventArgs with 6 properties (prompt, attachedFiles, promptSuggestions, cancel, etc.)
- PromptChangedEventArgs with 5 properties (value, previousValue, element, event)
- StopRespondingEventArgs for canceling responses
- AttachmentClickEventArgs with FileInfo interface
- Production-ready examples with all event types formats)
- Executing prompts dynamically
- Response handling patterns
- Programmatic interaction
Chain of Thoughts
📄 Read: references/chain-of-thoughts.md
- Enabling reasoning visualization with the injectable
AssistThinkingmodule - Thinking block configuration (
blocksproperty,blockType: 'thinking') - Streaming multi-step reasoning with
addPromptResponseandisFinalUpdate - Adding stages with the
stagesarray andThinkingStageproperties - Stage status indicators (
completed,inprogress,failed) - Inline context items with
editableContextand{index}placeholders - Handling the
editableContextClickedevent - Customizing rendering with
blockTemplateanditemTemplate
Generative UI
📄 Read: references/generative-ui.md
- Registering custom tools with
registerToolUI(toolName, template, handler) - Configuring tool templates and interactive handler functions
- Adding
toolblocks to responses viaaddPromptResponse(toolName,props) - Configuring the AI service system prompt to return structured
blocksJSON - Chaining follow-up prompts with
executePromptafter tool interaction - Complete production example: recipe builder with custom and chart-based tools
Text to Speech
📄 Read: references/text-to-speech.md
- Enabling built-in Text-to-Speech with the
e-assist-audioresponse toolbar item - Reading AI responses aloud via the browser's
SpeechSynthesisUtteranceAPI - Customizing speech behavior with
textToSpeechSettings(language, speechPitch, speechRate, volume, voice)
Telemetry
📄 Read: references/telemetry.md
- Enabling per-response telemetry with
telemetrySettings.enable - Filtering captured metrics with the
metricsarray (status,duration,toolCalls,streamingChunks,model,inputTokens,outputTokens,totalTokens,reasoningTokens,cachedInputTokens) - Customizing the report with the
beforeReportevent (mutate, augment withcustomAttributes, or returnnullto suppress) - Surfacing model and token usage via the optional
TelemetryDataargument toaddPromptResponse - Passing domain-specific metrics through
TelemetryData.customAttributes - Key behaviors: turn tracking, telemetry button states, duration formatting, metrics filter precedence, and regenerate flow
Mentions
📄 Read: references/mentions.md
- Configuring the mention trigger character with
mentionChar(e.g.@for agents,/for commands) - Registering multiple mention configurations on a single component (the
mentionsarray) - Using local arrays or
DataManagerinstances with thedataSourceproperty - Mapping object-based sources with
fieldsand applying additional filters withQuery - Controlling match behavior via
filterType(Contains,StartsWith,EndsWith) andhighlight - Showing or hiding the trigger character in the editor with
showMentionChar - Customizing popup dimensions with
popupWidth/popupHeight - Customizing rendering with
displayTemplate,itemTemplate, andnoRecordsTemplate - Reacting to selections via the
mentionSelectevent andMentionSelectEventArgs
Complete documentation for all 4 toolbar types
- Header Toolbar (
toolbarSettings) - Global actions and navigation - Prompt Toolbar (
promptToolbarSettings) - Actions on user prompts - Response Toolbar (
responseToolbarSettings) - Actions on AI responses - Footer Toolbar (
footerToolbarSettings) - Input area customization - ToolbarItemModel interface with 10 properties
- ToolbarItemClickedEventArgs with dataIndex handling
- Tag directive approach:
<e-toolbarsettings>,<e-toolbaritem> - Property binding approach for dynamic toolbar items
- Common patterns, best practices, and troubleshootingest, promptChanged)
- File upload events (beforeAttachmentUpload, attachmentUploadSuccess, attachmentUploadFailure, attachmentRemoved, attachmentRemoving)
- Event arguments:
PromptRequestEventArgs,PromptChangedEventArgs,StopRespondingEventArgs,AttachmentClickEventArgs,RemovingEventArgs(from@syncfusion/ej2-inputs) - Event handling patterns and best practices
File Attachments
📄 Read: references/file-attachments.md
- File attachment configuration
- Upload handling and validation
- File size and type restrictions
- Attachment display and management
- Custom attachment templates (attachmentTemplate)
Toolbar Configuration
📄 Read: references/toolbar-items.md
- Toolbar customization
- Built-in speech-to-text with
speechToTextSettings(recommended approach) - SpeechToTextSettingsModel with 11 configurable properties
- ButtonSettingsModel and TooltipSettingsModel interfaces
- 4 speech events: onStart, onStop, transcriptChanged, onError
- Event arguments: StartListeningEventArgs, StopListeningEventArgs, TranscriptChangedEventArgs, ErrorEventArgs
- Language support with 10+ language codes (en-US, es-ES, fr-FR, de-DE, ja-JP, etc.)
- Interim results handling with
allowInterimResults - Custom Web Speech API implementation (alternative approach)
- Text-to-speech setup and configuration
- Browser compatibility and error handling
- Regenerate responses with
e-assist-regenerateicon, response navigation UI, and theregeneratedResponsesproperty - Toolbar item alignment with the
alignproperty (Left,Center,Right) — available on everyToolbarItemModeland across all four toolbar types
Templates & Custom Rendering
📄 Read: references/templates.md
- Template system overview
- Prompt templates
- Response templates
- Response animation template (
responseAnimationTemplate) for branded loading states shown while a response is being generated and removed onceaddPromptResponse()is called - Custom template creation
AI Service Integration
📄 Read: references/ai-integrations.md
- Azure OpenAI integration setup
- Gemini integration
- Lite-LLM integration
- Model Context Protocol (MCP) integration
- Ollama integration
- Security best practices and API management
Speech Features
📄 Read: references/speech-features.md
- Speech-to-text setup and configuration
- Text-to-speech setup and configuration
- Audio handling
- Browser compatibility considerations
Methods (Generative UI)
| Method | Description |
|---|---|
registerToolUI({ toolName, template, handler }) |
Registers a tool's rendering template and optional interaction handler. Call before referencing the tool in any response. |
executePrompt(prompt) |
Programmatically triggers a new prompt/response cycle, useful for chaining follow-up AI responses after a tool interaction. |
Quick Start Example
Here's a minimal working example to get started:
import { Component } from '@angular/core';
import { AIAssistViewModule } from '@syncfusion/ej2-angular-interactive-chat';
@Component({
imports: [AIAssistViewModule],
standalone: true,
selector: 'app-root',
template: `
<div ejs-aiassistview
id='aiAssistView'
[promptSuggestions]="suggestions"
(promptRequest)="onPromptRequest($event)">
</div>
`,
styles: [`
:host ::ng-deep #aiAssistView {
height: 100vh;
}
`]
})
export class AppComponent {
suggestions = [
'What is Angular?',
'How to create components?',
'Explain dependency injection'
];
onPromptRequest(args: any) {
// Handle prompt and provide response
setTimeout(() => {
const response = 'This is a sample response from your AI service.';
// Add response using component method
}, 1000);
}
}
Common Patterns
Pattern 1: Basic Conversation Flow
- Initialize component with suggestions
- User enters prompt
promptRequestevent fires- Call your AI service
- Use
addPromptResponse()to display result - Conversation history maintained automatically
Pattern 2: AI Service Integration with Streaming
- Enable streaming with
[enableStreaming]="true" - Configure AI provider credentials (OpenAI, Gemini, etc.)
- In
promptRequestevent, call provider API with streaming - Use
ReadableStreamfor chunked responses - Handle
stopRespondingClickevent for cancellation - Update UI with
addPromptResponse()incrementally
Pattern 3: Custom View Management with activeView
- Define multiple view types (Assist, Custom)
- Use
[activeView]="currentIndex"to control display - Switch between views programmatically based on user action
- Track view history for back/forward navigation
- Each view can have different configuration
- Maintain separate state per view
Pattern 4: Complete Toolbar Configuration
- Configure header toolbar for global actions (new chat, export, settings)
- Set up prompt toolbar for user prompt actions (edit, copy, retry)
- Add response toolbar for AI response actions (copy, regenerate, like/dislike)
- Configure footer toolbar for input actions (formatting, attachments)
- Use tag directive or property binding approach
- Handle
itemClickedevents withdataIndexfor context - Use the
alignproperty on eachToolbarItemModelto position primary actions on theLeftand secondary actions (Settings, Export) on theRight
Pattern 5: Speech-Enabled Interface
- Configure
speechToTextSettingswith language and options - Enable
allowInterimResultsfor real-time transcription - Handle speech events:
onStart,onStop,transcriptChanged,onError - Automatically submit recognized text as prompts
- Provide visual feedback during listening state
Pattern 6: Event-Driven Actions with Typed Arguments
- Use
PromptRequestEventArgsto access prompt, attachedFiles, and cancel flag - Use
PromptChangedEventArgsfor real-time input validation - Handle
StopRespondingEventArgsto cancel long-running requests - Use
beforeAttachmentUploadfor file validation - Use
editableContextClickedfor inline context badge interactions
Pattern 7: Chain of Thoughts (Reasoning Visualization)
- Inject the
AssistThinkingmodule viaAIAssistView.Inject(AssistThinking) - Push
blockswithblockType: 'thinking'viaaddPromptResponse, usingisFinalUpdate: falsewhile streaming - Update
stages[].status(inprogress→completed/failed) as reasoning progresses - Use
editableContextwith{index}placeholders for clickable inline references - Deliver the final
responsetext alongside the lastisFinalUpdate: truecall - Optionally customize rendering with
blockTemplate(full block) oritemTemplate(per-stage)
Pattern 8: Generative UI (Interactive Tools in Responses)
- Register each tool once via
registerToolUI({ toolName, template, handler }), typically inngAfterViewInit - Reference registered tools in responses using
blocks: [{ blockType: 'tool', toolName, props }] - Combine
textandtoolblocks in the sameblocksarray for narrative + interactive content - Configure the AI system prompt to return a structured
blocksJSON array for dynamic tool invocation - Use
executePromptto trigger a follow-up AI response after a user interacts with a rendered tool - Parse AI-returned JSON defensively and fall back to plain text on malformed output
Pattern 9: Telemetry for AI Response Metrics
- Enable the telemetry button by setting
telemetrySettings = { enable: true } - Use the
metricsarray ontelemetrySettingsto choose which metrics are captured and to control the row order in the tooltip (e.g.['duration', 'model', 'inputTokens', 'outputTokens', 'totalTokens']) - Pass the optional
TelemetryDataargument toaddPromptResponse(response, isFinalUpdate, telemetryData)to surfacemodel,inputTokens,outputTokens,reasoningTokens, andcachedInputTokens;totalTokensis auto-computed - Use the
beforeReport(report)event to add domain-specific entries viareport.customAttributes, or returnnullto suppress the report - Hover the telemetry button on any response to inspect the rendered tooltip —
statusanddurationare always shown, andcustomAttributesare always included regardless of themetricsfilter
Pattern 10: Mention Picker in the Prompt Editor
- Define local arrays (or
DataManagerinstances) for each mention group (e.g. agents, commands, knowledge items) - Build a
mentionsarray on the component, with one entry per trigger:{ mentionChar: '@', dataSource, fields: { text, value } }and optionalfilterType,query,highlight,popupWidth/Height, and templates - Pass the array to the component via
[mentions]="mentions"and set a helpfulpromptPlaceholderthat hints at the available triggers - Use
showMentionChar: falsefor slash-style commands so the/is not retained in the inserted mention - Customize appearance with
itemTemplate(popup rows),displayTemplate(selected chip), andnoRecordsTemplate(empty state) - React to selections via the
mentionSelectevent or per-mentionmentionSelectcallback to capture the chosen item and act on it
Key Properties
| Property | Type | Default | When to Use |
|---|---|---|---|
prompt |
string | '' |
Pre-fill prompt text |
promptPlaceholder |
string | 'Type prompt for assistance...' |
Guide user input |
promptSuggestions |
string[] | [] |
Provide quick starting prompts |
prompts |
object[] | [] |
Initialize conversation history |
showClearButton |
boolean | false |
Show button to clear input |
enableScrollToBottom |
boolean | true |
Show scroll-to-bottom indicator |
blockTemplate |
string | object | '' |
Customize rendering of thinking blocks |
itemTemplate |
string | object | '' |
Customize rendering of individual thinking stage items |
responseAnimationTemplate |
string | object | '' |
Customize the loading indicator/animation shown in place of a response while it is being generated |
Layout & Appearance
| Property | Type | Default | When to Use |
|---|---|---|---|
width |
string | number | '100%' |
Set container width |
height |
string | number | '100%' |
Set container height |
cssClass |
string | '' |
Apply custom CSS styling and themes |
showHeader |
boolean | true |
Control header visibility |
htmlAttributes |
object | {} |
Add custom HTML attributes (aria-, data-, etc.) |
Streaming & Features
| Property | Type | Default | When to Use |
|---|---|---|---|
enableStreaming |
boolean | false |
Enable real-time streaming responses |
speechToTextSettings |
SpeechToTextSettingsModel | null |
Configure built-in speech recognition |
textToSpeechSettings |
TextToSpeechSettingsModel |
null |
Configure built-in Text-to-speech support |
activeView |
number | 0 |
Programmatically switch between views |
telemetrySettings |
TelemetrySettingsModel |
null |
Track per-response AI metrics (enable, metrics, beforeReport) and surface a telemetry button in the response toolbar |
mentions |
MentionSettings[] |
null |
Configure trigger-character mention pickers in the prompt editor (data source, fields, query, filter type, templates) |
Globalization
| Property | Type | Default | When to Use |
|---|---|---|---|
locale |
string | 'en-US' |
Set language/culture (en-US, es-ES, fr-FR, de-DE, ja-JP, ar-SA, etc.) |
enableRtl |
boolean | false |
Enable right-to-left text direction (Arabic, Hebrew, Persian, Urdu) |
enablePersistence |
boolean | false |
Save component state between page reloads |
Toolbar Configuration
| Property | Type | Default | When to Use |
|---|---|---|---|
toolbarSettings |
ToolbarSettingsModel | null |
Configure header toolbar (global actions) |
promptToolbarSettings |
PromptToolbarSettingsModel | null |
Configure prompt toolbar (edit, copy, retry) |
responseToolbarSettings |
ResponseToolbarSettingsModel | null |
Configure response toolbar (copy, regenerate, like/dislike) |
footerToolbarSettings |
FooterToolbarSettingsModel | null |
Configure footer toolbar (formatting, attachments) |
Common Use Cases
- Customer Support Chatbot: Build customer service interfaces with knowledge base integration
- Code Assistant: Create coding helpers with AI that can review and suggest code
- Content Writer Assistant: Implement writing tools with grammar and style suggestions
- Data Analysis Tool: Create interfaces for users to query and analyze data through natural language
- Learning Platform: Build educational assistants that answer student questions
- Internal Knowledge Bot: Create enterprise assistants for company documentation and FAQs
- Multi-language Support: Implement translation and localization features
- Accessibility Assistant: Provide reading aid or instruction assistance
- Reasoning Visualization: Build interfaces that surface AI reasoning via collapsible Chain of Thoughts blocks
- Generative UI Applications: Render interactive tools and charts (cards, gauges, custom widgets) inline within AI responses
- Per-Response Telemetry: Surface duration, model, and token usage on every AI response with
telemetrySettingsand theTelemetryDataargument toaddPromptResponse - Usage-Aware Analytics: Augment telemetry reports with
customAttributes(region, tenant, sessionId, feature) for tenant/feature-level analytics in the response toolbar tooltip - Agent Routing with Mentions: Use
@mentions to route a prompt to a specific agent (TechSupport, HRAssistant, KnowledgeBase) and parseargs.itemDatain thementionSelectevent to pre-load agent context before sending - Slash Commands with Mentions: Use
/mentions (withshowMentionChar: false) to expose quick actions like/table,/rewrite,/checklistthat transform how the AI service responds - Remote Knowledge Picker: Bind the mention
dataSourceto aDataManagerand apply aQuery(with paging/filtering) so users can search and insert items from a large remote catalog - Branded Loading States: Use
responseAnimationTemplateto show a custom loader, branded spinner, or progress indicator while the AI response is being generated — the template is removed automatically onceaddPromptResponse()is called - Aligned Toolbar Layouts: Use the
alignproperty on eachToolbarItemModelto position primary actions (Left), centered quick actions (Center), and secondary actions like Settings/Export (Right) — works across all four toolbar types - Confirm or Cancel Attachment Removal: Use the
attachmentRemovingevent (withRemovingEventArgs) to intercept a file removal before it happens — setargs.cancel = trueto keep the file attached, or perform cleanup (revoke object URLs, free preview state) before the file is detached