| import React from 'react'; | |
| import type { MenuProps } from 'antd'; | |
| import { Dropdown, theme } from 'antd'; | |
| const items: MenuProps['items'] = [ | |
| { | |
| label: '1st menu item', | |
| key: '1', | |
| }, | |
| { | |
| label: '2nd menu item', | |
| key: '2', | |
| }, | |
| { | |
| label: '3rd menu item', | |
| key: '3', | |
| }, | |
| ]; | |
| const App: React.FC = () => { | |
| const { | |
| token: { colorBgLayout, colorTextTertiary }, | |
| } = theme.useToken(); | |
| return ( | |
| <Dropdown menu={{ items }} trigger={['contextMenu']}> | |
| <div | |
| style={{ | |
| color: colorTextTertiary, | |
| background: colorBgLayout, | |
| height: 200, | |
| textAlign: 'center', | |
| lineHeight: '200px', | |
| }} | |
| > | |
| Right Click on here | |
| </div> | |
| </Dropdown> | |
| ); | |
| }; | |
| export default App; | |