question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React not recognising Dialog prop 'paperWidthMd'

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
MikeB2012commented, Jun 4, 2018

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.

0reactions
m2mathewcommented, 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! 🤓

Read more comments on GitHub >

github_iconTop Results From Across the Web

React not recognising Dialog prop 'paperWidthMd' #11692
I expected the Dialog to accept the prop and set the dimension to paper width 'md'. Current Behavior. I get the following error:...
Read more >
React does not recognize the `PaperComponent` prop on a ...
Modal component does not recognize PaperComponent that you passing to it as prop,. if you only want modal to be draggable modify your...
Read more >
Dialog API - Material UI - MUI
API reference docs for the React Dialog component. Learn about the props, CSS, and other APIs of this exported module.
Read more >
Unknown Prop Warning - React
The unknown-prop warning will fire if you attempt to render a DOM element with a prop that is not recognized by React as...
Read more >
How to Size and Position the MUI Dialog Component - Medium
Not a REALLY well sized MUI Dialog though… This overrides the maxWidth prop and positions based on screen size. The sx prop accepts...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found