New to Telerik UI for ASP.NET MVC? Start a free 30-day trial

Defines the fluent API for configuring the Kendo Chat for ASP.NET MVC.

Definition

Constructors

Initializes a new instance of the Chat class.

C#
public ChatBuilder(Chat component)
Parameters:componentChat

The component.

Methods

Configures the action button (send/stop button) in the message input area. Allows customization of icons, text labels, and loading state appearance.

C#
public ChatBuilder ActionButton(Action<ChatActionButtonSettingsBuilder> configurator)
Parameters:configuratorAction<ChatActionButtonSettingsBuilder>

The action that configures the actionbutton.

Returns:

ChatBuilder

Enables or disables message collapsing functionality for expandable messages. When enabled, long messages can be collapsed to save screen space.

C#
public ChatBuilder AllowMessageCollapse(bool value)
Parameters:valuebool

The value that configures the allowmessagecollapse.

Returns:

ChatBuilder

Sets the default layout mode for rich attachments (cards, images) within messages. Individual messages can override this setting via their attachmentLayout data property.

C#
public ChatBuilder AttachmentLayout(ChatAttachmentLayout value)
Parameters:valueChatAttachmentLayout

The value that configures the attachmentlayout.

Returns:

ChatBuilder

The field of the message data item that provides the attachment layout mode for that specific message. Allows per-message override of the global attachmentLayout setting.

C#
public ChatBuilder AttachmentLayoutField(string value)
Parameters:valuestring

The value that configures the attachmentlayoutfield.

Returns:

ChatBuilder

The field of the message data item that provides the rich attachments array. Each attachment object can contain contentType, title, subtitle, thumbnailUrl, and actions properties.

C#
public ChatBuilder AttachmentsField(string value)
Parameters:valuestring

The value that configures the attachmentsfield.

Returns:

ChatBuilder

The template used to render individual attachments within messages. Receives the attachment data object and should return an HTML string. When not set, the default attachment rendering is used.The function receives the attachment object with properties such as title, subtitle, image, contentType, and content.

C#
public ChatBuilder AttachmentTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the attachmenttemplate.

Returns:

ChatBuilder

The template used to render individual attachments within messages. Receives the attachment data object and should return an HTML string. When not set, the default attachment rendering is used.The function receives the attachment object with properties such as title, subtitle, image, contentType, and content.

C#
public ChatBuilder AttachmentTemplateHandler(string value)
Parameters:valuestring

The value that configures the attachmenttemplate.

Returns:

ChatBuilder

Specifies the unique identifier of the current user. If not set, a GUID will be generated automatically. This determines which messages are displayed as "own messages" (right-aligned) versus "other messages" (left-aligned).

C#
public ChatBuilder AuthorId(string value)
Parameters:valuestring

The value that configures the authorid.

Returns:

ChatBuilder

Specifies the field name in the data source from which the message author's unique identifier will be read.

C#
public ChatBuilder AuthorIdField(string value)
Parameters:valuestring

The value that configures the authoridfield.

Returns:

ChatBuilder

Specifies the field name in the data source from which the alt text for the author's avatar image will be read.

C#
public ChatBuilder AuthorImageAltTextField(string value)
Parameters:valuestring

The value that configures the authorimagealttextfield.

Returns:

ChatBuilder

Specifies the field name in the data source from which the URL for the author's avatar image will be read.

C#
public ChatBuilder AuthorImageUrlField(string value)
Parameters:valuestring

The value that configures the authorimageurlfield.

Returns:

ChatBuilder

User-specific message settings applied to messages sent by the current user (author). These settings override the global display options like showAvatar, showUsername, and messageWidthMode for author messages only. See also receiverMessageSettings.The object accepts the following properties: showAvatar - Boolean - Whether to show the avatar for author messages.; showUsername - Boolean - Whether to show the username for author messages.; messageWidthMode - String - Message width mode: "standard" or "full".; allowMessageCollapse - Boolean - Whether author messages can be collapsed.; messageTemplate - Function - Template override for author messages. Receives the same arguments as messageTemplate.; messageContentTemplate - Function - Content template override for author messages. Receives the current message object.; enableFileActions - Boolean - Whether file actions are enabled for author messages.; enableContextMenuActions - Boolean - Whether context menu actions are enabled for author messages.; messageToolbarActions - Array - Toolbar actions specific to author messages. or messageActions - Array - Context menu actions specific to author messages..

C#
public ChatBuilder AuthorMessageSettings(Action<ChatMessageSettingsBuilder> configurator)
Parameters:configuratorAction<ChatMessageSettingsBuilder>

The action that configures the authormessagesettings.

Returns:

ChatBuilder

