Skip to main content

target

Description

the DOM node that receives the content sent by the Portal component

Type

object

Example

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

let custom, box;
function hideAll() {
custom = false;
}
</script>

<Button onclick={() => (custom = !custom)}>Show Dialog</Button>

{#if custom}
<Portal target={box}>
<Modal>
<TextArea placeholder="Some text" />
<div style="margin-top: 20px;">
<Button onclick={hideAll}>Yes</Button>
<Button onclick={hideAll}>No</Button>
<Button onclick={hideAll}>Maybe</Button>
</div>
</Modal>
</Portal>
{/if}

Related article: Setting the target