v0.0.14
attachments

Portal

Moves an element to a different part of the DOM (e.g., document.body). Useful for modals, tooltips, or overlays.

source
portal content
target

Usage

<script>
    import { portal } from 'svxui';
</script>

<div
    {@attach portal({
        // Enable/disable portal
        enabled: true,
        // Define portal target
        target: '#target'
    })}
>
    content
</div>

<!-- elsewhere in the application -->
<div id="target">target</div>

API Reference

PortalOptions

PropertyTypeDefaultDescription
enabled
boolean
trueEnable/disable portal
target
union
'body'Portal target