Actions

Portal

Description

The Portal action can be used to move an element to another location in the DOM, this can be useful for example when you want to render overlays on your body.

Usage

<script lang="ts">
    import { portal, type PortalParameters } from 'action-archive';

    const portalParameters: PortalParameters = {
        target: document.body
    };
</script>

<div use:portal={portalParameters} />

Example

Portal me!

#container1

#container2

API

Parameters

NameTypeDefaultDescription
targetHTMLElement | stringdocument.bodyElement or query selected element the element will be appended to.
disabledbooleanfalseDisables the action.