Class TextBlock
Represents a text-based response block that displays plain or formatted textual content within the SfAIAssistView conversation.
Implements
Inherited Members
Namespace: Syncfusion.Blazor.InteractiveChat
Assembly: Syncfusion.Blazor.InteractiveChat.dll
Syntax
public class TextBlock : IResponseBlock
Remarks
The TextBlock class is the standard response block used to present textual information generated by an AI service or provided programmatically.
Text blocks can be combined with other response block types, such as ThinkingBlock and ToolBlock, to create rich conversational experiences.
This block is rendered according to the text presentation settings of the SfAIAssistView component and supports content returned through UpdateResponseAsync.
The class is lightweight and intended for displaying content only. No additional processing or rendering overhead is introduced beyond standard text rendering.
Examples
The following example demonstrates how to create and display a text response block:
List<IResponseBlock> blocks = new()
{
new TextBlock
{
Content = "Hello! How can I assist you today?"
}
};
await aiAssistView.UpdateResponseAsync(string.Empty, blocks);
Constructors
TextBlock()
Declaration
public TextBlock()
Properties
BlockType
Gets or sets the type of the response block.
Declaration
public BlockType BlockType { get; set; }
Property Value
| Type | Description |
|---|---|
| BlockType | A BlockType that identifies the block as a text response. The default value is Text. |
Remarks
The AI AssistView uses this property to determine the appropriate rendering behavior for the block.
For instances of TextBlock, this property should typically remain set to Text.
Content
Gets or sets the textual content displayed by the response block.
Declaration
public string Content { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string containing the text to render in the conversation. The default value is |
Remarks
The content may include plain text or supported formatting syntax, depending on the configuration and rendering capabilities of the hosting SfAIAssistView.
If an empty string is provided, the block renders without visible text content.
Examples
var textBlock = new TextBlock
{
Content = "The analysis has completed successfully."
};