Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create MUI Dialog with transparent background color?

I'm trying to create a loading status indicator using MUI. But I want the background color of dialogue box as none and also want to adjust the height. But I'm not able to do it by the style option provided by them. Any solution?

Now it looks like this..

1

Code looks like this:

<Dialog
  open={true}
  style={{width: '200px', marginLeft: '40%', backgroundColor: 'transparent'}}
  title= 'Loading'
  titleStyle={{paddingTop: '0px', paddingLeft: '45px', fontSize: '15px', lineHeight: '40px'}}
>
    <RefreshIndicator
      style= {{display: 'inline-block'}}
      size={50}
      left={50}
      top={30}
      loadingColor="#FF9800"
      status="loading"    
    />
</Dialog>
like image 722
VaibS Avatar asked Dec 15 '16 07:12

VaibS


2 Answers

For the latest version ("@material-ui/core": "^1.2.3"), here is how it's done:

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

Take note of the new PaperProps prop. It's not in the documentation but if you check out the source, they are using PaperProps as one of the props you can pass in - since this isn't in the docs, this might change with future versions though, so be careful here.

like image 185
zephinzer Avatar answered Oct 19 '22 05:10

zephinzer


In material v4 or latest. You can use BackdropProps, see the online demo

like image 19
Seven Avatar answered Oct 19 '22 03:10

Seven