useOverlayListener

Composition of commonly used overlay hooks.


import { useOverlayListener } from 'primereact/hooks';
         

This hook combines the features of useClickOutside, useOverlayScrollListener and useResizeListener to handle popups positioned relative to another element.


const [bindOverlayListener, unbindOverlayListener] = useOverlayListener({
    target: buttonRef.current,
    overlay: overlayRef.current,
    listener: handleScroll,
    options: { passive: true },
    when: visible
});