mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-11 23:00:20 +08:00
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
|
import React, { useState } from 'react';
|
||
|
import { Button, Modal } from 'antd';
|
||
|
|
||
|
const App: React.FC = () => {
|
||
|
const [modal1Open, setModal1Open] = useState(false);
|
||
|
const [modal2Open, setModal2Open] = useState(false);
|
||
|
|
||
|
return (
|
||
|
<>
|
||
|
<Button type="primary" onClick={() => setModal1Open(true)}>
|
||
|
Display a modal dialog at 20px to Top
|
||
|
</Button>
|
||
|
<Modal
|
||
|
title="20px to Top"
|
||
|
style={{ top: 20 }}
|
||
|
open={modal1Open}
|
||
|
onOk={() => setModal1Open(false)}
|
||
|
onCancel={() => setModal1Open(false)}
|
||
|
>
|
||
|
<p>some contents...</p>
|
||
|
<p>some contents...</p>
|
||
|
<p>some contents...</p>
|
||
|
</Modal>
|
||
|
<br />
|
||
|
<br />
|
||
|
<Button type="primary" onClick={() => setModal2Open(true)}>
|
||
|
Vertically centered modal dialog
|
||
|
</Button>
|
||
|
<Modal
|
||
|
title="Vertically centered modal dialog"
|
||
|
centered
|
||
|
open={modal2Open}
|
||
|
onOk={() => setModal2Open(false)}
|
||
|
onCancel={() => setModal2Open(false)}
|
||
|
>
|
||
|
<p>some contents...</p>
|
||
|
<p>some contents...</p>
|
||
|
<p>some contents...</p>
|
||
|
</Modal>
|
||
|
</>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default App;
|