reactjsantd

How do i add another button on modal footer of antdesign?


I need to add another button on the Modal footer. How can i do it? In the documents you can only edit the ok and cancel buttons, but doesn't have a docs on how to add another button.


Solution

  • Use footer property of Modal which accepts an array of components.

          <Modal
            visible={true}
            footer={[
              <Button key="1">1</Button>,
              <Button key="2">2</Button>,
              <Button key="3" type="primary">
                3
              </Button>
            ]}
          >
            <p>Some contents...</p>
          </Modal>
    

    Edit OS Q 56474989