Skip to main content

oncancel

Description

Sets the function that closes a popup

Usage

oncancel?: (ev: MouseEvent) => void;

Parameters

  • ev – the event object associated with the cancel action

Example

<script>
import { Button, Popup} from "@svar-ui/svelte-core";

let showPopup = false;

function onclick() {
showPopup = true;
}

function oncancel() {
showPopup = false;
}
</script>

<div>
<Button {onclick}>Show Popup</Button>
</div>

{#if showPopup}
<Popup {onclick} {oncancel}>
<div class="popup">
<p>Some text here and there</p>
</div>
</Popup>
{/if}

Related article: Showing/hiding Popup

Related sample: Popup