Specifies the field name in the data source from which the author's display name will be read.

C#
public ChatBuilder AuthorNameField(string value)
Parameters:valuestring

The value that configures the authornamefield.

Returns:

ChatBuilder

Enables or disables automatic assignment of a unique ID to each message posted in the chat. When enabled, messages without an explicit ID will be assigned a generated unique identifier.This option should be set to false if the chat is configured to work with a remote data source and the messages are created on the server. In that case, the id should be assigned on the server itself.

C#
public ChatBuilder AutoAssignId(bool value)
Parameters:valuebool

The value that configures the autoassignid.

Returns:

ChatBuilder

Controls whether the Chat will automatically fetch data from the data source when initialized. When set to false, you must manually call the data source's fetch() method.

C#
public ChatBuilder AutoBind(bool value)
Parameters:valuebool

The value that configures the autobind.

Returns:

ChatBuilder

Defines the amount of space that is preserved above a newly auto-scrolled incoming message when the user is already near the bottom of the message list. Accepts either a pixel value or a percentage of the visible message list area.

C#
public ChatBuilder AutoScrollThreshold(double value)
Parameters:valuedouble

The value that configures the autoscrollthreshold.

Returns:

ChatBuilder

Binds the component to an IEnumerable collection.

C#
public ChatBuilder BindTo(IEnumerable<ChatMessage> data)
Parameters:dataIEnumerable<ChatMessage>

The IEnumerable collection.

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

Example:
C#
@(Html.Kendo().Chat()
.Name("chat")
.BindTo(new List&lt;ChatMessage&gt;
{
new ChatMessage { Text = "Text1" },
new ChatMessage { Text = "Text2" }
}))

Sets the DataSource configuration of the Chat for remote data binding.

C#
public ChatBuilder DataSource(Action<DataSourceBuilder<object>> configurator)
Parameters:configuratorAction<DataSourceBuilder<object>>

The action that configures the DataSource.

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

Example:
C#
@(Html.Kendo().Chat()
.Name("chat")
.DataSource(source =&gt;
{
source.Read(read =&gt;
{
read.Action("GetChatMessages", "Home");
})
})
)

Sets the DataSource configuration of the Chat for remote data binding.

C#
public ChatBuilder DataSource(string dataSourceId)
Parameters:dataSourceIdstring

The dataSource id that configures the DataSource.

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

Example:
C#
@(Html.Kendo().Chat()
.Name("chat")
.DataSource("myDataSource")
)

Specifies the text direction of the Chat.

C#
public ChatBuilder Dir(TextDirection value)
Parameters:valueTextDirection

The value that configures the dir.

Returns:

ChatBuilder

Specifies the delay in milliseconds before the Chat loads older or newer messages after the user reaches an endless-scroll edge. The delay applies only to endless edge-trigger loading and does not affect the scroll-to-bottom button behavior or separator updates.

C#
public ChatBuilder EndlessScrollDebounceDelay(double value)
Parameters:valuedouble

The value that configures the endlessscrolldebouncedelay.

Returns:

ChatBuilder

Configures the client-side events.

C#
public ChatBuilder Events(Action<ChatEventBuilder> configurator)
Parameters:configuratorAction<ChatEventBuilder>

The client events action.

Returns:

ChatBuilder

Example:
C#
@(Html.Kendo().Chat()
.Name("Chat")
.Events(events =&gt; events
.Input("onInput")
)
)

The field of the message data item that provides the failed flag. When true, the message is rendered with a failed state indicator and a retry button.

C#
public ChatBuilder FailedField(string value)
Parameters:valuestring

The value that configures the failedfield.

Returns:

ChatBuilder

Defines the collection of actions that will be rendered in the context menu for file attachments. Each action represents an operation that users can perform on files (download, delete, preview, etc.).

C#
public ChatBuilder FileActions(Action<ChatFileActionFactory> configurator)
Parameters:configuratorAction<ChatFileActionFactory>

The action that configures the fileactions.

Returns:

ChatBuilder

Configures the file select button (attachment button) in the message input area. Can be set to: true: Shows the button with default settings; false: Hides the button completely (does not render) or Object: Shows the button with custom configuration.

C#
public ChatBuilder FileAttachment(Action<ChatFileAttachmentSettingsBuilder> configurator)
Parameters:configuratorAction<ChatFileAttachmentSettingsBuilder>

The action that configures the fileattachment.

Returns:

ChatBuilder

Configures the file select button (attachment button) in the message input area. Can be set to: true: Shows the button with default settings; false: Hides the button completely (does not render) or Object: Shows the button with custom configuration.

C#
public ChatBuilder FileAttachment(bool enabled)
Parameters:enabledbool

