click
type ClickEvent {
detail:{
// clicked control
item: {
id: string;
comp: string;
}
}
}
onClick(ev: ClickEvent):void
event occurs when a control element, such as a button or icon, is clicked. It can be used to handle user interactions with specific controls.
Usage
Handling control clicks
<script>
const items = [
{ id: "name", comp: "button" },
{ id: "email", comp: "button" },
];
function handler(ev) {
const { item } = ev.detail;
console.log("clicked control", item.id);
}
</script>
<Toolbar {items} on:click={handler} />