[Dialog] Better mobile default margin?
See original GitHub issueWhen I set the dialog as fullWidth={true} I expect it to take whole screen up to maxWidth.
On mobile, width is calculated as
width: calc(100% - 96px);
, the 96px coming from the rule just below
margin: 48px;
.
So, it actually does not take full width and it just looks bad.
- This is not a v0.x issue.
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior 🤔
Current Behavior 😯
It takes width minus margin, which in the case is 48px at each side ( well, top and bottom as well, but that does not matter)
Steps to Reproduce 🕹
Link: to sandbox
Context 🔦
Just trying to have a full width feature to work properly. I did try to change the paperFullWidth:
property, but that ends up changing the root element.
Your Environment 🌎
Tech | Version |
---|---|
Material-UI | v4.1.3 |
React | 16.8.6 |
Browser | Firefox development latest |
TypeScript | |
etc. |
Issue Analytics
- State:
- Created 4 years ago
- Comments:23 (11 by maintainers)
Top Results From Across the Web
How to set dialog outer margins? (Android) - Stack Overflow
You can use a inset to set margins to a Custom dialog . Look, the android:drawable attribute is calling my dialog custom background....
Read more >How to Size and Position the MUI Dialog Component - Medium
Dialog Size Props There is no margin or anything else. Interestingly, the DOM div that acts as the modal is still present in...
Read more >Building a dialog component - web.dev
Open and auto focus an element # By default, the dialog element will assign focus to the first focusable element in the dialog...
Read more >Dialogs - Material Design
Dialogs can reach a maximum height and width of 560dp on large screens. Dialogs can also swap types as a screen size changes....
Read more >Dialogs - jQuery Mobile Demos
When the "dialog" attribute is applied, the framework adds styles to add rounded corners, margins around the page and a dark background to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I made a dialog yesterday that looks like this on mobile.
I did it by passing down this prop to the Dialog component:
classes={{ paper: classes.dialogPaper }}
Which is applying this style from jss:
It seems in line with what @BernardA is wanting. I am overriding the margin for the dialog on a smaller screen (he would want
margin: 0
, seemingly) and also using a maxWidth ofxs
for the dialog.From the MUI Docs
fullWidth
will cause the content inside the dialog to stretch to meet one of the enumeratedmaxWidth
values (“xs”, “sm”, et al.). I find no confusion with the way that this API is named considering it matches the way that CSS works since those enumerations are stand-ins for real width values (300px, 440px, et all).That being said, perhaps @oliviertassinari’s proposed wording update would help, too.