useMenuTriggerState
Manages state for a menu trigger. Tracks whether the menu is currently open, and controls which item will receive focus when it opens.
install | yarn add @react-stately/menu |
---|---|
version | 3.0.0 |
usage | import {useMenuTriggerState} from '@react-stately/menu' |
API#
useMenuTriggerState(
(props:
)):
Interface#
Properties
Name | Type | Description |
focusStrategy |
| Controls which item will be auto focused when the menu opens. |
isOpen | boolean | Whether the overlay is currently open. |
Methods
Method | Description |
toggle(
(focusStrategy:
| | null
)): void | Toggles the menu. |
open(): void | Opens the overlay. |
close(): void | Closes the overlay. |
Example#
See the docs for useMenuTrigger in react-aria for an example of useMenuTriggerState
.