--- order: 7 title: zh-CN: 自定义位置 en-US: To customize the position of modal --- ## zh-CN 使用 `centered` 或类似 `style.top` 的样式来设置对话框位置。 ## en-US You can use `centered`,`style.top` or other styles to set position of modal dialog. ```tsx import { Button, Modal } from 'antd'; import React, { useState } from 'react'; const App: React.FC = () => { const [modal1Open, setModal1Open] = useState(false); const [modal2Open, setModal2Open] = useState(false); return ( <> setModal1Open(false)} onCancel={() => setModal1Open(false)} >

some contents...

some contents...

some contents...



setModal2Open(false)} onCancel={() => setModal2Open(false)} >

some contents...

some contents...

some contents...

); }; export default App; ```