Skip to main content

click

Description

adds a click handler to a button

Type

function

Example

<script>
function myFunction() {
showNotice({
text: "Button clicked",
});
}
</script>

<div>
<Button click={myFunction}>Click Me</Button>
</div>

Details

If the name of the handler function matches the name of the property, you can use the {click} shorthand:

<script>
function click() {
// some custom logic
};
</script>

<div>
<Button {click}>Click Me</Button>
</div>

Related article: Handling a button click

Related sample: Button