@firecms/ui
Version:
Awesome Firebase/Firestore-based headless open-source CMS
32 lines (31 loc) • 1 kB
TypeScript
import React from "react";
export interface PortalContainerContextType {
container: HTMLElement | null;
}
export interface PortalContainerProviderProps {
container: HTMLElement | null;
children: React.ReactNode;
}
/**
* Provider component that sets the portal container for all descendants.
* This can be used at any level of the tree to specify where portals should be attached.
*
* @example
* ```tsx
* const containerRef = useRef<HTMLDivElement>(null);
*
* <div ref={containerRef}>
* <PortalContainerProvider container={containerRef.current}>
* <YourComponents />
* </PortalContainerProvider>
* </div>
* ```
*/
export declare function PortalContainerProvider({ container, children }: PortalContainerProviderProps): React.JSX.Element;
/**
* Hook to access the portal container from context.
* Returns null if no provider is found in the tree.
*
* @returns The portal container element or null
*/
export declare function usePortalContainer(): HTMLElement | null;