cancel
Description
Sets the function that closes a dropdownUsage
oncancel?: (ev: MouseEvent) => void;
Parameters
- ev - (object) a native HTML event object associated with the cancel action
Example
<script>
import { Dropdown, Calendar, Text } from "@svar-ui/svelte-core";
let popup;
function oncancel() {
popup = false;
}
</script>
<div class="datepicker" onclick={() => (popup = true)} >
<Text />
{#if popup }
<Dropdown {oncancel} position={"top"} >
<Calendar value={new Date(2023, 2, 15)} />
</Dropdown>
{/if}
</div>
<style>
.datepicker {
position: relative;
width: 300px;
}
</style>
Related article: Showing/hiding Dropdown