New to Telerik UI for BlazorStart a free 30-day trial

Data Binding

Updated on Aug 31, 2026

The Telerik UI for Blazor Chat component supports data binding to collections of messages and provides flexible field mapping to accommodate different data models.

Bind to Data

To bind the Chat to data, set its Data parameter to an IEnumerable<T> where T represents your message model. The Chat items have features that map to properties in the model. The following example uses property model names that work automatically, with no additional field mapping.

Chat basic data binding

Example
View Source
Loading ...

Field Mapping

The Chat component provides field mapping parameters to work with different data models. Use these parameters to specify which properties in your data model correspond to Chat features:

Property NameDescriptionDefault Value
TextFieldThe message text content"Text"
AuthorIdFieldThe author/user ID"AuthorId"
AuthorImageUrlFieldThe author/user avatar image"AuthorImageUrl"
AuthorNameFieldThe author display name"AuthorName"
TimestampFieldThe message timestamp"Timestamp"
IdFieldthe unique message ID"Id"
FilesFieldFile attachments"Files"
StatusFieldMessage status"Status"
IsDeletedFieldIndicates if the message is deleted"IsDeleted"
IsFailedFieldIndicates if the message has failed"IsFailed"
IsPinnedFieldIndicaties if the message is pinned"IsPinned"
IsTypingFieldIndicaties if the message author is currently typing"IsTyping"
ReplyToIdFieldThe ID of replied message"ReplyToId"
SuggestedActionsFieldPredefined quick replies"SuggestedActions"

Using custom Chat model property names

RAZOR
<TelerikChat AuthorIdField="@nameof(Message.UserId)"
             AuthorNameField="@nameof(Message.UserName)"
             TextField="@nameof(Message.Content)">
</TelerikChat>

@code {
    public class Message
    {
        public string Id { get; set; } = Guid.NewGuid().ToString();
        public string UserId { get; set; } = string.Empty;
        public string UserName { get; set; } = string.Empty;
        public string Content { get; set; } = string.Empty;
        public DateTime Timestamp { get; set; } = DateTime.Now;
        public string Status { get; set; } = "Sent";
    }
}

Dynamic Updates

The Chat component automatically reflects changes to the bound data collection. You can add, modify, or remove messages programmatically.

Example
View Source
Loading ...

See Also