Skip to main content

cancel

Description

Fires when closing the Month view after date selection

Usage

oncancel?: () => void; 

Example

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

let value = new Date();
let showMonth = false;
const show = () => {
showMonth = true;
};
const onchange = ev => {
value = ev.value;
};
const oncancel = () => {
showMonth = false;
};

</script>

<div class="demo-box" style="width: 300px">
<div style="margin: 20px;">{value}</div>
<div style="margin: 20px;">
<Button onclick={show}>Open month</Button>
</div>
{#if showMonth}
<Month {value} part="normal" current={value} {onchange} {oncancel} />
{/if}
</div>