alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class AssistViewSettings

    Represents the configuration for the native AI Assistant (AssistView) in Syncfusion.Blazor.SmartRichTextEditor.AssistViewSettings.SfSmartRichTextEditor. Enables seamless, real-time AI-powered content creation, editing, and formatting directly inside the editor.

    Inheritance
    object
    AssistViewSettings
    Namespace: Syncfusion.Blazor.SmartRichTextEditor
    Assembly: Syncfusion.Blazor.SmartRichTextEditor.dll
    Syntax
    public class AssistViewSettings : SfBaseComponent
    Remarks

    This class powers the SfAIAssistView integration, delivering: • Native AI content generation without leaving the editor
    • Contextual prompts based on selection or full document
    • Streaming responses with stop control and final update signaling
    • Atomic, reversible Insert operations
    • Full conversation history with programmatic access and export
    • Custom branding, toolbar, templates, and enterprise compliance features

    Constructors

    AssistViewSettings()

    Declaration
    public AssistViewSettings()

    Properties

    AIPopupClosing

    Triggers before the AI Assist popup closes.

    Declaration
    [Parameter]
    public EventCallback<BeforeCloseEventArgs> AIPopupClosing { get; set; }
    Property Value
    Type
    EventCallback<BeforeCloseEventArgs>

    AIPopupOpening

    Triggers before the AI Assist popup opens.

    Declaration
    [Parameter]
    public EventCallback<BeforeOpenEventArgs> AIPopupOpening { get; set; }
    Property Value
    Type
    EventCallback<BeforeOpenEventArgs>

    AIPromptRequested

    Triggers when user submits a prompt in the AI Assist.

    Declaration
    [Parameter]
    public EventCallback<AssistViewPromptRequestedEventArgs> AIPromptRequested { get; set; }
    Property Value
    Type
    EventCallback<AssistViewPromptRequestedEventArgs>

    AIResponseStopped

    Triggers when user clicks "Stop generating" during streaming.

    Declaration
    [Parameter]
    public EventCallback<ResponseStoppedEventArgs> AIResponseStopped { get; set; }
    Property Value
    Type
    EventCallback<ResponseStoppedEventArgs>

    AIToolbarItemClicked

    Triggers when a toolbar item is clicked in the AI Assist (Close, Edit, Insert, etc.).

    Declaration
    [Parameter]
    public EventCallback<AssistViewToolbarItemClickedEventArgs> AIToolbarItemClicked { get; set; }
    Property Value
    Type
    EventCallback<AssistViewToolbarItemClickedEventArgs>

    BannerTemplate

    Gets or sets the custom banner template displayed at the top of the AI Assistant sidebar. Used for branding, connection status, real-time streaming indicators, usage metrics, or compliance notices.

    Declaration
    [Parameter]
    public RenderFragment? BannerTemplate { get; set; }
    Property Value
    Type Description
    RenderFragment

    A RenderFragment that defines the banner content.

    Remarks

    Fully supports HTML, CSS, dynamic binding, and runtime updates via AIAssistantBannerUpdate event.

    Recommended enterprise use cases:

    • Company logo and product name
    • Connection status (Connected / Processing / Offline)
    • Real-time streaming indicator
    • Token usage or cost tracking (if exposed by backend)
    • Compliance banners (e.g., GDPR, HIPAA, Internal Use Only)
    • Persona-specific headers (Content Manager, Technical Writer, Developer)
    Examples
    <SfSmartRichTextEditor>
        <AssistViewSettings BannerTemplate="@CustomBanner" />
    </SfSmartRichTextEditor>
    
    @code {
        private RenderFragment CustomBanner => __builder =>
        {
            <div class="custom-banner">
                <div class="logo">
                    <img src="/images/company-logo.svg" alt="Company Logo" />
                </div>
                <div class="title">
                    <h3>Smart AI Assistant</h3>
                    <span>Real-time streaming • Secure enterprise connection</span>
                </div>
                <div class="status live">● Live</div>
            </div>
        };
    }

    ChildContent

    Renders the child element

    Declaration
    [Parameter]
    public RenderFragment? ChildContent { get; set; }
    Property Value
    Type
    RenderFragment

    Commands

    Gets or sets the full menu of AI commands (predefined actions) shown in the dropdown. Includes Edit & Improve, Change Tone, Translate, etc. Fully customizable with nested groups. Use {selection} to inject selected text.

    Declaration
    [Parameter]
    public List<AICommands> Commands { get; set; }
    Property Value
    Type Description
    List<AICommands>

    List of AICommands defining the entire command hierarchy.

    Examples
    <SfSmartRichTextEditor>
        <AssistViewSettings Commands="@MyCustomCommands" />
    </SfSmartRichTextEditor>
    
    @code {
        private List<AICommands> MyCustomCommands = new()
        {
            new AICommands { Text = "Generate Code", Prompt = "Write C# code for: {selection}" },
            new AICommands { Text = "Document API", Prompt = "Generate XML docs for this method: {selection}" }
        };
    }

    HeaderToolbarSettings

    Gets or sets the configuration for the toolbar that appears in the header of the AI Assistant sidebar. Allows definition of toolbar items using AssistViewToolbarItem objects with full customization support. By default it includes Close button actions.

    Declaration
    [Parameter]
    public RenderFragment? HeaderToolbarSettings { get; set; }
    Property Value
    Type Description
    RenderFragment

    A RenderFragment containing AssistViewToolbar and AssistViewToolbarItem child elements that define the header toolbar structure and appearance.

    Remarks

    Use this property to completely customize the header toolbar layout, actions, and styling. Toolbar items can include:

    • Spacer items for layout control
    • Close buttons for sidebar dismissal
    • Menu items for additional options
    • Custom action buttons for enterprise workflows
    • Profile or status indicators

    Each AssistViewToolbarItem supports:

    • Text — Display text for the item
    • IconCss — CSS class for the icon
    • Tooltip — Hover tooltip text
    • Type — Item type (e.g., Spacer, Separator)
    • Template — Custom RenderFragment for complex rendering
    Examples
    <SfSmartRichTextEditor Height="600px">
        <AssistViewSettings PopupWidth="500px">
            <HeaderToolbarSettings>
                <AssistViewToolbarItem Type="ItemType.Spacer" />
                <AssistViewToolbarItem Text="Close" IconCss="e-icons e-close" Tooltip="Close AI Assistant" />
                <AssistViewToolbarItem IconCss="e-icons e-user" Tooltip="Profile" />
            </HeaderToolbarSettings>
        </AssistViewSettings>
    </SfSmartRichTextEditor>

    MaxPromptHistory

    Gets or sets maximum number of saved conversations in history (oldest removed first).

    Declaration
    [Parameter]
    public int MaxPromptHistory { get; set; }
    Property Value
    Type Description
    int

    Maximum history entries.

    Examples
    <SfSmartRichTextEditor>
        <AssistViewSettings MaxPromptHistory="100" />
    </SfSmartRichTextEditor>

    Placeholder

    Gets or sets the placeholder text in the AI prompt input field.

    Declaration
    [Parameter]
    public string Placeholder { get; set; }
    Property Value
    Type Description
    string

    Placeholder guidance text.

    Examples
    <SfSmartRichTextEditor>
        <AssistViewSettings Placeholder="How can I improve this document?" />
    </SfSmartRichTextEditor>

    PopupMaxHeight

    Gets or sets the height of the AI Assistant sidebar popup. Accepts CSS height values (e.g., "800px", "80vh", "100%") or numeric values (treated as pixels). Use null or empty string to remove the constraint and allow full dynamic growth.

    Declaration
    [Parameter]
    public string PopupMaxHeight { get; set; }
    Property Value
    Type Description
    string

    A string representing the maximum height in CSS units, or a number (interpreted as pixels).

    Remarks

    When a numeric value is provided (e.g., PopupMaxHeight="600"), it is automatically converted to pixels ("600px"). Supports all valid CSS height units including px, %, vh, rem, etc.

    Examples
    <SfSmartRichTextEditor>
        <AssistViewSettings PopupMaxHeight="80vh" />
    </SfSmartRichTextEditor>
    
    <!-- Or using numeric value (treated as pixels) -->
    <SfSmartRichTextEditor>
        <AssistViewSettings PopupMaxHeight="900" />
    </SfSmartRichTextEditor>

    PopupWidth

    Gets or sets the width of the AI Assistant sidebar popup. Accepts CSS width values (e.g., "600px", "50%", "40vw") or numeric values (treated as pixels). Use "auto" to let the popup size itself based on content and screen size (recommended for responsive layouts).

    Declaration
    [Parameter]
    public string PopupWidth { get; set; }
    Property Value
    Type Description
    string

    A string representing the width in CSS units, or a number (interpreted as pixels). Default is "auto".

    Remarks
    • "auto": Optimal responsive behavior (default).
    • "600px", as string or 600 as number → both become "600px".
    • Supports px, %, vw, rem, and other valid CSS width units.
    • Setting to null or empty string reverts to "auto".
    Examples
    <SfSmartRichTextEditor>
        <AssistViewSettings PopupWidth="650px" />
    </SfSmartRichTextEditor>
    
    <!-- Responsive width using viewport units -->
    <SfSmartRichTextEditor>
        <AssistViewSettings PopupWidth="45vw" />
    </SfSmartRichTextEditor>
    
    <!-- Let content determine width -->
    <SfSmartRichTextEditor>
        <AssistViewSettings PopupWidth="auto" />
    </SfSmartRichTextEditor>

    PromptToolbarSettings

    Gets or sets the configuration for the toolbar that appears below the prompt input area in the AI Assistant sidebar. Enables customization of prompt editing and management actions with full template support. Default items include Edit and Copy actions.

    Declaration
    [Parameter]
    public RenderFragment? PromptToolbarSettings { get; set; }
    Property Value
    Type Description
    RenderFragment

    A RenderFragment containing PromptToolbar and PromptToolbarItem child elements that define the toolbar item configuration.

    Remarks

    Use this property to provide quick access actions for prompt management below the user input field. Toolbar items can support:

    • Text editing capabilities (Edit prompt)
    • Copy to clipboard functionality
    • Prompt sharing and social distribution
    • Save as template for reuse
    • Clear or reset actions
    • Custom application-specific operations

    Each PromptToolbarItem supports:

    • Text — Display text for the toolbar item
    • IconCss — CSS class for the icon representation
    • Tooltip — Descriptive tooltip shown on hover
    • Template — Custom RenderFragment for advanced rendering

    Customization Options: Combine with event handlers to implement prompt-specific workflows such as prompt versioning, analytics tracking, or integration with external systems.

    Examples
    <SfSmartRichTextEditor Height="600px">
        <AssistViewSettings PopupWidth="500px" PopupMaxHeight="700px">
            <PromptToolbarSettings>
                <PromptToolbarItem Text="Edit" IconCss="e-icons e-assist-edit" Tooltip="Edit prompt" />
                <PromptToolbarItem Text="Copy" IconCss="e-icons e-assist-copy" Tooltip="Copy prompt" />
                <PromptToolbarItem IconCss="e-icons e-open-link" />
                <PromptToolbarItem>
                    <Template>
                        <button>Prompt Button</button>
                    </Template>
                </PromptToolbarItem>
            </PromptToolbarSettings>
        </AssistViewSettings>
    </SfSmartRichTextEditor>

    Prompts

    Gets or sets a collection of predefined prompt-response pairs to preload into the AI Assistant conversation. Ideal for templates, workflows, organizational guidelines, or persona-specific starters.

    Declaration
    [Parameter]
    public List<AssistViewPrompt> Prompts { get; set; }
    Property Value
    Type Description
    List<AssistViewPrompt>

    A list of AssistViewPrompt objects containing prompt text and optional pre-filled AI response.

    Remarks

    Each AssistViewPrompt supports:

    • Prompt — User input text (e.g., "Write a professional email")
    • Response — Predefined AI output (supports HTML/Markdown)
    • IsResponseHelpful — Optional feedback state (true/false/null)
    • AttachedFiles — List of uploaded files (FileInfo) for context

    Use cases from Requirements Document:

    • Content Manager: Brand voice templates
    • Technical Writer: API doc starters, code examples
    • Developer: Integration snippets, error message templates
    • Enterprise: Compliance disclaimers, legal templates
    Examples
    <SfSmartRichTextEditor>
        <AssistViewSettings Prompts="@TemplatePrompts" />
    </SfSmartRichTextEditor>
    
    @code {
        private List<AssistViewPrompt> TemplatePrompts = new()
        {
            new AssistViewPrompt
            {
                Prompt = "Draft a project status update email",
                Response = @"Subject: Weekly Project Update - [Project Name]
    
    Hi team,
    
    Here's this week's progress:
    - Completed: User authentication module
    - In progress: Payment integration
    - Blocked: Awaiting design approval
    
    Next steps: Begin QA testing on Monday.
    
    Best regards,
    [Your Name]"
            },
            new AssistViewPrompt
            {
                Prompt = "Generate API documentation for GET /users",
                Response = @"### GET /users
    
    Retrieves a list of users.
    
    **Request**
    ```http
    GET /api/users
    Authorization: Bearer {token}
    ```
    
    **Response**
    ```json
    {
      ""users"": [ ... ]
    }
    ```"
            }
        };
    }

    ResponseToolbarSettings

    Gets or sets the configuration for the toolbar that appears in the AI response viewer section of the Assistant sidebar. Enables customization of response interaction actions such as regeneration, insertion, and feedback management. Default items include Regenerate, Copy, and Insert actions.

    Declaration
    [Parameter]
    public RenderFragment? ResponseToolbarSettings { get; set; }
    Property Value
    Type Description
    RenderFragment

    A RenderFragment containing ResponseToolbar and ResponseToolbarItem child elements that define the toolbar item configuration.

    Remarks

    Use this property to customize the toolbar displayed below AI-generated responses, enabling users to interact with and manage generated content. Toolbar items can support:

    • Regenerate response with different parameters or styles
    • Copy response to clipboard for external use
    • Insert response into the document at cursor position
    • Share or export response content
    • Like/Dislike feedback for response quality (sentiment tracking)
    • Expand or collapse for detailed/summary views
    • Edit or refine response before insertion
    • Custom enterprise-specific operations

    Each ResponseToolbarItem supports:

    • Text — Display text for the toolbar item
    • IconCss — CSS class for the icon representation
    • Tooltip — Descriptive tooltip shown on hover
    • Type — Item type (e.g., Separator for visual grouping)
    • Template — Custom RenderFragment for complex rendering with dynamic content

    Integration Patterns: Combine toolbar actions with event handlers like AIToolbarItemClicked to implement response workflows such as:

    • Analytics and usage tracking
    • Content approval workflows
    • Integration with document management systems
    • Response quality monitoring and feedback loops
    Examples
    <SfSmartRichTextEditor Height="600px">
        <AssistViewSettings PopupWidth="500px" PopupMaxHeight="700px">
            <ResponseToolbarSettings>
                <ResponseToolbarItem IconCss = "e-icons e-save"/>
                <ResponseToolbarItem Text="Insert" IconCss="e-icons e-check" Tooltip="Insert into document" />
                <ResponseToolbarItem Text="Regenerate" IconCss="e-icons e-refresh" Tooltip="Regenerate response" />
                <ResponseToolbarItem Text="Copy" IconCss="e-icons e-assist-copy" Tooltip="Copy response" />
                 <ResponseToolbarItem>
                    <Template>
                        <button>Custom Button</button>
                    </Template>
                 </ResponseToolbarItem>
            </ResponseToolbarSettings>
        </AssistViewSettings>
    </SfSmartRichTextEditor>

    Suggestions

    Gets or sets quick-start suggestion chips shown in the AI Assistant.

    Declaration
    [Parameter]
    public List<string> Suggestions { get; set; }
    Property Value
    Type Description
    List<string>

    Array of suggestion strings.

    Examples
    <SfSmartRichTextEditor>
        <AssistViewSettings Suggestions="@(new List<string> { "Make shorter", "Improve clarity", "Add examples" })" />
    </SfSmartRichTextEditor>

    Methods

    BuildRenderTree(RenderTreeBuilder)

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    RenderTreeBuilder __builder

    ClearAIPromptHistoryAsync()

    Clears all conversation history in the AI Assist.

    Declaration
    public Task ClearAIPromptHistoryAsync()
    Returns
    Type Description
    Task

    A Task that completes when the history has been cleared.

    ExecuteAIPromptAsync(string)

    Executes a prompt in the AI Assist programmatically.

    Declaration
    public Task ExecuteAIPromptAsync(string prompt)
    Parameters
    Type Name Description
    string prompt

    The prompt text to execute.

    Returns
    Type Description
    Task

    A Task that completes when the prompt is sent.

    GetAIPromptHistoryAsync()

    Retrieves the complete conversation history of the AI Assist asynchronously, including prompts and responses.

    Declaration
    public Task<AssistViewPrompt[]> GetAIPromptHistoryAsync()
    Returns
    Type Description
    Task<AssistViewPrompt[]>

    A Task<TResult> that resolves to an array of AssistViewPrompt (oldest first).

    Remarks

    Returns up to MaxPromptHistory entries (default: 20). Each entry includes:

    • Prompt — Original user input
    • Response — AI-generated response (Markdown → HTML converted)
    • IsResponseHelpful — User feedback state
    • AttachedFiles — Uploaded files

    Use cases: Compliance export (GDPR), session resume, analytics, integration.

    Examples
    var history = await editor.GetAIPromptHistoryAsync();
    var json = System.Text.Json.JsonSerializer.Serialize(history, new() { WriteIndented = true });
    await File.WriteAllTextAsync("ai-prompt-history.json", json);

    HideAIPopupAsync()

    Closes the AI Assist sidebar.

    Declaration
    public Task HideAIPopupAsync()
    Returns
    Type Description
    Task

    A Task that completes when the sidebar is hidden.

    OnInitialized()

    Called once when the component is initialized. Registers this AssistViewSettings instance with the parent SfSmartRichTextEditor.

    Declaration
    protected override void OnInitialized()

    ShowAIPopupAsync()

    Opens the AI Assist sidebar and starts a new conversation.

    Declaration
    public Task ShowAIPopupAsync()
    Returns
    Type Description
    Task

    A Task that completes when the sidebar is shown.

    UpdateAIResponseAsync(string, bool)

    Updates the AI Assist response (supports streaming).

    Declaration
    public Task UpdateAIResponseAsync(string outputResponse, bool isFinalUpdate = false)
    Parameters
    Type Name Description
    string outputResponse

    String chunk or full response text.

    bool isFinalUpdate

    Set true to hide "Stop" button when streaming ends.

    Returns
    Type Description
    Task

    A Task that completes when the response update is processed.

    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved