Portal

An attachment that mounts the element to a different location in the DOM.

Preview
Code

Basic Example

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

<div {@attach portal()}>
	Portal content
</div>

Changing the target

If mounting to the body isn’t what you need, pass the element you want to mount to as the first argument to the attachment.

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

<div {@attach portal('#layers')}>
	Portal content
</div>