Enables or disables the fileattachment option.

Returns:

ChatBuilder

Specifies the field name in the data source from which the array of files attached to a message will be read.

C#
public ChatBuilder FilesField(string value)
Parameters:valuestring

The value that configures the filesfield.

Returns:

ChatBuilder

Controls the layout mode for file attachments within messages. Available modes are "vertical" (stacked), "horizontal" (side-by-side with scrolling), and "wrap" (wrapping flow layout).

C#
public ChatBuilder FilesLayoutMode(ChatFilesLayout value)
Parameters:valueChatFilesLayout

The value that configures the fileslayoutmode.

Returns:

ChatBuilder

The template used to render file attachments in messages.

C#
public ChatBuilder FilesTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the filestemplate.

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The template used to render file attachments in messages.

C#
public ChatBuilder FilesTemplateHandler(string templateHandler)
Parameters:templateHandlerstring

The handler that returs the template for FilesTemplate

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The template used to render file attachments in messages.

C#
[Obsolete("FilesTemplateId is obsolete. Please use FilesTemplateHandler or FilesTemplate instead.")]
public ChatBuilder FilesTemplateId(string templateId)
Parameters:templateIdstring

The ID of the template element for FilesTemplate

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

Defines the collection of items that will be rendered in the Chat header. Each item represents a component or content that appears in the header area above the message list. The items follow the same structure as AppBar items.

C#
public ChatBuilder HeaderItems(Action<AppBarItemFactory> configurator)
Parameters:configuratorAction<AppBarItemFactory>

The AppBarItemFactory for the header items setting.

Returns:

ChatBuilder

Returns the current instance of ChatBuilder .

A custom template function for rendering the chat header. When set, this overrides the headerItems configuration and provides full control over the header content. The function should return an HTML string.

C#
public ChatBuilder HeaderTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the headertemplate.

Returns:

ChatBuilder

A custom template function for rendering the chat header. When set, this overrides the headerItems configuration and provides full control over the header content. The function should return an HTML string.

C#
public ChatBuilder HeaderTemplateHandler(string value)
Parameters:valuestring

The value that configures the headertemplate.

Returns:

ChatBuilder

Sets the height of the Chat component.

C#
public ChatBuilder Height(string value)
Parameters:valuestring

The value that configures the height.

Returns:

ChatBuilder

Specifies the field name in the data source from which the unique identifier for each message will be read.

C#
public ChatBuilder IdField(string value)
Parameters:valuestring

The value that configures the idfield.

Returns:

ChatBuilder

Specifies the field name in the data source that indicates whether a message has been deleted.

C#
public ChatBuilder IsDeletedField(string value)
Parameters:valuestring

The value that configures the isdeletedfield.

Returns:

ChatBuilder

Specifies the field name in the data source that indicates whether a message is pinned.

C#
public ChatBuilder IsPinnedField(string value)
Parameters:valuestring

The value that configures the ispinnedfield.

Returns:

ChatBuilder

Specifies the field name in the data source that indicates whether a message is currently being typed.

C#
public ChatBuilder IsTypingField(string value)
Parameters:valuestring

The value that configures the istypingfield.

Returns:

ChatBuilder

Sets the initial loading state of the Chat component. When true, the send button displays a loading/stop indicator instead of the send icon. This is useful for AI chat applications where generating responses takes time. See also the loading method for toggling this state at runtime.

C#
public ChatBuilder Loading(bool value)
Parameters:valuebool

The value that configures the loading.

Returns:

ChatBuilder

Defines the collection of actions that will be rendered in the context menu for messages. By default, the Chat includes four actions: Reply, Copy, and Pin. You can customize this list by providing your own actions or combining default actions with custom ones.Default actions: { name: "reply", text: "Reply", icon: "undo" }; { name: "copy", text: "Copy", icon: "copy" }; { name: "pin", text: "Pin", icon: "pin" } or { name: "delete", text: "Delete", icon: "trash" }.

C#
public ChatBuilder MessageActions(Action<ChatMessageActionFactory> configurator)
Parameters:configuratorAction<ChatMessageActionFactory>

The action that configures the messageactions.

Returns:

ChatBuilder

Configures the message input box (PromptBox) settings. Allows customization of the input mode, rows, height, and nested file select button settings.

C#
public ChatBuilder MessageBox(Action<ChatMessageBoxSettingsBuilder> configurator)
Parameters:configuratorAction<ChatMessageBoxSettingsBuilder>

The action that configures the messagebox.

Returns:

ChatBuilder

