Portal

Utilities · Guide 42 of 46

Open the live Portal demo →

Purpose

Renders children into another part of the DOM.

Import

<script lang="ts">
	import { Portal } from 'bits-ui';
</script>

The registry names Portal as this guide’s namespace. Copy the exact root and part composition from the live demo rather than guessing part names.

Usage checklist

  • Start from the working live pattern and keep the utility scope narrow.
  • Check server rendering, hydration, cleanup, and nested ownership where relevant.
  • Test the composed behavior rather than the helper in isolation.

Secondary reference

After using the local example, consult the upstream Bits UI reference for exhaustive API details.

Continue