mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-21 21:28:09 +08:00
29 lines
547 B
TypeScript
29 lines
547 B
TypeScript
|
import React, { useState } from 'react';
|
||
|
import { Button, Popover } from 'antd';
|
||
|
|
||
|
const App: React.FC = () => {
|
||
|
const [open, setOpen] = useState(false);
|
||
|
|
||
|
const hide = () => {
|
||
|
setOpen(false);
|
||
|
};
|
||
|
|
||
|
const handleOpenChange = (newOpen: boolean) => {
|
||
|
setOpen(newOpen);
|
||
|
};
|
||
|
|
||
|
return (
|
||
|
<Popover
|
||
|
content={<a onClick={hide}>Close</a>}
|
||
|
title="Title"
|
||
|
trigger="click"
|
||
|
open={open}
|
||
|
onOpenChange={handleOpenChange}
|
||
|
>
|
||
|
<Button type="primary">Click me</Button>
|
||
|
</Popover>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default App;
|