useMenuTriggerState
Manages state for a menu trigger. Tracks whether the menu is currently open,
and controls which item will receive focus when it opens.
useMenuTriggerState(
(props: MenuTriggerProps
)): MenuTriggerState
Properties
Name | Type | Description |
focusStrategy | FocusStrategy | Controls which item will be auto focused when the menu opens. |
isOpen | boolean | Whether the overlay is currently open. |
Methods
Method | Description |
open(
(focusStrategy?: FocusStrategy
| | null
)): void | Opens the menu. |
toggle(
(focusStrategy?: FocusStrategy
| | null
)): void | Toggles the menu. |
setOpen(
(isOpen: boolean
)): void | Sets whether the overlay is open. |
close(): void | Closes the overlay. |
See the docs for useMenu in react-aria for an example of useMenuTriggerState
.