alexa
menu

Blazor

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

    Show / Hide Table of Contents

    Class SfInlineAIAssist

    Code-behind for SfInlineAIAssist component. Handles lifecycle, JavaScript interop, and component logic.

    Inheritance
    object
    ComponentBase
    OwningComponentBase
    SfOwningComponentBase
    SfBaseComponent
    SfInlineAIAssist
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    ComponentBase.Assets
    ComponentBase.AssignedRenderMode
    ComponentBase.DispatchExceptionAsync(Exception)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.OnAfterRender(bool)
    ComponentBase.OnInitialized()
    ComponentBase.OnParametersSet()
    ComponentBase.RendererInfo
    ComponentBase.SetParametersAsync(ParameterView)
    ComponentBase.ShouldRender()
    ComponentBase.StateHasChanged()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    OwningComponentBase.IsDisposed
    OwningComponentBase.ScopedServices
    SfBaseComponent.Dispose()
    SfBaseComponent.LicenseContext
    SfBaseComponent.OnObservableChange(string, object, bool, NotifyCollectionChangedEventArgs)
    SfBaseComponent.ValidateLicenseByUICategory()
    Namespace: Syncfusion.Blazor.InteractiveChat
    Assembly: Syncfusion.Blazor.InteractiveChat.dll
    Syntax
    public class SfInlineAIAssist : SfBaseComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable

    Constructors

    SfInlineAIAssist()

    Declaration
    public SfInlineAIAssist()

    Properties

    Closed

    Triggered when inlineAIAssist popup is closed.

    Declaration
    [Parameter]
    public EventCallback<CloseEventArgs> Closed { get; set; }
    Property Value
    Type
    EventCallback<CloseEventArgs>
    Remarks

    This event is triggered after the SfInlineAIAssist popup has fully closed and is no longer visible to the user.

    Created

    Event raised when the SfInlineAIAssist is created.

    Declaration
    [Parameter]
    public EventCallback<object> Created { get; set; }
    Property Value
    Type
    EventCallback<object>
    Remarks

    This event is triggered when the SfInlineAIAssist component is created.

    CssClass

    Gets or sets custom CSS classes for the SfInlineAIAssist component.

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

    A string containing CSS class names to customize the appearance. The default is String.Empty.

    Remarks

    This property allows adding custom CSS classes for styling the SfInlineAIAssist component.

    EditorTemplate

    Gets or sets the custom template for the editor area of the SfInlineAIAssist component.

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

    A RenderFragment representing the custom editor template. The default value is null.

    Remarks

    Use this property to define a custom editor layout within the SfInlineAIAssist component, replacing the default editor area with a fully customized RenderFragment.

    Examples

    The following example demonstrates how to define a custom editor template for the SfInlineAIAssist component.

    <SfInlineAIAssist>
        <ChildContent>
            <EditorTemplate>
                <div class="custom-editor">
                    <textarea placeholder="Type your prompt here..."></textarea>
                </div>
            </EditorTemplate>
        </ChildContent>
    </SfInlineAIAssist>

    EnableStreaming

    Gets or sets whether the response should be streamed for SfInlineAIAssist component.

    Declaration
    [Parameter]
    public bool EnableStreaming { get; set; }
    Property Value
    Type Description
    bool

    true, prompt response will be streamed in SfInlineAIAssist component. The default value is false.

    ID

    Gets or sets the ID attribute for the SfInlineAIAssist component.

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

    A string representing the unique identifier for the Chat UI. The default is Empty.

    Remarks

    This property allows you to specify a unique ID for the SfInlineAIAssist component. It can be useful for applying custom styles or accessing the component through scripts.

    Opened

    Triggered when inlineAIAssist popup is opened.

    Declaration
    [Parameter]
    public EventCallback<OpenEventArgs> Opened { get; set; }
    Property Value
    Type
    EventCallback<OpenEventArgs>
    Remarks

    This event is triggered after the SfInlineAIAssist popup has fully opened and is visible to the user.

    Placeholder

    Gets or sets the placeholder text for the prompt input text area in the SfInlineAIAssist component.

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

    The placeholder text displayed in the prompt input text area field. The default is "Ask or generate AI content..".

    Remarks

    This property provides placeholder text to guide users on what to input in the prompt text area field in the SfInlineAIAssist component.

    PopupHeight

    Gets or sets the height of the SfInlineAIAssist popup.

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

    A string representing the height of the popup. The default value is "auto".

    Remarks

    Use this property to control the vertical size of the SfInlineAIAssist popup. Accepts any valid CSS height value, including pixel units (e.g., "300px"), percentage values (e.g., "50%"), or other CSS length units such as "20rem".

    PopupWidth

    Gets or sets the width of the SfInlineAIAssist popup.

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

    A string representing the width of the popup. The default value is "400px".

    Remarks

    Use this property to control the horizontal size of the SfInlineAIAssist popup. Accepts any valid CSS width value, including pixel units (e.g., "400px"), percentage values (e.g., "50%"), or other CSS length units such as "20rem" or "auto".

    Prompt

    Gets or sets the prompt text in the SfInlineAIAssist component. Supports two-way binding.

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

    The text to be used as the prompt. The default is String.Empty.

    Remarks

    This property represents the text input prompt for the SfInlineAIAssist component. Define @bind-Prompt to use two-way binding.

    PromptRequested

    Event raised when a prompt request is made in the SfInlineAIAssist.

    Declaration
    [Parameter]
    public EventCallback<PromptRequestedEventArgs> PromptRequested { get; set; }
    Property Value
    Type
    EventCallback<PromptRequestedEventArgs>
    Remarks

    This event is triggered when a prompt request is made in the SfInlineAIAssist component.

    Prompts

    Gets or sets the collection of prompts and their responses in the SfInlineAIAssist component.

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

    A list of PromptResponse representing the prompts. The default is an empty list.

    Remarks

    This property holds the collection of provided prompts and their responses for the SfInlineAIAssist component.

    RelateTo

    Gets or sets the CSS selector or element ID that specifies the target element relative to which the SfInlineAIAssist popup is positioned.

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

    A string representing the CSS selector or element ID of the anchor element. The default value is null.

    Remarks

    Use this property to anchor the SfInlineAIAssist popup to a specific element in the DOM. Accepts any valid CSS selector such as an element ID (e.g., "#myEditor") or a class name (e.g., ".editor-wrapper").

    ResponseMode

    Gets or sets the display mode that determines how the AI response is rendered in the SfInlineAIAssist component.

    Declaration
    [Parameter]
    public ResponseDisplayMode ResponseMode { get; set; }
    Property Value
    Type Description
    ResponseDisplayMode

    A ResponseDisplayMode specifying the response rendering mode. The default value is Popup.

    Remarks

    When set to Popup, the AI-generated response is displayed inside the SfInlineAIAssist popup, allowing the user to review and apply it from within the popup interface.

    When set to Inline, the response is not rendered inside the popup. This mode is intended for scenarios where the response is handled externally, such as streaming output directly into a custom editor or content region.

    ResponseTemplate

    Gets or sets the template for the output response item in the SfInlineAIAssist component.

    Declaration
    [Parameter]
    public RenderFragment<ResponseTemplateContext> ResponseTemplate { get; set; }
    Property Value
    Type Description
    RenderFragment<ResponseTemplateContext>

    A RenderFragment<TValue> representing the template for the output response item. The default is null.

    Remarks

    This property specifies the template used to render the output response item in the SfInlineAIAssist component.

    Examples
    <SfInlineAIAssist>
        <ChildContent>
            <ResponseTemplate>
                <p>@context.Response</p>
            </ResponseTemplate>
        </ChildContent>
    </SfInlineAIAssist>

    Target

    Gets or sets the CSS selector or element ID that specifies the container where the SfInlineAIAssist component will be appended.

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

    A string representing the CSS selector or element ID of the target container. The default value is "body".

    Remarks

    Use this property to control which DOM element acts as the parent container for the SfInlineAIAssist component. Accepts any valid CSS selector (e.g., "#myContainer", ".wrapper") or an element ID.

    ZIndex

    Gets or sets the stack order of the SfInlineAIAssist popup relative to other elements on the page.

    Declaration
    [Parameter]
    public double ZIndex { get; set; }
    Property Value
    Type Description
    double

    An double representing the z-index of the popup. The default value is 1000.

    Remarks

    Use this property to control the stacking order of the SfInlineAIAssist popup within the DOM. Elements with a higher ZIndex value are rendered on top of elements with a lower value.

    Methods

    BuildRenderTree(RenderTreeBuilder)

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

    Dispose(bool)

    Dispose unmanaged resources in the Syncfusion Blazor component.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing

    Boolean value to dispose the object.

    Overrides
    SfBaseComponent.Dispose(bool)

    ExecutePromptAsync(string)

    Executes the prompts at dynamically to generate the respective output.

    Declaration
    public Task ExecutePromptAsync(string prompt)
    Parameters
    Type Name Description
    string prompt
    Returns
    Type Description
    Task

    Task.

    HideCommandPopupAsync()

    Hides the command popup displayed below the prompt input area.

    Declaration
    public Task HideCommandPopupAsync()
    Returns
    Type Description
    Task

    A Task that represents the asynchronous operation of hiding the command popup.

    Remarks

    This method dismisses the command action popup without making any selection. It is typically used when the user cancels or navigates away from the command chooser UI.

    The method safely checks whether the command popup instance is available before attempting to hide it, preventing null reference exceptions.

    This operation is asynchronous and should be awaited to ensure proper UI state updates.

    HidePopupAsync()

    Hides the inline AI assist popup and resets its state.

    Declaration
    public Task HidePopupAsync()
    Returns
    Type Description
    Task

    A Task that represents the asynchronous operation of hiding the popup and cleaning up its UI state.

    Remarks

    This method is asynchronous and should be awaited to ensure UI consistency.

    OnAfterRenderAsync(bool)

    Method invoked after each time the component has been rendered.

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    bool firstRender

    Set to true for the first time component rendering; otherwise gets false.

    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task representing any asynchronous operation.

    Overrides
    SfBaseComponent.OnAfterRenderAsync(bool)

    OnInitializedAsync()

    Method invoked when the component is ready to start.

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task representing any asynchronous operation.

    Overrides
    SfBaseComponent.OnInitializedAsync()

    OnParametersSetAsync()

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type
    Task
    Overrides
    ComponentBase.OnParametersSetAsync()

    ShowCommandPopupAsync()

    Displays the inline AI assist command popup when the main popup is open.

    Declaration
    public Task ShowCommandPopupAsync()
    Returns
    Type Description
    Task

    A Task that represents the asynchronous operation of showing the command popup.

    Remarks

    This method is asynchronous and should be awaited to ensure UI consistency.

    ShowPopupAsync(int?, int?)

    Displays the inline AI assist popup at the specified coordinates.

    Declaration
    public Task ShowPopupAsync(int? x = 0, int? y = 0)
    Parameters
    Type Name Description
    int? x

    An optional int representing the horizontal (X-axis) position in pixels relative to the target element. The default value is 0.

    int? y

    An optional int representing the vertical (Y-axis) position in pixels relative to the target element. The default value is 0.

    Returns
    Type Description
    Task

    A Task that represents the asynchronous operation of showing the popup and its associated command actions.

    Remarks

    This operation is asynchronous and should be awaited to ensure proper UI state synchronization.

    UpdateResponseAsync(string, bool)

    Asynchronously updates the streaming response of a prompt by appending the latest chunk and rendering it in real-time within the SfInlineAIAssist component.

    Declaration
    public Task UpdateResponseAsync(string response, bool isFinalUpdate = true)
    Parameters
    Type Name Description
    string response

    The full accumulated response, including all previously received chunks. Each chunk is appended externally (before calling this method), ensuring a progressive update of the response in the UI.

    bool isFinalUpdate

    Indicates whether this response is the final one. When true, hides the typing indicator and stop response button; when false, keeps the streaming state active for additional chunks.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation. This method executes in a non-blocking manner, ensuring that UI updates occur smoothly without freezing the main thread.

    Remarks
    • This method is designed to handle AI-generated streaming responses efficiently.
    • It enables real-time response rendering by progressively updating the SfInlineAIAssist component as new chunks arrive.
    • Asynchronous execution ensures a smooth UI experience, allowing updates without blocking user interactions.
    • When isFinalUpdate is false, the typing indicator remains visible, and the response continues streaming.
    • When isFinalUpdate is true, the streaming is marked complete and UI controls are finalized.

    Implements

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