@serendie/ui
Version:
Adaptive UI component library as part of Serendie Design System by Mitsubishi Electric
22 lines (21 loc) • 766 B
TypeScript
/**
* ModalDialog/Drawer内にある場合、自動的にそのコンテンツ要素をポータルコンテナとして検出するフック
*
* @param portalled - Portalを使用するかどうか
* @returns triggerRef - トリガー要素に設定するref
* @returns portalContainerRef - Portalのcontainerプロパティに渡すref
*
* @example
* ```tsx
* const { triggerRef, portalContainerRef } = useAutoPortalContainer(portalled);
*
* <Trigger ref={triggerRef}>...</Trigger>
* <Portal container={portalContainerRef}>...</Portal>
* ```
*/
export declare const useAutoPortalContainer: (portalled: boolean) => {
triggerRef: import('react').RefObject<HTMLElement>;
portalContainerRef: {
current: HTMLElement;
} | undefined;
};