ChatBuilder

Properties

WriteAction - Func

Methods

BindTo(System.Collections.Generic.IEnumerable)

Binds the component to an IEnumerable collection.

Parameters

data - System.Collections.Generic.IEnumerable<ChatMessage>

The IEnumerable collection.

RETURNS

Returns the current ChatBuilder instance.

Example

Razor
 
                @(Html.Kendo().Chat()
                     .Name("chat")
                     .BindTo(new List<ChatMessage>
                     {
                         new ChatMessage { Text = "Text1" },
                         new ChatMessage { Text = "Text2" }
                     }))
             

DataSource(System.Action)

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

Parameters

configurator - System.Action<DataSourceBuilder>

The action that configures the DataSource.

RETURNS

Returns the current ChatBuilder instance.

Example

Razor
 
            @(Html.Kendo().Chat()
                .Name("chat")
                .DataSource(source =>
                {
                    source.Read(read =>
                    {
                        read.Action("GetChatMessages", "Home");
                    })
                })
            )
             

DataSource(System.String)

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

Parameters

dataSourceId - System.String

The dataSource id that configures the DataSource.

RETURNS

Returns the current ChatBuilder instance.

Example

Razor
 
            @(Html.Kendo().Chat()
                .Name("chat")
                .DataSource("myDataSource")
            )
             

MessageWidthMode(Kendo.Mvc.UI.MessageWidthMode)

Sets the messages width mode.

Parameters

mode - MessageWidthMode

RETURNS

Returns the current ChatBuilder instance.

User(System.Action)

Configures the user information of the Chat.

Parameters

configurator - System.Action<ChatUserSettingsBuilder>

The configurator for the user setting.

RETURNS

Returns the current instance of ChatBuilder .

Toolbar(System.Action)

Configures the toolbar of the Chat.

Parameters

configurator - System.Action<ChatToolbarSettingsBuilder>

The configurator for the toolbar setting.

RETURNS

Returns the current instance of ChatBuilder .

FilesTemplateId(System.String)

The template used to render file attachments in messages.

Parameters

templateId - System.String

The ID of the template element for FilesTemplate

RETURNS

Returns the current ChatBuilder instance.

FilesTemplateHandler(System.String)

The template used to render file attachments in messages.

Parameters

templateHandler - System.String

The handler that returs the template for FilesTemplate

RETURNS

Returns the current ChatBuilder instance.

FilesTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

The template used to render file attachments in messages.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the filestemplate.

RETURNS

Returns the current ChatBuilder instance.

MessageGroupTemplateId(System.String)

The template used to render message groups.

Parameters

templateId - System.String

The ID of the template element for MessageGroupTemplate

RETURNS

Returns the current ChatBuilder instance.

MessageGroupTemplateHandler(System.String)

The template used to render message groups.

Parameters

templateHandler - System.String

The handler that returs the template for MessageGroupTemplate

RETURNS

Returns the current ChatBuilder instance.

MessageGroupTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

The template used to render message groups.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the messagegrouptemplate.

RETURNS

Returns the current ChatBuilder instance.

MessageReferenceTemplateId(System.String)

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

Parameters

templateId - System.String

The ID of the template element for MessageReferenceTemplate

RETURNS

Returns the current ChatBuilder instance.

MessageReferenceTemplateHandler(System.String)

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

Parameters

templateHandler - System.String

The handler that returs the template for MessageReferenceTemplate

RETURNS

Returns the current ChatBuilder instance.

MessageReferenceTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

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

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the messagereferencetemplate.

RETURNS

Returns the current ChatBuilder instance.

MessageTemplateId(System.String)

The template used to render individual messages.

Parameters

templateId - System.String

The ID of the template element for MessageTemplate

RETURNS

Returns the current ChatBuilder instance.

MessageTemplateHandler(System.String)

The template used to render individual messages.

Parameters

templateHandler - System.String

The handler that returs the template for MessageTemplate

RETURNS

Returns the current ChatBuilder instance.

MessageTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

The template used to render individual messages.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the messagetemplate.

RETURNS

Returns the current ChatBuilder instance.

