简体   繁体   中英

Material-ui style dialog / modal backdrop

How do I go about styling the transparent dark overlay of a material-ui dialog or modal? I'm using material-ui/React/Typescript.

在此处输入图片说明

Instead of a transparent dark, I want it to be a transparent white. I'd prefer a JSS solution but an inline style is welcomed.

You can use the BackdropProps property of the modal:

<Modal
          aria-labelledby="simple-modal-title"
          aria-describedby="simple-modal-description"
          open={this.state.open}
          onClose={this.handleClose}
          BackdropProps= {{
              classes: {
                  root: classes.backDrop
              }
          }}
        >

and in your style object:

...
backDrop: {
    background: 'rgba(255,255,255,0.2)',
  },

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM