Loading...

Dropdown menu

import { Menu, Dropdown } from '@antv/x6-react-components'
import '@antv/x6-react-components/es/menu/style/index.css'
import '@antv/x6-react-components/es/dropdown/style/index.css'
const menu = (
<Menu>
<Menu.Item key="1">1st menu item</Menu.Item>
<Menu.Item key="2">2nd menu item</Menu.Item>
<Menu.Item key="3">3rd menu item</Menu.Item>
</Menu>
)
<Dropdown overlay={menu}>
<a href="#">Hover me</a>
</Dropdown>
<Dropdown overlay={menu} trigger={['contextMenu']}>
<span style={{ userSelect: 'none' }}>Right Click on Me</span>
</Dropdown>

Dropdown

ParameterDescriptionTypeDefault Value
classNameCustom style namestring-
overlayMenu, typically using the Menu componentReactNode-
overlayClassNameClass name for the dropdown root elementstring-
overlayStyleStyle for the dropdown root elementCSSProperties-
disabledWhether the menu is disabledbooleanfalse
visibleWhether the menu is displayedbooleanfalse
triggerTrigger behavior, options are hover | click | contextMenu, can use an array to set multiple trigger behaviorsstring | string[]'hover'
placementPosition of the dropdown menu, options are top left right bottom topLeft topRight bottomLeft bottomRight leftTop leftBottom rightTop rightBottomstring'bottomLeft'
mouseEnterDelayWhen trigger is 'hover', the delay in seconds before the dropdown menu is displayed after mouse entersnumber0.15
mouseLeaveDelayWhen trigger is 'hover', the delay in seconds before the dropdown menu is hidden after mouse leavesnumber0.1
getPopupContainerParent node for rendering the menu. By default, it renders to the body. If you encounter positioning issues with scrolling, try changing it to the scrolling area and positioning it relative to that.(triggerNode: Element) => HTMLElement-
onVisibleChangeCalled when the visibility state of the menu changes(visible?: boolean) => void-