SuggestedActionsTemplateId(System.String)

The template used to render suggested actions.

Parameters

templateId - System.String

The ID of the template element for SuggestedActionsTemplate

RETURNS

Returns the current ChatBuilder instance.

SuggestedActionsTemplateHandler(System.String)

The template used to render suggested actions.

Parameters

templateHandler - System.String

The handler that returs the template for SuggestedActionsTemplate

RETURNS

Returns the current ChatBuilder instance.

SuggestedActionsTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

The template used to render suggested actions.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the suggestedactionstemplate.

RETURNS

Returns the current ChatBuilder instance.

SuggestionsTemplateId(System.String)

The template used to render message suggestions.

Parameters

templateId - System.String

The ID of the template element for SuggestionsTemplate

RETURNS

Returns the current ChatBuilder instance.

SuggestionsTemplateHandler(System.String)

The template used to render message suggestions.

Parameters

templateHandler - System.String

The handler that returs the template for SuggestionsTemplate

RETURNS

Returns the current ChatBuilder instance.

SuggestionsTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

The template used to render message suggestions.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the suggestionstemplate.

RETURNS

Returns the current ChatBuilder instance.

TimestampTemplateId(System.String)

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.

Parameters

templateId - System.String

The ID of the template element for TimestampTemplate

RETURNS

Returns the current ChatBuilder instance.

TimestampTemplateHandler(System.String)

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.

Parameters

templateHandler - System.String

The handler that returs the template for TimestampTemplate

RETURNS

Returns the current ChatBuilder instance.

TimestampTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

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.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the timestamptemplate.

RETURNS

Returns the current ChatBuilder instance.

HeaderItems(System.Action)

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.

Parameters

configurator - System.Action<AppBarItemFactory>

The configurator for the header items setting.

RETURNS

Returns the current instance of ChatBuilder .

AllowMessageCollapse(System.Boolean)

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

Parameters

value - System.Boolean

The value for AllowMessageCollapse

RETURNS

Returns the current ChatBuilder instance.

AllowMessageCollapse()

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

RETURNS

Returns the current ChatBuilder instance.

FileActions(System.Action)

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.).

Parameters

configurator - System.Action<ChatFileActionFactory>

The configurator for the fileactions setting.

RETURNS

Returns the current instance of ChatBuilder .

AutoBind(System.Boolean)

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.

Parameters

value - System.Boolean

The value for AutoBind

RETURNS

Returns the current ChatBuilder instance.

AuthorId(System.String)

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).

Parameters

value - System.String

The value for AuthorId

RETURNS

Returns the current ChatBuilder instance.

AuthorIdField(System.String)

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

Parameters

value - System.String

The value for AuthorIdField

RETURNS

Returns the current ChatBuilder instance.

AuthorImageAltTextField(System.String)

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

Parameters

value - System.String

The value for AuthorImageAltTextField

RETURNS

Returns the current ChatBuilder instance.

AuthorImageUrlField(System.String)

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

Parameters

value - System.String

The value for AuthorImageUrlField

RETURNS

Returns the current ChatBuilder instance.

AuthorNameField(System.String)

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

Parameters

value - System.String

The value for AuthorNameField

RETURNS

Returns the current ChatBuilder instance.

FileAttachment(System.Boolean)

Enables or disables file attachment functionality in the message input.

Parameters

value - System.Boolean

The value for FileAttachment

RETURNS

Returns the current ChatBuilder instance.

FilesField(System.String)

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

Parameters

value - System.String

The value for FilesField

RETURNS

Returns the current ChatBuilder instance.

Height(System.String)

Sets the height of the Chat component.

Parameters

value - System.String

The value for Height

RETURNS

Returns the current ChatBuilder instance.

IdField(System.String)

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

Parameters

value - System.String

The value for IdField

RETURNS

Returns the current ChatBuilder instance.

IsDeletedField(System.String)

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

Parameters

value - System.String

The value for IsDeletedField

RETURNS

Returns the current ChatBuilder instance.

IsPinnedField(System.String)

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

Parameters

value - System.String

The value for IsPinnedField

RETURNS

Returns the current ChatBuilder instance.

IsTypingField(System.String)

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

Parameters

value - System.String

The value for IsTypingField

RETURNS

Returns the current ChatBuilder instance.

MessageActions(System.Action)

Defines the collection of actions that will be rendered in the context menu for messages. By default, the Chat includes four actions: Reply, Copy, Pin, and Delete. 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" } - { name: "delete", text: "Delete", icon: "trash" }

Parameters

configurator - System.Action<ChatMessageActionFactory>

The configurator for the messageactions setting.

RETURNS

Returns the current instance of ChatBuilder .

Messages(System.Action)

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

Parameters

configurator - System.Action<ChatMessagesSettingsBuilder>

The configurator for the messages setting.

RETURNS

Returns the current instance of ChatBuilder .

MessageTimeFormat(System.String)

The format string used to display message timestamps.

Parameters

value - System.String

The value for MessageTimeFormat

RETURNS

Returns the current ChatBuilder instance.

MessageToolbarActions(System.Action)

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

Parameters

configurator - System.Action<ChatMessageToolbarActionFactory>

The configurator for the messagetoolbaractions setting.

RETURNS

Returns the current instance of ChatBuilder .

SkipSanitization(System.Boolean)

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.

Parameters

value - System.Boolean

The value for SkipSanitization

RETURNS

Returns the current ChatBuilder instance.

SkipSanitization()

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.

RETURNS

Returns the current ChatBuilder instance.

ReplyToIdField(System.String)

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

Parameters

value - System.String

The value for ReplyToIdField

RETURNS

Returns the current ChatBuilder instance.

SpeechToText(System.Boolean)

Enables or disables speech-to-text functionality in the message input.

Parameters

value - System.Boolean

The value for SpeechToText

RETURNS

Returns the current ChatBuilder instance.

SuggestedActionsScrollable(System.Boolean)

Enables or disables scrollable behavior for suggested actions.

Parameters

value - System.Boolean

The value for SuggestedActionsScrollable

RETURNS

Returns the current ChatBuilder instance.

SuggestedActionsScrollable()

Enables or disables scrollable behavior for suggested actions.

RETURNS

Returns the current ChatBuilder instance.

Suggestions(System.Action)

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.

Parameters

configurator - System.Action<ChatSuggestionFactory>

The configurator for the suggestions setting.

RETURNS

Returns the current instance of ChatBuilder .

SuggestionsScrollable(System.Boolean)

Enables or disables scrollable behavior for message suggestions.

Parameters

value - System.Boolean

The value for SuggestionsScrollable

RETURNS

Returns the current ChatBuilder instance.

SuggestionsScrollable()

Enables or disables scrollable behavior for message suggestions.

RETURNS

Returns the current ChatBuilder instance.

TextField(System.String)

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

Parameters

value - System.String

The value for TextField

RETURNS

Returns the current ChatBuilder instance.

TimestampField(System.String)

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

Parameters

value - System.String

The value for TimestampField

RETURNS

Returns the current ChatBuilder instance.

Width(System.String)

Sets the width of the Chat component.

Parameters

value - System.String

The value for Width

RETURNS

Returns the current ChatBuilder instance.

Dir(Kendo.Mvc.UI.TextDirection)

Specifies the text direction of the Chat.

Parameters

value - TextDirection

The value for Dir

RETURNS

Returns the current ChatBuilder instance.

Events(System.Action)

Configures the client-side events.

Parameters

configurator - System.Action<ChatEventBuilder>

The client events action.

RETURNS

Returns the current ChatBuilder instance.

Example

Razor
 
            @(Html.Kendo().Chat()
                  .Name("Chat")
                  .Events(events => events
                      .Input("onInput")
                  )
            )
             

ToComponent()

Returns the internal view component.

RETURNS

The instance that represents the component.

Expression(System.String)

Sets the name of the component.

Parameters

modelExpression - System.String

RETURNS

Returns the current instance.

Explorer(Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer)

Sets the name of the component.

Parameters

modelExplorer - Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer

RETURNS

Returns the current instance.

Name(System.String)

Sets the name of the component.

Parameters

componentName - System.String

The name.

RETURNS

Returns the current instance.

Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with

Parameters

deferred - System.Boolean

RETURNS

Returns a DeferredWidgetBuilder instance.

HtmlAttributes(System.Object)

Sets the HTML attributes.

Parameters

attributes - System.Object

The HTML attributes.

RETURNS

Returns the current instance.

HtmlAttributes(System.Collections.Generic.IDictionary)

Sets the HTML attributes.

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

The HTML attributes.

RETURNS

Returns the current instance.

ScriptAttributes(System.Object,System.Boolean)

Sets the JavaScript attributes to the initialization script.

Parameters

attributes - System.Object

The JavaScript attributes.

overrideAttributes - System.Boolean

Argument which determines whether attributes should be overriden.

RETURNS

Returns the current instance.

ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)

Sets the JavaScript attributes to the initialization script.

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

The JavaScript attributes.

overrideAttributes - System.Boolean

Argument which determines whether attributes should be overriden.

RETURNS

Returns the current instance.

Render()

Renders the component in place.

ToHtmlString()

Returns the HTML representation of the component.

WriteTo(System.IO.TextWriter,System.Text.Encodings.Web.HtmlEncoder)

Parameters

writer - System.IO.TextWriter
encoder - System.Text.Encodings.Web.HtmlEncoder

ToClientTemplate()

Returns the client template for the component.

AsModule(System.Boolean)

Specifies whether the initialization script of the component will be rendered as a JavaScript module.

Parameters

value - System.Boolean

RETURNS

Returns the current instance.

In this article
PropertiesWriteAction - FuncMethodsBindTo(System.Collections.Generic.IEnumerable)DataSource(System.Action)DataSource(System.String)MessageWidthMode(Kendo.Mvc.UI.MessageWidthMode)User(System.Action)Toolbar(System.Action)FilesTemplateId(System.String)FilesTemplateHandler(System.String)FilesTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)MessageGroupTemplateId(System.String)MessageGroupTemplateHandler(System.String)MessageGroupTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)MessageReferenceTemplateId(System.String)MessageReferenceTemplateHandler(System.String)MessageReferenceTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)MessageTemplateId(System.String)MessageTemplateHandler(System.String)MessageTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)SuggestedActionsTemplateId(System.String)SuggestedActionsTemplateHandler(System.String)SuggestedActionsTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)SuggestionsTemplateId(System.String)SuggestionsTemplateHandler(System.String)SuggestionsTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)TimestampTemplateId(System.String)TimestampTemplateHandler(System.String)TimestampTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)HeaderItems(System.Action)AllowMessageCollapse(System.Boolean)AllowMessageCollapse()FileActions(System.Action)AutoBind(System.Boolean)AuthorId(System.String)AuthorIdField(System.String)AuthorImageAltTextField(System.String)AuthorImageUrlField(System.String)AuthorNameField(System.String)FileAttachment(System.Boolean)FilesField(System.String)Height(System.String)IdField(System.String)IsDeletedField(System.String)IsPinnedField(System.String)IsTypingField(System.String)MessageActions(System.Action)Messages(System.Action)MessageTimeFormat(System.String)MessageToolbarActions(System.Action)SkipSanitization(System.Boolean)SkipSanitization()ReplyToIdField(System.String)SpeechToText(System.Boolean)SuggestedActionsScrollable(System.Boolean)SuggestedActionsScrollable()Suggestions(System.Action)SuggestionsScrollable(System.Boolean)SuggestionsScrollable()TextField(System.String)TimestampField(System.String)Width(System.String)Dir(Kendo.Mvc.UI.TextDirection)Events(System.Action)ToComponent()Expression(System.String)Explorer(Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer)Name(System.String)Deferred(System.Boolean)HtmlAttributes(System.Object)HtmlAttributes(System.Collections.Generic.IDictionary)ScriptAttributes(System.Object,System.Boolean)ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)Render()ToHtmlString()WriteTo(System.IO.TextWriter,System.Text.Encodings.Web.HtmlEncoder)ToClientTemplate()AsModule(System.Boolean)
Not finding the help you need?
Contact Support