The template used to render the message input area at the bottom of the Chat. The function receives no arguments and should return an HTML string for the custom message box markup.When using a custom template, the first textarea or supported text input inside the template is used as the message input. To enable send button behavior, add an element with the ref-chat-message-box-send-button attribute. If the template contains input[type='file'] elements, they participate in the file selection flow.

C#
public ChatBuilder MessageBoxTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the messageboxtemplate.

Returns:

ChatBuilder

The template used to render the message input area at the bottom of the Chat. The function receives no arguments and should return an HTML string for the custom message box markup.When using a custom template, the first textarea or supported text input inside the template is used as the message input. To enable send button behavior, add an element with the ref-chat-message-box-send-button attribute. If the template contains input[type='file'] elements, they participate in the file selection flow.

C#
public ChatBuilder MessageBoxTemplateHandler(string value)
Parameters:valuestring

The value that configures the messageboxtemplate.

Returns:

ChatBuilder

A custom template function for rendering the content area inside message bubbles. This template controls only the text/content portion of messages, not the entire message group structure. When set, it is used for both author and receiver messages unless overridden by authorMessageSettings.messageContentTemplate or receiverMessageSettings.messageContentTemplate.

C#
public ChatBuilder MessageContentTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the messagecontenttemplate.

Returns:

ChatBuilder

A custom template function for rendering the content area inside message bubbles. This template controls only the text/content portion of messages, not the entire message group structure. When set, it is used for both author and receiver messages unless overridden by authorMessageSettings.messageContentTemplate or receiverMessageSettings.messageContentTemplate.

C#
public ChatBuilder MessageContentTemplateHandler(string value)
Parameters:valuestring

The value that configures the messagecontenttemplate.

Returns:

ChatBuilder

The template used to render message groups.

C#
public ChatBuilder MessageGroupTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the messagegrouptemplate.

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The template used to render message groups.

C#
public ChatBuilder MessageGroupTemplateHandler(string templateHandler)
Parameters:templateHandlerstring

The handler that returs the template for MessageGroupTemplate

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The template used to render message groups.

C#
[Obsolete("MessageGroupTemplateId is obsolete. Please use MessageGroupTemplateHandler or MessageGroupTemplate instead.")]
public ChatBuilder MessageGroupTemplateId(string templateId)
Parameters:templateIdstring

The ID of the template element for MessageGroupTemplate

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The template used to render message references (replies and pinned messages).

C#
public ChatBuilder MessageReferenceTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the messagereferencetemplate.

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The template used to render message references (replies and pinned messages).

C#
public ChatBuilder MessageReferenceTemplateHandler(string templateHandler)
Parameters:templateHandlerstring

The handler that returs the template for MessageReferenceTemplate

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The template used to render message references (replies and pinned messages).

C#
[Obsolete("MessageReferenceTemplateId is obsolete. Please use MessageReferenceTemplateHandler or MessageReferenceTemplate instead.")]
public ChatBuilder MessageReferenceTemplateId(string templateId)
Parameters:templateIdstring

The ID of the template element for MessageReferenceTemplate

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

Allows localization of the strings that are used in the component.

C#
public ChatBuilder Messages(Action<ChatMessagesSettingsBuilder> configurator)
Parameters:configuratorAction<ChatMessagesSettingsBuilder>

The action that configures the messages.

Returns:

ChatBuilder

Custom settings for message status display, allowing you to configure icons, text, and CSS classes for each message delivery status. The object should be a mapping from status values ("sent", "delivered", "seen", "failed") to settings objects.Each status settings object accepts: icon - String - Font icon name to display.; text - String - Text label for the status. or cssClass - String - Additional CSS class to apply to the status element..

C#
public ChatBuilder MessageStatusSettings(Action<ChatMessageStatusSettingsSettingsBuilder> configurator)
Parameters:configuratorAction<ChatMessageStatusSettingsSettingsBuilder>

The action that configures the messagestatussettings.

Returns:

ChatBuilder

A custom template function for rendering message status indicators. Receives a context object with status (the status string) and message (the message object). When set, this overrides the default status rendering and messageStatusSettings.

C#
public ChatBuilder MessageStatusTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the messagestatustemplate.

Returns:

ChatBuilder

A custom template function for rendering message status indicators. Receives a context object with status (the status string) and message (the message object). When set, this overrides the default status rendering and messageStatusSettings.

C#
public ChatBuilder MessageStatusTemplateHandler(string value)
Parameters:valuestring

The value that configures the messagestatustemplate.

Returns:

ChatBuilder

The template used to render individual messages.

C#
public ChatBuilder MessageTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the messagetemplate.

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The template used to render individual messages.

C#
public ChatBuilder MessageTemplateHandler(string templateHandler)
Parameters:templateHandlerstring

