Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dialog] Background color issue #5278

Closed
nmaves opened this issue Sep 28, 2016 · 7 comments
Closed

[Dialog] Background color issue #5278

nmaves opened this issue Sep 28, 2016 · 7 comments
Labels
component: dialog This is the name of the generic UI component, not the React module!

Comments

@nmaves
Copy link

nmaves commented Sep 28, 2016

Problem description

I am trying to override the background styles of a dialog. I want to have a dialog with a translucent background. The issue is that there is the element that is using a background color of white in-between the contentStyle and the title/body styles.

Steps to reproduce

<Dialog
                title="Subtitle options"
                modal={false}
                open={this.state.showCaptionStyles}
                onRequestClose={this.handleCaptionClose}
                bodyStyle={{ backgroundColor: 'rgba(0,0,0,0.9)' }}
                contentStyle={{ backgroundColor: 'rgba(0,0,0,0.9)' }}
                titleStyle={{ backgroundColor: 'rgba(0,0,0,0.9)' }}
            >

Versions

  • Material-UI: 15.4
  • React: 15.3.1
  • Browser: All
@nmaves nmaves changed the title Background color issue on a Dialog [Dialog] Background color issue Sep 28, 2016
@nperichSYKES
Copy link

nperichSYKES commented Oct 7, 2016

The issue is the <Paper /> isn't overridable from the external API.

Dialog.js:

{open &&
            <TransitionItem
              className={contentClassName}
              style={styles.content}
            >
              <Paper zDepth={4}>
                {titleElement}
                <div
                  ref="dialogContent"
                  className={bodyClassName}
                  style={prepareStyles(styles.body)}
                >
                  {children}
                </div>
                {actionsContainer}
              </Paper>
            </TransitionItem>
          }

We definitely don't want to add another field on the API to customize the weird thing between "body" and "content". Perhaps TransitionItem could itself be a Paper?

@nperichSYKES
Copy link

nperichSYKES commented Oct 7, 2016

A quick solution would be to set the background of this <Paper /> to none, then setting the background of styles.content to white, letting you then control the background with contentStyle.

One issue is that if you then add a borderRadius to contentStyle, it wouldn't be applied to the Paper. So we'd have to also set the Paper's borderRadius to style.content.borderRadius if it is provided.

But, really, we'd probably want to keep Paper's background for theme support?

@jaimehing
Copy link

Hello, are there updates about this issue?

@simpixelated
Copy link

I'm having a similar issue trying to remove the box-shadow on the dialog. Unfortunately because it uses <Paper> with zDepth hardcoded to 4, I had to override paper.zDepthShadows in the theme. So something that lets us customize this "weird thing" would be very helpful.

@oliviertassinari oliviertassinari added component: dialog This is the name of the generic UI component, not the React module! and removed component: dialog This is the name of the generic UI component, not the React module! labels Dec 18, 2016
@986224568
Copy link

hello, if I don't need background when using dialog, how can I do that?

@gaiousantonio0909
Copy link

gaiousantonio0909 commented Sep 16, 2020

My problem was i need to customize the paper in my dialog. I have solved it by using paperProps in the

<Dialog
  PaperProps={{
    style: {
      backgroundColor: "transparent",
      boxShadow: "none"
    },
  }}
  onClose={accessModal}
  open={modal}
/>

@IfeOlulesi
Copy link

Thanks for sharing @oliviertassinari & @gaiousantonio0909
This solved my problem!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: dialog This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

8 participants