useRootClose
API
import useRootClose from 'react-overlays/useRootClose'
useRootClose
(ref: Ref<HTMLElement> | HTMLElement, onRootClose: function, options?: object) => voidThe
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 theesc
key.Parameters
ref
Ref<HTMLElement> | HTMLElementThe element boundary
onRootClose
functionoptions?
objectdisabled?
booleanclickTrigger?
stringThe DOM event name (click, mousedown, etc) to attach listeners on