suggestionsTemplateFunction
The template used to render message suggestions. The individual suggestion elements must have the k-suggestion
class. The wrapping element must have the ref-chat-suggestion-group
attribute.
Example
<div id="chat"></div>
<script>
let messagesData = [
{
id: 1,
text: "What would you like to do today? Check out the custom suggestions below:",
authorId: "assistant",
authorName: "Virtual Assistant",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg",
timestamp: new Date(2026, 0, 1, 9, 0)
},
{
id: 2,
text: "I'd like to check the weather please.",
authorId: "user",
authorName: "User",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/LONEP.jpg",
timestamp: new Date(2026, 0, 1, 9, 5)
}
];
$("#chat").kendoChat({
suggestions: [
{ text: "Check Weather" },
{ text: "Set Reminder" },
{ text: "Play Music" },
{ text: "Get News" },
{ text: "Help" }
],
suggestionsTemplate: function(suggestions) {
let html = "<div class='custom-suggestions' ref-chat-suggestion-group>";
for (let i = 0; i < suggestions.length; i++) {
html += "<button class='custom-suggestion-btn k-suggestion'>" + suggestions[i].text + "</button>";
}
html += "</div>";
return html;
},
authorId: "user",
dataSource: messagesData
});
</script>
In this article