toolbarAction
Fired when a toolbar action is executed on a message. This event allows you to handle custom toolbar actions and respond to user interactions with message controls.
Event Data
e.type String
The type of toolbar action that was executed.
e.message Object
The message object associated with the action.
Example
<div id="chat"></div>
<script>
let messagesData = [
{
id: 1,
text: "Hello! How can I help you today?",
authorId: "support",
authorName: "Support Agent",
timestamp: new Date(2026, 0, 1, 9, 0)
}
];
$("#chat").kendoChat({
authorId: "user",
dataSource: messagesData,
messageToolbarActions: [
{ name: "like", text: "Like", icon: "heart" },
{ name: "translate", text: "Translate", icon: "globe" }
],
toolbarAction: function(e) {
console.log("Toolbar action executed:", e.type);
console.log("On message:", e.message.text);
if (e.type === "like") {
alert("You liked this message!");
} else if (e.type === "translate") {
alert("Translating message: " + e.message.text);
}
}
});
</script>
In this article