Search code examples
reactjsdialogmaterial-uiinline-stylesoverriding

React JS - How to add style in PaperProps of Dialog (material-ui)


I am using Dialog components from material-ui ReactJs.

<Dialog fullScreen open={this.state.open}
  PaperProps={{ classes: {root: classes.dialogPaper} }}
  onClose={this.handleClose.bind(this)} transition={this.props.transition}>
  {this.props.children}
</Dialog>

In the above code I already override the root classes of PaperProps. Now I also want to override the style in the PaperProps. Is that possible in the PaperProps to override the styles.

Something like PaperProps={{ classes: {root: classes.dialogPaper}, style:{} }}

Please tell me if I am wrong. I want to override style also.


Solution

  • I got my answer

    <Dialog
    {...otherProps}
      PaperProps={{
        style: {
          backgroundColor: 'transparent',
          boxShadow: 'none',
        },
      }}
    >
      {/* ... your content ... */}
    </Dialog>
    

    This is how we can put style in PaperProps of dialog component.