React not recognising Dialog prop 'paperWidthMd'
See original GitHub issueThis 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 lowercase
paperwidthmd 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)
- Create Dialog component
- Attempt to control Paper size using ‘paperWidthMd’
- 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 |
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
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.
@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! 🤓