@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
35 lines (34 loc) • 1.19 kB
TypeScript
import { Factory } from '../../core';
export interface BasePortalProps extends React.ComponentProps<'div'> {
/**
* Target element where portal should be rendered. Accepts:
* - HTMLElement: Renders portal inside this element
* - string: CSS selector - renders inside first matching element
* - undefined: Uses shared portal node or creates new one based on `reuseTargetNode`
*
* Note: If selector doesn't match any element, portal will not render
*/
target?: HTMLElement | string;
/**
* When true and target is not specified, all Portal instances share a single
* container node appended to document.body. When false, each Portal creates
* its own container node.
*
* Has no effect when target is specified.
*
* @default true
*/
reuseTargetNode?: boolean;
}
export interface PortalProps extends BasePortalProps {
/** Content to render inside the portal */
children: React.ReactNode;
}
export type PortalFactory = Factory<{
props: PortalProps;
ref: HTMLDivElement;
}>;
export declare const Portal: import("../..").MantineComponent<{
props: PortalProps;
ref: HTMLDivElement;
}>;