The handler that returs the template for MessageTemplate

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The template used to render individual messages.

C#
[Obsolete("MessageTemplateId is obsolete. Please use MessageTemplateHandler or MessageTemplate instead.")]
public ChatBuilder MessageTemplateId(string templateId)
Parameters:templateIdstring

The ID of the template element for MessageTemplate

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The format string used to display message timestamps.

C#
public ChatBuilder MessageTimeFormat(string value)
Parameters:valuestring

The value that configures the messagetimeformat.

Returns:

ChatBuilder

Defines the collection of actions that will be rendered in the message toolbar.

C#
public ChatBuilder MessageToolbarActions(Action<ChatMessageToolbarActionFactory> configurator)
Parameters:configuratorAction<ChatMessageToolbarActionFactory>

The action that configures the messagetoolbaractions.

Returns:

ChatBuilder

Sets the messages width mode.

C#
public ChatBuilder MessageWidthMode(ChatMessageWidth mode)
Parameters:modeChatMessageWidthReturns:

ChatBuilder

Returns the current ChatBuilder instance.

A custom template function for rendering an empty state when the chat has no messages. When set, the template output is displayed in place of the empty message list area, providing a visual cue that the conversation has not started yet.

C#
public ChatBuilder NoDataTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the nodatatemplate.

Returns:

ChatBuilder

A custom template function for rendering an empty state when the chat has no messages. When set, the template output is displayed in place of the empty message list area, providing a visual cue that the conversation has not started yet.

C#
public ChatBuilder NoDataTemplateHandler(string value)
Parameters:valuestring

The value that configures the nodatatemplate.

Returns:

ChatBuilder

Documents the default endless batch size.When scrollMode is set to "endless", the effective batch size comes from dataSource.pageSize() for the initial latest window, older/newer adjacent loads, and jump requests. Configure the bound DataSource page size for endless mode instead of relying on a separate Chat range contract, because a root Chat pageSize value does not override the bound DataSource page size.If the bound DataSource does not declare a valid page size, the Chat seeds the DataSource with the default endless batch size of 20 before the first endless load.

C#
public ChatBuilder PageSize(double value)
Parameters:valuedouble

The value that configures the pagesize.

Returns:

ChatBuilder

Provides a stable root-level collection that the Chat can use for pinned-message banners when the current endless-scroll window does not contain the pinned target.This option is most useful with scrollMode set to "endless" and a server-paged dataSource.The Chat uses the last item in the pinnedMessages array as the active pinned banner. Each item can be a full message object or a partial object, but it must contain enough data to identify the target and render the pinned banner.If the pinned target is not part of the current remote window, the Chat can still render the banner from pinnedMessages while using the endless endpoint to load the target batch when the banner is clicked.

C#
public ChatBuilder PinnedMessages(Action<ChatPinnedMessageFactory> configurator)
Parameters:configuratorAction<ChatPinnedMessageFactory>

The action that configures the pinnedmessages.

Returns:

ChatBuilder

User-specific message settings applied to messages received from other users. These settings override the global display options like showAvatar, showUsername, and messageWidthMode for receiver messages only. See also authorMessageSettings.The object accepts the following properties: showAvatar - Boolean - Whether to show the avatar for receiver messages.; showUsername - Boolean - Whether to show the username for receiver messages.; messageWidthMode - String - Message width mode: "standard" or "full".; allowMessageCollapse - Boolean - Whether receiver messages can be collapsed.; messageTemplate - Function - Template override for receiver messages. Receives the same arguments as messageTemplate.; messageContentTemplate - Function - Content template override for receiver messages. Receives the current message object.; enableFileActions - Boolean - Whether file actions are enabled for receiver messages.; enableContextMenuActions - Boolean - Whether context menu actions are enabled for receiver messages.; messageToolbarActions - Array - Toolbar actions specific to receiver messages. or messageActions - Array - Context menu actions specific to receiver messages..

C#
public ChatBuilder ReceiverMessageSettings(Action<ChatMessageSettingsBuilder> configurator)
Parameters:configuratorAction<ChatMessageSettingsBuilder>

The action that configures the receivermessagesettings.

Returns:

ChatBuilder

Specifies the field name in the data source that contains the ID of the message being replied to.

C#
public ChatBuilder ReplyToIdField(string value)
Parameters:valuestring

The value that configures the replytoidfield.

Returns:

ChatBuilder

The scroll mode for the scrollable behavior.

C#
public ChatBuilder ScrollMode(ChatScrollMode value)
Parameters:valueChatScrollMode

The value that configures the scrollmode.

Returns:

ChatBuilder

