ClickAwayListener

ClickAwayListener

Listen for click events that occur somewhere in the document, outside of the element itself. For instance, if you need to hide a menu when people click anywhere else on your page.

Props

Name Type Default Description
children * node  
mouseEvent enum: 'onClick' |
 'onMouseDown' |
 'onMouseUp' |
 false
'onMouseUp'
onClickAway * func  
touchEvent enum: 'onTouchStart' |
 'onTouchEnd' |
 false
'onTouchEnd'

Any other properties supplied will be spread to the root element (EventListener).

Inheritance

The properties of the EventListener component, from react-event-listener, are also available. You can take advantage of this behavior to target nested components.

Demos