Unable to fix Antd Modal Height
Asked Answered
G

2

7

I am trying to set Antd Modal height to 1000px by default but its not getting applied. Please suggest where I might be doing wrong. Below is my code for the Modal.

<Modal style={{ height: "1000px" }} className="pm" width={600} title="Select" visible={isModalVisible3} footer={null} onCancel={() =>setIsModalVisible3(false)}>
    <span>Sample Text</span>
</Modal>

I even added .pm{height: 1000px;} in my base.css file but no luck

Please suggest a workaround.

Gothicism answered 18/2, 2021 at 22:25 Comment(3)
can you try with style={{ width: "100%" }} pleaseTurpentine
@x-rw not working :( BTW, I want fixed height, not widthGothicism
@Turpentine you may try this : <Modal width={100%} />Ahvenanmaa
H
17

Try this way

<Modal
   bodyStyle={{height: 1000}}
>
   Your content
</Modal>
Holds answered 26/2, 2021 at 3:42 Comment(1)
Thanks.... '1000px' must be in quotes, otherwise its throwing error for meGothicism
E
0

In case anyone finds themselves here a few years later with the 'bodyStyle' is deprecated error, the current syntax for the above answer is

styles={{body: {height: '1000px'}}}

Endocentric answered 24/9, 2024 at 5:57 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.