Shows or hides the scroll-to-bottom button that appears when the user scrolls up in the message list.

C#
public ChatBuilder ScrollToBottomButton(bool value)
Parameters:valuebool

The value that configures the scrolltobottombutton.

Returns:

ChatBuilder

Controls whether avatars are displayed next to messages. This is a global setting that can be overridden per-user via authorMessageSettings and receiverMessageSettings.

C#
public ChatBuilder ShowAvatar(bool value)
Parameters:valuebool

The value that configures the showavatar.

Returns:

ChatBuilder

Controls whether usernames are displayed above messages. This is a global setting that can be overridden per-user via authorMessageSettings and receiverMessageSettings.

C#
public ChatBuilder ShowUsername(bool value)
Parameters:valuebool

The value that configures the showusername.

Returns:

ChatBuilder

Controls whether HTML sanitization is skipped when rendering message content. When set to true, the Chat component will not automatically encode HTML entities in message text, allowing for rich HTML content to be displayed. This is useful when integrating with markdown parsers or when you need to display pre-formatted HTML content.Warning: Setting this to true can introduce security vulnerabilities if user input is not properly sanitized elsewhere in your application. Only use this option when you trust the content source or have implemented your own sanitization logic.

C#
public ChatBuilder SkipSanitization(bool value)
Parameters:valuebool

The value that configures the skipsanitization.

Returns:

ChatBuilder

Configures speech-to-text functionality in the message input. The button is always visible. When null or not configured, the button is enabled by default. Use { enable: false } to disable it.

C#
public ChatBuilder SpeechToText(Action<ChatSpeechToTextSettingsBuilder> configurator)
Parameters:configuratorAction<ChatSpeechToTextSettingsBuilder>

The action that configures the speechtotext.

Returns:

ChatBuilder

Configures speech-to-text functionality in the message input. The button is always visible. When null or not configured, the button is enabled by default. Use { enable: false } to disable it.

C#
public ChatBuilder SpeechToText(bool enabled)
Parameters:enabledbool

Enables or disables the speechtotext option.

Returns:

ChatBuilder

Specifies the field name in the data source from which the message status will be read. The status describes the delivery state of the message (e.g. "Sending", "Sent", "Delivered", "Seen", "Failed"). See also messageStatusSettings.

C#
public ChatBuilder StatusField(string value)
Parameters:valuestring

The value that configures the statusfield.

Returns:

ChatBuilder

Layout mode for suggested actions.

C#
public ChatBuilder SuggestedActionsLayoutMode(SuggestionsLayoutMode value)
Parameters:valueSuggestionsLayoutMode

The value that configures the suggestedactionslayoutmode.

Returns:

ChatBuilder

Enables or disables scrollable behavior for suggested actions.

C#
public ChatBuilder SuggestedActionsScrollable(bool value)
Parameters:valuebool

The value that configures the suggestedactionsscrollable.

Returns:

ChatBuilder

The template used to render suggested actions.

C#
public ChatBuilder SuggestedActionsTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the suggestedactionstemplate.

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The template used to render suggested actions.

C#
public ChatBuilder SuggestedActionsTemplateHandler(string templateHandler)
Parameters:templateHandlerstring

The handler that returs the template for SuggestedActionsTemplate

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The template used to render suggested actions.

C#
[Obsolete("SuggestedActionsTemplateId is obsolete. Please use SuggestedActionsTemplateHandler or SuggestedActionsTemplate instead.")]
public ChatBuilder SuggestedActionsTemplateId(string templateId)
Parameters:templateIdstring

The ID of the template element for SuggestedActionsTemplate

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

Defines the collection of suggested messages that users can quickly select. These appear as clickable buttons below the message input area, allowing users to send common responses quickly.

C#
public ChatBuilder Suggestions(Action<ChatSuggestionFactory> configurator)
Parameters:configuratorAction<ChatSuggestionFactory>

The action that configures the suggestions.

Returns:

ChatBuilder

Controls what happens when a user selects a message suggestion. Supported values: "send": The suggestion text is immediately sent as a message. or "insert": The suggestion text is inserted into the message box input, allowing the user to edit it before sending..

C#
public ChatBuilder SuggestionsBehavior(ChatSuggestionsBehavior value)
Parameters:valueChatSuggestionsBehavior

The value that configures the suggestionsbehavior.

Returns:

ChatBuilder

The layout mode for the message box suggestions.

C#
public ChatBuilder SuggestionsLayoutMode(SuggestionsLayoutMode value)
Parameters:valueSuggestionsLayoutMode

The value that configures the suggestionslayoutmode.

Returns:

ChatBuilder

Enables or disables scrollable behavior for message suggestions.

