Skip to content
API reference

components/overlay-root

Import
import * as api from "@fungi.computer/caps/components/overlay-root";
Kind Export Description
type alias OverlayLayer Semantic destinations; the host owns their paint order and positioning.
type alias OverlayContainers Host portal roots; null keeps an overlay waiting until its layer mounts.
function OverlayRoot() Supply shell portal roots without teaching Caps about the shell’s layout.
function useOverlayRoot() Wait for a provided root; standalone overlays use the current document body.
function useOverlayDismiss() Retire a transient overlay when its owning host requests light dismissal.

OverlayLayertype alias

Section titled “OverlayLayer”
Signature
type OverlayLayer = "popover" | "dialog" | "toast" | "tooltip";

Semantic destinations; the host owns their paint order and positioning.


OverlayContainerstype alias

Section titled “OverlayContainers”
Signature
type OverlayContainers = Readonly<Record<OverlayLayer, HTMLElement | null>>;

Host portal roots; null keeps an overlay waiting until its layer mounts.

OverlayRoot()function

Section titled “OverlayRoot()”
Signature
function OverlayRoot(__namedParameters): Element;

Supply shell portal roots without teaching Caps about the shell’s layout.

Parameter Type Description
__namedParameters { containers: OverlayContainers; children?: ReactNode; subscribeDismiss?: (listener) => () => void; } -
__namedParameters.containers OverlayContainers -
__namedParameters.children? ReactNode -
__namedParameters.subscribeDismiss? (listener) => () => void Subscribe to the host losing focus to a child surface or another window.

Element


useOverlayRoot()function

Section titled “useOverlayRoot()”
Signature
function useOverlayRoot(layer): HTMLElement | null;

Wait for a provided root; standalone overlays use the current document body.

Parameter Type
layer OverlayLayer

HTMLElement | null


useOverlayDismiss()function

Section titled “useOverlayDismiss()”
Signature
function useOverlayDismiss(dismiss): void;

Retire a transient overlay when its owning host requests light dismissal.

Parameter Type
dismiss () => void

void