ant-design/components/modal/demo/width.md
yykoypj 3d8cd0b451
feat: switch visible to open for Modal (#37084)
* feat: switch visible to open for Modal

* test: depcated check

* docs: site api update

Co-authored-by: 二货机器人 <smith3816@gmail.com>
2022-08-23 16:55:57 +08:00

857 B

order title
13
zh-CN en-US
自定义模态的宽度 To customize the width of modal

zh-CN

使用 width 来设置模态对话框的宽度。

en-US

Use width to set the width of the modal dialog.

import { Button, Modal } from 'antd';
import React, { useState } from 'react';

const App: React.FC = () => {
  const [open, setOpen] = useState(false);

  return (
    <>
      <Button type="primary" onClick={() => setOpen(true)}>
        Open Modal of 1000px width
      </Button>
      <Modal
        title="Modal 1000px width"
        centered
        open={open}
        onOk={() => setOpen(false)}
        onCancel={() => setOpen(false)}
        width={1000}
      >
        <p>some contents...</p>
        <p>some contents...</p>
        <p>some contents...</p>
      </Modal>
    </>
  );
};

export default App;