Skip to content

Portal

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

Styled with CSS Tailwind

Basic Portal

Toggle the portal on and off. When enabled, the content moves to the app's BitBhPortalOutlet (or, without one, a container appended to <body>), escaping any overflow or z-index constraints of its parent. Inspect the DOM to see the element move. While portalled it is pinned to the bottom-right corner of the window (position: fixed), so you can see it outside the box.

This box has overflow: hidden.

I'm portalled content!

✓ I'm rendered at the end of <body>, outside 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 out of that parent 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 target. 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. While portalled it is pinned to the bottom-left corner of the window, outside the box.

Container with overflow: hidden.

Rendered in place.

An unhandled error has occurred. Reload 🗙