reablocks
Version:
Component library for React
62 lines (60 loc) • 1.64 kB
TypeScript
import { CSSProperties, FC, LegacyRef } from 'react';
export declare const portals: string[];
export interface OverlayPortalRef {
/**
* Reference to the overlay portal element.
*/
ref?: LegacyRef<HTMLElement>;
}
/**
* Represents an event that occurs when an overlay portal is mounted.
*/
export interface OverlayPortalMountEvent {
/**
* The index of the overlay.
*/
overlayIndex: number;
/**
* The index of the portal.
*/
portalIndex: number;
/**
* The ID of the portal.
*/
portalId: string;
/**
* The index of the backdrop.
*/
backdropIndex: number;
}
export interface OverlayPortalProps {
/**
* If true, the overlay portal will be appended to the body.
*/
appendToBody?: boolean;
/**
* The class name of the overlay portal.
*/
className?: string;
/**
* The style of the overlay portal.
*/
style?: CSSProperties;
/**
* The id of the overlay portal.
*/
id?: string;
/**
* A function that returns the children of the overlay portal. It receives an object of type OverlayPortalMountEvent as an argument.
*/
children: (props: OverlayPortalMountEvent) => any;
/**
* A function that is called when the overlay portal mounts. It receives an object of type OverlayPortalMountEvent as an argument.
*/
onMount?: (event: OverlayPortalMountEvent) => void;
/**
* A function that is called when the overlay portal unmounts.
*/
onUnmount?: () => void;
}
export declare const OverlayPortal: FC<OverlayPortalProps & OverlayPortalRef>;