product | title | components | githubLabel |
---|---|---|---|
material-ui |
Detect click outside React component |
ClickAwayListener |
component: ClickAwayListener |
The Click-Away Listener component detects when a click event happens outside of its child element.
:::warning
Click-Away Listener is now part of the standalone MUI Base component library.
It is currently re-exported in @mui/material
for convenience, but it may be deprecated in a future major version of Material UI.
To continue using this component and avoid future breaking changes, we strongly recommend that you install MUI Base and import this component from the @mui/base
package:
import ClickAwayListener from '@mui/base/ClickAwayListener';
Please refer to the Click-Away Listener component page in the MUI Base docs for examples and details on usage. :::