You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
779 B
42 lines
779 B
2 years ago
|
import { DownOutlined } from '@ant-design/icons';
|
||
|
import type { MenuProps } from 'antd';
|
||
|
import { Dropdown, Menu, message, Space } from 'antd';
|
||
|
import React from 'react';
|
||
|
|
||
|
const onClick: MenuProps['onClick'] = ({ key }) => {
|
||
|
message.info(`Click on item ${key}`);
|
||
|
};
|
||
|
|
||
|
const menu = (
|
||
|
<Menu
|
||
|
onClick={onClick}
|
||
|
items={[
|
||
|
{
|
||
|
label: '1st menu item',
|
||
|
key: '1',
|
||
|
},
|
||
|
{
|
||
|
label: '2nd menu item',
|
||
|
key: '2',
|
||
|
},
|
||
|
{
|
||
|
label: '3rd menu item',
|
||
|
key: '3',
|
||
|
},
|
||
|
]}
|
||
|
/>
|
||
|
);
|
||
|
|
||
|
const App: React.FC = () => (
|
||
|
<Dropdown overlay={menu}>
|
||
|
<a onClick={e => e.preventDefault()}>
|
||
|
<Space>
|
||
|
Hover me, Click menu item
|
||
|
<DownOutlined />
|
||
|
</Space>
|
||
|
</a>
|
||
|
</Dropdown>
|
||
|
);
|
||
|
|
||
|
export default App;
|