UNPKG

1.89 kBTypeScriptView Raw
1import * as React from "react";
2import { Props } from "../../common";
3import { ValidationMap } from "../../common/context";
4export interface PortalProps extends Props {
5 /** Contents to send through the portal. */
6 children: React.ReactNode;
7 /**
8 * Callback invoked when the children of this `Portal` have been added to the DOM.
9 */
10 onChildrenMount?: () => void;
11 /**
12 * The HTML element that children will be mounted to.
13 *
14 * @default PortalProvider#portalContainer ?? document.body
15 */
16 container?: HTMLElement;
17 /**
18 * A list of DOM events which should be stopped from propagating through this portal element.
19 *
20 * @see https://legacy.reactjs.org/docs/portals.html#event-bubbling-through-portals
21 * @see https://github.com/palantir/blueprint/issues/6124
22 */
23 stopPropagationEvents?: Array<keyof HTMLElementEventMap>;
24}
25export interface PortalLegacyContext {
26 /** Additional CSS classes to add to all `Portal` elements in this React context. */
27 blueprintPortalClassName?: string;
28}
29/**
30 * Portal component.
31 *
32 * This component detaches its contents and re-attaches them to document.body.
33 * Use it when you need to circumvent DOM z-stacking (for dialogs, popovers, etc.).
34 * Any class names passed to this element will be propagated to the new container element on document.body.
35 *
36 * Portal supports both the newer React context API and the legacy context API.
37 * Support for the legacy context API will be removed in Blueprint v6.0.
38 *
39 * @see https://blueprintjs.com/docs/#core/components/portal
40 */
41export declare function Portal({ className, stopPropagationEvents, container, onChildrenMount, children }: PortalProps, legacyContext?: PortalLegacyContext): React.ReactPortal | null;
42export declare namespace Portal {
43 var displayName: string;
44 var contextTypes: ValidationMap<PortalLegacyContext>;
45}