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 click={() => (custom = !custom)}>Show Dialog</Button>
{#if custom}
<Portal target={box}>
<Modal>
<TextArea placeholder="Some text" />
<div slot="buttons" style="margin-top: 20px;">
<Button click={hideAll}>Yes</Button>
<Button click={hideAll}>No</Button>
<Button click={hideAll}>Maybe</Button>
</div>
</Modal>
</Portal>
{/if}

Related article: Setting the target