API reference
components/overlay-root
Import
Section titled “Import”import * as api from "@fungi.computer/caps/components/overlay-root";Exports
Section titled “Exports”| 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”type OverlayLayer = "popover" | "dialog" | "toast" | "tooltip";Semantic destinations; the host owns their paint order and positioning.
OverlayContainerstype alias
Section titled “OverlayContainers”type OverlayContainers = Readonly<Record<OverlayLayer, HTMLElement | null>>;Host portal roots; null keeps an overlay waiting until its layer mounts.
OverlayRoot()function
Section titled “OverlayRoot()”function OverlayRoot(__namedParameters): Element;Supply shell portal roots without teaching Caps about the shell’s layout.
Parameters
Section titled “Parameters”| 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. |
Returns
Section titled “Returns”Element
useOverlayRoot()function
Section titled “useOverlayRoot()”function useOverlayRoot(layer): HTMLElement | null;Wait for a provided root; standalone overlays use the current document body.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
layer |
OverlayLayer |
Returns
Section titled “Returns”HTMLElement | null
useOverlayDismiss()function
Section titled “useOverlayDismiss()”function useOverlayDismiss(dismiss): void;Retire a transient overlay when its owning host requests light dismissal.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
dismiss |
() => void |
Returns
Section titled “Returns”void