C#
public ChatBuilder SuggestionsScrollable(bool value)
Parameters:valuebool

The value that configures the suggestionsscrollable.

Returns:

ChatBuilder

The template used to render message suggestions.

C#
public ChatBuilder SuggestionsTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the suggestionstemplate.

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The template used to render message suggestions.

C#
public ChatBuilder SuggestionsTemplateHandler(string templateHandler)
Parameters:templateHandlerstring

The handler that returs the template for SuggestionsTemplate

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The template used to render message suggestions.

C#
[Obsolete("SuggestionsTemplateId is obsolete. Please use SuggestionsTemplateHandler or SuggestionsTemplate instead.")]
public ChatBuilder SuggestionsTemplateId(string templateId)
Parameters:templateIdstring

The ID of the template element for SuggestionsTemplate

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

Specifies the field name in the data source from which the message text content will be read.

C#
public ChatBuilder TextField(string value)
Parameters:valuestring

The value that configures the textfield.

Returns:

ChatBuilder

Specifies the field name in the data source from which the message timestamp will be read.

C#
public ChatBuilder TimestampField(string value)
Parameters:valuestring

The value that configures the timestampfield.

Returns:

ChatBuilder

The template used to render timestamp elements that separate message groups by date. When set to null, the default timestamp logic is used which displays relative dates like "Today", "Yesterday", "Last Wednesday", or absolute dates for older messages.The template function receives an object with date (parsed Date object) and message (current message object) properties and should return the complete HTML structure for the timestamp element.Returning null or an empty string will hide the time breaks from the chat.

C#
public ChatBuilder TimestampTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the timestamptemplate.

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The template used to render timestamp elements that separate message groups by date. When set to null, the default timestamp logic is used which displays relative dates like "Today", "Yesterday", "Last Wednesday", or absolute dates for older messages.The template function receives an object with date (parsed Date object) and message (current message object) properties and should return the complete HTML structure for the timestamp element.Returning null or an empty string will hide the time breaks from the chat.

C#
public ChatBuilder TimestampTemplateHandler(string templateHandler)
Parameters:templateHandlerstring

The handler that returs the template for TimestampTemplate

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

The template used to render timestamp elements that separate message groups by date. When set to null, the default timestamp logic is used which displays relative dates like "Today", "Yesterday", "Last Wednesday", or absolute dates for older messages.The template function receives an object with date (parsed Date object) and message (current message object) properties and should return the complete HTML structure for the timestamp element.Returning null or an empty string will hide the time breaks from the chat.

C#
[Obsolete("TimestampTemplateId is obsolete. Please use TimestampTemplateHandler or TimestampTemplate instead.")]
public ChatBuilder TimestampTemplateId(string templateId)
Parameters:templateIdstring

The ID of the template element for TimestampTemplate

Returns:

ChatBuilder

Returns the current ChatBuilder instance.

Controls the visibility of message timestamps. Supported values: "onFocus": Timestamps are only visible for selected/focused messages (default behavior). or "hidden": Timestamps are never visible for any messages..

C#
public ChatBuilder TimestampVisibility(ChatTimestampVisibility value)
Parameters:valueChatTimestampVisibility

The value that configures the timestampvisibility.

Returns:

ChatBuilder

Configures the toolbar of the Chat.

C#
[Obsolete("This option is obsolete since Q3 2025 and will be removed in future releases.")]
public ChatBuilder Toolbar(Action<ChatToolbarSettingsBuilder> configurator)
Parameters:configuratorAction<ChatToolbarSettingsBuilder>

The ChatToolbarSettingsBuilder for the toolbar setting.

Returns:

ChatBuilder

Returns the current instance of ChatBuilder .

Configures the user information of the Chat.

C#
[Obsolete("This option is obsolete since Q3 2025 and will be removed in future releases.")]
public ChatBuilder User(Action<ChatUserSettingsBuilder> configurator)
Parameters:configuratorAction<ChatUserSettingsBuilder>

The ChatUserSettingsBuilder for the user setting.

Returns:

ChatBuilder

Returns the current instance of ChatBuilder .

The template used to render the user status content shown next to the latest message in a receiver group. The function receives a context object with a message field, where message.author contains the normalized author data, and should return an HTML string.

C#
public ChatBuilder UserStatusTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the userstatustemplate.

Returns:

ChatBuilder

The template used to render the user status content shown next to the latest message in a receiver group. The function receives a context object with a message field, where message.author contains the normalized author data, and should return an HTML string.

C#
public ChatBuilder UserStatusTemplateHandler(string value)
Parameters:valuestring

The value that configures the userstatustemplate.

Returns:

ChatBuilder

