-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[docs] Add density guide to customizations #16410
Conversation
Details of bundle changes.Comparing: 7d826a9...90fdb4f
|
Super interesting indeed. We're forcing high density because we're essentially a desktop framework. In an ideal world, the density would change automatically depending on the screen size. I wouldn't even give the ability to the user to change that default as it's the best for both words (high density on Desktop, larger touch targets on Mobile). |
And then enter the world of desktop touch displays. I would prefer to leave this to theme authors since high density isn't always useful for desktop. I'd even argue most of the time you don't want high density (apart from dashboards with a high information density). So customization is still a must have for us. I was more thinking about whether this is useful as a single flag or if you apply this only to certain views in your UI. But it sounds like you have high density everywhere. |
feb47b9
to
7ed5465
Compare
4bb57b4
to
534251f
Compare
@eps1lon "I was more thinking about whether this is useful as a single flag or if you apply this only to certain views in your UI." That was my initial thought too, when looking at this PR vs. what the spec says:
For example, globally applying density would give dense (small) buttons to the dialog (one of the "don'ts" in the accompanying image. However, since we let devs deviate from the Material spec in every other way, I don't see an issue per-se with making it easier to customise it globally. It then becomes a question of whether it's useful enough to justify the added complexity, and small bundle-size increase. |
It's definitely an easy flag to abuse. Maybe add an additional warning that we encourage this option only for certain views (e.g. dashboard) and not your whole application. And then encourage to actually read the guidelines and think about implications. @oliviertassinari How did you envision #14521 to be resolved? |
FilledInput already has So we cut it from the theme and just list the components that have some properties that change densitiy? |
I'm on my phone. From what I remember, the filled input has two different dense modes. I believe we only support one. Regarding the theme global prop switch. The idea has potential, it makes me think of the Gmail dense feature. I would be cautious to make sure it's a feature our users want. For instance, the menu has a dense prop that seems to be for mobile devices, should it be activated on the dense desktop? I'm not sure. Maybe the a la carte approach is safer? |
No objection here. It's what I would recommend anyway since you have to consider the devices you target and where this gets applied (see matts example on dialogs). So do we go back to fee8986 for our docs and keep the new page with the density tool? We should have some entry point for density in our docs. |
👍 from my end to start with the existing theme component default prop API and to grow from here. |
0bdd728
to
4abb4f2
Compare
4abb4f2
to
b9657d6
Compare
Co-Authored-By: Matt <github@nospam.33m.co>
Co-Authored-By: Matt <github@nospam.33m.co>
Really nice. Should it closes #14521? |
Oh, my bad, thanks for the update! I thought we had two issues open for the dense support. We don't. |
Addresses #14521
This is me loosely playing around with https://material.io/design/layout/applying-density.html#
I think the final implementation will somewhat look like this:
createMuiTheme({ dense: true })
will add the flag to the resultingtheme
object which is used by the components if the props regarding density aren't set. Theme density is overridden by applying density via context (e.g. list, table) or props./customization/themes/density
which will include a switch to apply it to the website@fzaninotto might be interested in this one. How are you currently applying density? How would you like the core API to look like?