useRootClose

    API

    import useRootClose from 'react-overlays/useRootClose'
    • useRootClose(ref: Ref<HTMLElement> | HTMLElement, onRootClose: function, options?: object) => void

      The useRootClose hook registers your callback on the document when rendered. Powers the <Overlay/> component. This is used achieve modal style behavior where your callback is triggered when the user tries to interact with the rest of the document or hits the esc key.

      Parameters

      • refRef<HTMLElement> | HTMLElement

        The element boundary

      • onRootClosefunction
      • options?object
        • disabled?boolean
        • clickTrigger?string

          The DOM event name (click, mousedown, etc) to attach listeners on