javascript - antD model API - Background colour change - Stack Overflow

Is there a way to change the antD model body color using styles API? As per the documentation, model at

Is there a way to change the antD model body color using styles API? As per the documentation, model attributes can be changed using the styles attribute but the below code is changing only the footer background color.Any help would be really appreciated.

                   import { notification, Modal, Form, AutoComplete } from 'antd';
                   <Modal
                    mask={false}
                    title="Select Delivery Location"
                    style={{
                        top: 150,
                        // borderColor: '#00FF00', //changing the footer colour only
                        // backgroundColor: '#FF0000', //not working
                    }}
                    width={350}
                    onOk={this.handleOnModelSubmit}
                    visible={this.state.modal1Visible}
                    onCancel={() => this.setModal1Visible(false)}>

                    </Modal>

Is there a way to change the antD model body color using styles API? As per the documentation, model attributes can be changed using the styles attribute but the below code is changing only the footer background color.Any help would be really appreciated.

                   import { notification, Modal, Form, AutoComplete } from 'antd';
                   <Modal
                    mask={false}
                    title="Select Delivery Location"
                    style={{
                        top: 150,
                        // borderColor: '#00FF00', //changing the footer colour only
                        // backgroundColor: '#FF0000', //not working
                    }}
                    width={350}
                    onOk={this.handleOnModelSubmit}
                    visible={this.state.modal1Visible}
                    onCancel={() => this.setModal1Visible(false)}>

                    </Modal>
Share Improve this question asked May 19, 2021 at 8:48 Sona ShettySona Shetty 1,0474 gold badges20 silver badges41 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4
<Modal
    bodyStyle={{
        backgroundColor: 'red'
    }}
/>

Either using 1 bracket '{' or 2 '{{'

The property used in top answer is deprecated now. You can use styles api.

<Modal 
  styles={{
    body: { backgroundColor: 'red' }, // turns the "Modal's body" to red
  }}
/>

If you want to change the color of the modal's plete background then use styles.content. As we have different property depending on if we're targeting the footer, header or body.

<Modal 
  styles={{
    content: { backgroundColor: 'red' }, // turns the Modal red
  }}
/>

See the docs here: https://ant.design/ponents/modal?locale=en-US#ponents-modal-demo-footer

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745121384a4612432.html

相关推荐

  • javascript - antD model API - Background colour change - Stack Overflow

    Is there a way to change the antD model body color using styles API? As per the documentation, model at

    6小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信