question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to hide the OK and Cancel buttons of antd Modal?

See original GitHub issue

This is a question about usage instead of issues, I’ve also posted this question on Stackoverflow here

I wrote a Login component, which is basically as follows:

const Login = (
  <Modal>
    <NormalLoginForm/ 
     ...
    </NormalLoginForm >
  </Modal>
)

The NormalLoginForm component is from the official website here https://ant.design/components/form/

I don’t need the two Buttons OK and Cancel on the Modal, how to hide the two buttons ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

90reactions
erdemkerencommented, Dec 4, 2019

If you want to disable one of them, this helps you utilize the other button implementations like onOk.:

<Modal
    cancelButtonProps={{ style: { display: 'none' } }}
/>
83reactions
timtamimicommented, Feb 3, 2020

If anyone’s looking at this in the future, the thing you’re looking for is: <Modal footer={null} />

Read more comments on GitHub >

github_iconTop Results From Across the Web

Modal - Ant Design
Open Modal with customized button props. Customize footer buttons props. Passing okButtonProps and cancelButtonProps will customize the OK button and cancel ...
Read more >
Reactjs – How to hide the OK and Cancel buttons of antd Modal
BTW, if you want to do Login and close the Modal by clicking one button, you need to invoke the handler function (handleOk)...
Read more >
antd modal remove ok button - Code Grepper
antd modal remove ok button · disable click extra collapse antd · antd bottom up modal · antd select disable closing dropdown ·...
Read more >
In Modal, Disable Cancel Button Dynamically #20514
In Modal, If I click on Ok Button and promise waiting from server response this time we also have cancel button and user...
Read more >
Modal - Ant Design - GitHub Pages
Asynchronously close a modal dialog when a user clicked OK button, ... when a user clicks mask, close button on top right or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found