Search code examples
antdant-design-proreact-typescript

How to hide the X button present at the top from the antd modal


How to hide the X button present at the top from the ant d modal, also how can I disable the behavior of closing the modal using ESC key

return (
<Modal
title={modalHeader}
okText="EXIT"
cancelText="CONTINUE"
visible={visible}
onCancel={onCancelHandler}
onOk={exitUser}
width={600}
cancelButtonProps={{hidden:isExFlag}}
>
<DescriptionParagraph>
{modalBodyText}
</DescriptionParagraph>
</Modal>
);

Solution

  • Based on the documentation version 4.6.6

    to hide the X button present at the top from the ant d modal, use the prop closable

    <Modal closable={false}>...</Modal>
    

    to disable the behavior of closing the modal using esc key, use the prop keyboard

    <Modal keyboard={false}>...</Modal>
    

    Edit prod-http-h73fi