📄 primereact/hooks/useoverlaylistener

File: useoverlaylistener.md | Updated: 11/15/2025

Source: https://primereact.org/hooks/useoverlaylistener/

Introducing PrimeReact v11 Alpha 🥁Learn More

useOverlayListener

Composition of commonly used overlay hooks.

Import#


import { useOverlayListener } from 'primereact/hooks';
         

Copy

Basic#


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

Show

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

Copy

  • Import

  • Basic

PrimeReact 10.9.7 by PrimeTek