Search code examples
antdant-design-pro

How to make antd modal have rounded corners


  <Modal
    title=""
    visible={isModalVisible}
    onOk={handleOk}
    onCancel={handleCancel}
    cancelButtonProps={{ style: { display: "none" } }}
  >
    <img src="./test.svg" alt="" style={{ marginLeft: "8.5rem" }} />
    <p>It has been added!</p>
  </Modal>

I tried added style to the Modal,

style ={{borderRadius:"20px",overflow:"auto"}}

But that made on the top corners rounded and cutting off the bottom.


Solution

  • Just overrider .ant-modal-content style in css/sass/scss file

    /*your selectors if needed*/
    .ant-modal-content {
      border-radius: 20px;
      /* background: red; */
    }

    Example: https://codesandbox.io/s/antd-reproduction-template-forked-qqe5k?file=/index.css:27-127