useOverlayTriggerState

Manages state for an overlay trigger. Tracks whether the overlay is open, and provides methods to toggle this state.

installyarn add @react-stately/overlays
version3.1.6
usageimport {useOverlayTriggerState} from '@react-stately/overlays'

API#


useOverlayTriggerState( (props: OverlayTriggerProps )): OverlayTriggerState

Interface#


Properties

NameTypeDescription
isOpenbooleanWhether the overlay is currently open.

Methods

MethodDescription
open(): voidOpens the overlay.
close(): voidCloses the overlay.
toggle(): voidToggles the overlay's visibility.

Example#


See the docs for useOverlayTrigger in react-aria for an example of useOverlayTriggerState.