messageGroupTemplateFunction
The template used to render message groups.
Example
<div id="chat"></div>
<script>
let messagesData = [
{
id: 1,
text: "This is the first message in a group from John.",
authorId: "user1",
authorName: "John Doe",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg",
timestamp: new Date(2026, 0, 1, 9, 0)
},
{
id: 2,
text: "This is another message from John in the same group.",
authorId: "user1",
authorName: "John Doe",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg",
timestamp: new Date(2026, 0, 1, 9, 1)
},
{
id: 3,
text: "This message is from Jane, starting a new message group.",
authorId: "user2",
authorName: "Jane Smith",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/LONEP.jpg",
timestamp: new Date(2026, 0, 1, 9, 5)
}
];
$("#chat").kendoChat({
messageGroupTemplate: function(data) {
return "<div class='custom-message-group'>" +
"<span class='custom-author'>" + data.author.name + "</span>" +
"<div class='custom-message-content'>" + data.message.text + "</div>" +
"</div>";
},
authorId: "user2",
dataSource: messagesData
});
</script>
In this article