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

React not recognising Dialog prop 'paperWidthMd' #11692

Closed
2 tasks done
MikeB2012 opened this issue Jun 3, 2018 · 8 comments
Closed
2 tasks done

React not recognising Dialog prop 'paperWidthMd' #11692

MikeB2012 opened this issue Jun 3, 2018 · 8 comments
Labels
support: Stack Overflow Please ask the community on Stack Overflow

Comments

@MikeB2012
Copy link

MikeB2012 commented Jun 3, 2018

This is my component. I was trying to change the width of a dialog from the default. The docs suggested I could do so by using 'paperWidthMd'

                 <Dialog open={searching} maxWidth="md" paperWidthMd>
			<DialogTitle>
				{localization.get("org_staff_add")}
			</DialogTitle>
                            ...
			<DialogActions>
				{search_actions}
			</DialogActions>
		</Dialog>
  • This is a v1.x issue (v0.x is no longer maintained).
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

I expected the Dialog to accept the prop and set the dimension to paper width 'md'.

Current Behavior

I get the following error:

warning.js?da67:33 Warning: React does not recognize the paperWidthMdprop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercasepaperwidthmd instead. If you accidentally passed it from a parent component, remove it from the DOM element. in div (created by Modal) in Portal (created by Modal) in Modal (created by WithStyles(Modal)) in WithStyles(Modal) (created by Dialog) in Dialog (created by WithStyles(Dialog)) in WithStyles(Dialog) (at render.jsx:120) in div (at render.jsx:92) in UI in MuiThemeProvider

Steps to Reproduce (for bugs)

  1. Create Dialog component
  2. Attempt to control Paper size using 'paperWidthMd'
  3. Tried using the prop here: https://codesandbox.io/s/v033qjxyz7 and while I don't get a warning it does seem like the prop is simply ignored.

Context

My intention is to expand the size of the dialog box and ideally add padding. Since this a change in a single instance of the Dialog in the code, I intended to make the change inline vice creating a new Dialog component using classes per the docs. Right now the Paper exactly fits the text in the dialog box with no padding, so I'm trying to style it.

Your Environment

Tech Version
Material-UI v1.?.?
React ~16.3.0
browser Version 66.0.3359.181 (Official Build) (64-bit)
etc
@MikeB2012 MikeB2012 changed the title React not recognising Dialog prop React not recognising Dialog prop 'paperWidthMd' Jun 3, 2018
@oliviertassinari oliviertassinari added the support: Stack Overflow Please ask the community on Stack Overflow label Jun 3, 2018
@support
Copy link

support bot commented Jun 3, 2018

👋 Thanks for using Material-UI!

We use the issue tracker exclusively for bug reports and feature requests, however,
this issue appears to be a support request or question. Please ask on StackOverflow where the
community will do their best to help. There is a "material-ui" tag that you can use to tag your
question.

If you would like to link from here to your question on SO, it will help others find it.
If your issues is confirmed as a bug, you are welcome to reopen the issue using the issue template.

@support support bot closed this as completed Jun 3, 2018
@oliviertassinari
Copy link
Member

The docs suggested I could do so by using 'paperWidthMd'

@MikeB2012 There is no such property.

@MikeB2012
Copy link
Author

MikeB2012 commented Jun 3, 2018

Then I'm having trouble interpreting the CSS API at the bottom of the page: https://material-ui.com/api/dialog/ The property also shows up at line 29 here: https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Dialog/Dialog.js where it is not a 'root' property but it is a 'paper' property. Is it possible to alter any of the Dialog paper props inline?

@oliviertassinari
Copy link
Member

@MikeB2012 Have a look at the override documentation: https://material-ui.com/customization/overrides/

@MikeB2012
Copy link
Author

I have been trying to use 'overriding with inline styles' but was unsuccessful with Dialog unlike other components eg. Button, ListItem, etc. that were all straightforward. Is it possible then to use inline styles to override the non-root properties of Dialog?

@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 3, 2018

Is it possible then to use inline styles to override the non-root properties of Dialog?

@MikeB2012 You won't be able to override 100% of the style with inline-style. It's not something we aim at. But that should work for most. For instance with the dialog, you can use PaperProps to target the paper element.

@MikeB2012
Copy link
Author

Tnx for the assist Olivier. I've not had any luck with PaperProps even in codesandbox eg. setting padding, min-width, , etc. In the end I wrapped content in a div and applied styles to that which seems to work.

@m2mathew
Copy link
Member

m2mathew commented Jun 8, 2018

@MikeB2012 Alternatively, you can try to give the <DialogContent> some styling directly. That might allow you to leave the dialog width as it was. Probably better to not have an extra <div> in the DOM if you can help it! 🤓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support: Stack Overflow Please ask the community on Stack Overflow
Projects
None yet
Development

No branches or pull requests

3 participants