Sets the width of the Chat component.

C#
public ChatBuilder Width(string value)
Parameters:valuestring

The value that configures the width.

Returns:

ChatBuilder

In this article
DefinitionConstructorsChatBuilder(Chat)MethodsActionButton(Action<ChatActionButtonSettingsBuilder>)AllowMessageCollapse(bool)AttachmentLayout(ChatAttachmentLayout)AttachmentLayoutField(string)AttachmentsField(string)AttachmentTemplate<TModel>(TemplateBuilder<TModel>)AttachmentTemplateHandler(string)AuthorId(string)AuthorIdField(string)AuthorImageAltTextField(string)AuthorImageUrlField(string)AuthorMessageSettings(Action<ChatMessageSettingsBuilder>)AuthorNameField(string)AutoAssignId(bool)AutoBind(bool)AutoScrollThreshold(double)BindTo(IEnumerable<ChatMessage>)DataSource(Action<DataSourceBuilder<object>>)DataSource(string)Dir(TextDirection)EndlessScrollDebounceDelay(double)Events(Action<ChatEventBuilder>)FailedField(string)FileActions(Action<ChatFileActionFactory>)FileAttachment(Action<ChatFileAttachmentSettingsBuilder>)FileAttachment(bool)FilesField(string)FilesLayoutMode(ChatFilesLayout)FilesTemplate<TModel>(TemplateBuilder<TModel>)FilesTemplateHandler(string)FilesTemplateId(string)HeaderItems(Action<AppBarItemFactory>)HeaderTemplate<TModel>(TemplateBuilder<TModel>)HeaderTemplateHandler(string)Height(string)IdField(string)IsDeletedField(string)IsPinnedField(string)IsTypingField(string)Loading(bool)MessageActions(Action<ChatMessageActionFactory>)MessageBox(Action<ChatMessageBoxSettingsBuilder>)MessageBoxTemplate<TModel>(TemplateBuilder<TModel>)MessageBoxTemplateHandler(string)MessageContentTemplate<TModel>(TemplateBuilder<TModel>)MessageContentTemplateHandler(string)MessageGroupTemplate<TModel>(TemplateBuilder<TModel>)MessageGroupTemplateHandler(string)MessageGroupTemplateId(string)MessageReferenceTemplate<TModel>(TemplateBuilder<TModel>)MessageReferenceTemplateHandler(string)MessageReferenceTemplateId(string)Messages(Action<ChatMessagesSettingsBuilder>)MessageStatusSettings(Action<ChatMessageStatusSettingsSettingsBuilder>)MessageStatusTemplate<TModel>(TemplateBuilder<TModel>)MessageStatusTemplateHandler(string)MessageTemplate<TModel>(TemplateBuilder<TModel>)MessageTemplateHandler(string)MessageTemplateId(string)MessageTimeFormat(string)MessageToolbarActions(Action<ChatMessageToolbarActionFactory>)MessageWidthMode(ChatMessageWidth)NoDataTemplate<TModel>(TemplateBuilder<TModel>)NoDataTemplateHandler(string)PageSize(double)PinnedMessages(Action<ChatPinnedMessageFactory>)ReceiverMessageSettings(Action<ChatMessageSettingsBuilder>)ReplyToIdField(string)ScrollMode(ChatScrollMode)ScrollToBottomButton(bool)ShowAvatar(bool)ShowUsername(bool)SkipSanitization(bool)SpeechToText(Action<ChatSpeechToTextSettingsBuilder>)SpeechToText(bool)StatusField(string)SuggestedActionsLayoutMode(SuggestionsLayoutMode)SuggestedActionsScrollable(bool)SuggestedActionsTemplate<TModel>(TemplateBuilder<TModel>)SuggestedActionsTemplateHandler(string)SuggestedActionsTemplateId(string)Suggestions(Action<ChatSuggestionFactory>)SuggestionsBehavior(ChatSuggestionsBehavior)SuggestionsLayoutMode(SuggestionsLayoutMode)SuggestionsScrollable(bool)SuggestionsTemplate<TModel>(TemplateBuilder<TModel>)SuggestionsTemplateHandler(string)SuggestionsTemplateId(string)TextField(string)TimestampField(string)TimestampTemplate<TModel>(TemplateBuilder<TModel>)TimestampTemplateHandler(string)TimestampTemplateId(string)TimestampVisibility(ChatTimestampVisibility)Toolbar(Action<ChatToolbarSettingsBuilder>)User(Action<ChatUserSettingsBuilder>)UserStatusTemplate<TModel>(TemplateBuilder<TModel>)UserStatusTemplateHandler(string)Width(string)
Not finding the help you need?
Contact Support