Skip to main content

cancel

Description

a function which is called on click of the Cancel button

Type

function

Parameters

The callback of the event can take an object with the following parameter:

  • button (string) - (optional) the value is set to "cancel" if the event fires on the button click.

In case the event fires on pressing ENTER or ESC, the callback function takes no parameters.

Example

<script>
import { Modal, Text, Portal, Button } from "wx-svelte-core";

let custom1;
function hideAll() {
custom1 = false;
}
</script>

{#if custom1}
<Portal>
<Modal title="Custom Prompt" oncancel={hideAll}>
<Text select={true} focus={true} value="Some" />
</Modal>
</Portal>
{/if}

Related article: Providing the buttons' functionality

Related sample: Messages