Skip to content

Examples

Interactive demos of basic teleporting, modes, modals, toasts, context through In, and popovers.

Basic portal

Edit the message or toggle the source. The outlet updates live.

Source / Portal.In

Content mounted here travels to the outlet below.

Outlet / Portal.Out

Modes

single keeps the latest In; multiple stacks them all.

single

Only the last mounted In appears.

multiple

Every mounted In appears at the outlet.

Modal dialog

Trigger from nested UI. The overlay teleports to a host outlet.

App chrome Modal.Out host

Open a dialog from nested UI. The overlay renders at the host outlet, not where the trigger lives.

Nested panel

Profile settings sit deep in the tree.

Toast tray

Nested actions push content into shared chrome through a multiple-mode tunnel.

App chrome

Fire toasts from nested UI. They render in the top bar via a tunnel.

Context through In

Context set above In is available inside teleported content.

Context above ContextTunnel.In

Context is set on the parent of In. The consumer reads it from inside the tunnel content.

Outlet / ContextTunnel.Out

Teleported content still sees the context from above In.

Popover

Tunnel renders popover at a host outlet to avoid overflow/z-index clipping.

App chrome Popover.Out host

Open a menu from a clipped, low-z panel. The popover teleports to the host outlet so it isn't cut off by overflow: hidden.

overflow: hidden · z-index: 0

Without a tunnel, a local popover would be clipped here.

Snippet

Svelte
import { tunnel } from '@bridge-stack/svelte-tunnel';

const Modal = tunnel();

// host / overlay root
<Modal.Out />

// deep in the tree
{#if open}
  <Modal.In>
    <div role="dialog">…</div>
  </Modal.In>
{/if}