---
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.
```jsx
import { Modal, Button } from 'antd';
class App extends React.Component {
state = {
modal1Visible: false,
modal2Visible: false,
};
setModal1Visible(modal1Visible) {
this.setState({ modal1Visible });
}
setModal2Visible(modal2Visible) {
this.setState({ modal2Visible });
}
render() {
return (
<>
this.setModal1Visible(false)}
onCancel={() => this.setModal1Visible(false)}
>