tooltipText or tooltipContent, which means every control built on InteractableBase.Tooltip surface.ContextMenu and VerticalMenu, which are anchored as focusable tooltip content on their trigger.useToast and rendered by ToastContainer.Modal opens when its subtitle is truncated.App creates that root for you: a full-size, pointer-transparent layer that is the last child of its content root, published through FloatingPortalRootProvider. Ordinary applications should let App own this API.import {useState, type ReactNode} from 'react';
import {FloatingPortalRootProvider} from '@wearables-ui-toolkit/mrbd';
import styles from './EmbeddedSurface.module.css';
export function EmbeddedSurface({children}: {children: ReactNode}) {
const [portalRoot, setPortalRoot] = useState<HTMLDivElement | null>(null);
return (
<div className={styles.surface}>
<FloatingPortalRootProvider root={portalRoot}>
{children}
</FloatingPortalRootProvider>
<div className={styles.overlayLayer} ref={setPortalRoot} />
</div>
);
}
.surface {
position: relative;
overflow: hidden;
border-radius: var(--uit-corner-radius-medium);
background: var(--uit-color-background-window);
}
.overlayLayer {
position: absolute;
inset: 0;
pointer-events: none;
}
pointer-events: none so it never intercepts input meant for the content below, and make the region a positioned ancestor so absolute coordinates resolve against it.FloatingPortalRootProviderFloatingPortalRootProviderProps. Both props are required.| Prop | Type | Default | Description |
|---|---|---|---|
root | HTMLElement \| null | — | Element floating content is portalled into. Required. null is a valid transient value while the element is still mounting, and suppresses floating content until it resolves. |
children | ReactNode | — | Subtree that uses this root. Required. |
useFloatingPortalRoot()import {useFloatingPortalRoot} from '@wearables-ui-toolkit/mrbd';
const portalRoot: HTMLElement | null = useFloatingPortalRoot();
FloatingPortalRootProvider value — including an explicit null, which is honored rather than falling through.document.body when no provider is present.null when there is no document, so server rendering is safe.import {createPortal} from 'react-dom';
import {useFloatingPortalRoot} from '@wearables-ui-toolkit/mrbd';
import type {ReactNode} from 'react';
function Overlay({children}: {children: ReactNode}) {
const portalRoot = useFloatingPortalRoot();
return portalRoot == null ? null : createPortal(children, portalRoot);
}
document.body, and absolute positioning offset by the root’s bounding rectangle otherwise. A scoped root and the document body therefore produce the same on-screen placement.pointer-events: none without breaking the popups it hosts.App own the portal root in ordinary applications so all overlays share one coordinate and theme context.useFloatingPortalRoot instead of querying the DOM.null before portalling because the root can be unresolved or unavailable during server rendering.