messageReferenceTemplateFunction
The template used to render message references (replies and pinned messages).
Example
<div id="chat"></div>
<script>
let messagesData = [
{
id: 1,
text: "This is the original message that can be replied to.",
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 a reply to the first message with custom reference template.",
authorId: "user2",
authorName: "Jane Smith",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/LONEP.jpg",
replyToId: 1,
timestamp: new Date(2026, 0, 1, 9, 5)
},
{
id: 3,
text: "This message is pinned and uses the reference template.",
authorId: "admin",
authorName: "Admin",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg",
timestamp: new Date(2026, 0, 1, 9, 10),
isPinned: true
}
];
$("#chat").kendoChat({
messageReferenceTemplate: function(data) {
return "<div class='custom-reference'>" +
"<span class='custom-reference-text'>" + data.text + "</span>" +
"</div>";
},
authorId: "user2",
dataSource: messagesData
});
</script>
In this article