Click-Away Listener
The Click-Away Listener component detects when a click event happens outside of its child element.
ClickAwayListener API
Import
import { ClickAwayListener } from '@mui/base/ClickAwayListener';
// or
import { ClickAwayListener } from '@mui/base';
Name | Type | Default | Description |
---|---|---|---|
children* | element | - | The wrapped element. |
onClickAway* | func | - | Callback fired when a "click away" event is detected. |
disableReactTree | bool | false | If |
mouseEvent | 'onClick' | 'onMouseDown' | 'onMouseUp' | 'onPointerDown' | 'onPointerUp' | false | 'onClick' | The mouse event to listen to. You can disable the listener by providing |
touchEvent | 'onTouchEnd' | 'onTouchStart' | false | 'onTouchEnd' | The touch event to listen to. You can disable the listener by providing |
The component cannot hold a ref.