bit Bheadless

Portal

Renders children into a different part of the DOM tree (a body-level container by default). Useful for tooltips, dropdowns, and modals that need to escape overflow or z-index stacking contexts.

Implementation: CSS Tailwind

Basic Portal

Toggle the portal on and off. When enabled, the content is teleported to a container appended to <body>, escaping any overflow or z-index constraints of its parent. Inspect the DOM to see the element move.

This box has overflow: hidden.

I'm portalled content!

✓ I'm rendered at the end of <body>, escaping the overflow box.

Tooltip escaping stacking context

A common use case: a tooltip that needs to escape a parent with overflow: hidden or a restrictive z-index. The portal moves the tooltip to body level so it's always visible.

This container has overflow: hidden and z-index: 1.

Hover me for a tooltip

Portal Group (shared target)

Use BitBhPortalGroup to direct all nested portals into a shared container element instead of the default body-level root. This is useful when you want portalled content to land in a specific region of your layout.

Portal Group target container (portals land here):

Disabled portal (render in place)

Set Enabled="false" to render content in its natural DOM position without teleportation. This is useful for conditional portalling based on viewport size or other runtime conditions.

Container with overflow: hidden.

Rendered in place.

An unhandled error has occurred. Reload 🗙