useOverlay

Provides the behavior for overlays such as dialogs, popovers, and menus. Hides the overlay when the user interacts outside it, when the Escape key is pressed, or optionally, on blur. Only the top-most overlay will close at once.

installyarn add react-aria
version3.20.0
usageimport {useOverlay} from 'react-aria'

API#


useOverlay( (props: AriaOverlayProps, , ref: RefObject<Element> )): OverlayAria

Example#


See useDialog and useOverlayTrigger for examples of using useOverlay to provide common overlay behavior to a component.