useDropdownMenu
Create custom dropdown menus without the extra component with useDropdownMenu
.
Make sure to spread through the returned props. If creating a navigation menu
(as described here), make sure
to provide the role='menu'
prop to automatically get correct keyboard focus handling.
API
import useDropdownMenu from 'react-overlays/DropdownMenu'
useDropdownMenu
(options: object) => voidParameters
options
objectflip
booleanAutomatically adjust the menu
drop
position based on viewport edge detectionoffset
[number, number]Define an offset distance between the Menu and the Toggle
show
booleanDisplay the menu manually, ignored in the context of a
Dropdown
usePopper
booleanopt in/out of using PopperJS to position menus. When disabled you must position it yourself.
rootCloseEvent
stringThe pointer event to listen for when determining "clicks outside" the menu for triggering a close.
popperConfig
objectOptions passed to the
usePopper
hook.