Components
← All components

Portal

stimeo--portal

Moves an element elsewhere in the DOM (e.g. under body) on connect and cleans up on disconnect.

The stimeo--portal controller moves an element to another place in the DOM — the shared substrate for overlays that must escape an ancestor's overflow: hidden, transform, or stacking context. On connect it moves the content target (or this.element when there is none) into the first element matching to (default body), appended or prepended per position, leaving a comment placeholder to mark the original spot. On disconnect it returns the node there when restore is set, otherwise removes it, so no orphan is left behind (Turbo navigation included). The moved node carries data-portaled, and mount / unmount events fire with the destination. Behavior only — no positioning (pair with stimeo-ui/positioning) and no focus trapping (pair with a Focus Scope / the overlay). For Turbo prefer the content-target form so the controller stays on the in-place source and its disconnect reliably fires; the move is idempotent and survives the connect/disconnect churn some runtimes emit when an observed element is relocated.

running

The card is teleported to <body> on connect, so it escapes this clipped box and floats at the viewport corner.

I'm rendered under <body> — outside the dashed box above.

Use case: lift tooltips, popovers, or modals out of an ancestor's overflow: hidden, z-index, or transform so they are not clipped or mis-stacked.