[RFC] Material You support implementation strategy in Material UI #34738
Replies: 6 comments 14 replies
-
How about Option 3?Steps to make it work:
Notes:
How users would use V3Users have an option to stay at v2 or gradually switch every component one by one |
Beta Was this translation helpful? Give feedback.
-
@mnajdova Thanks for putting this together! So, from what I understand, there are a couple of core tradeoffs that we need to decide on:
|
Beta Was this translation helpful? Give feedback.
This comment has been minimized.
This comment has been minimized.
-
One important aspect to be aware of here: #30485 Since work has already begun on migrating to CSS variables, and effectively every component will have some work to apply the M3 changes, it doesn't make sense to proceed without it. I'd suggest we actually do both in tandem, and then one could just use the MD3 theme generator to output the CSS vars (tokens) that are needed for the theme. Though some things would be missing that MUI needs, like spacing vars. |
Beta Was this translation helpful? Give feedback.
-
Our Twitter poll results suggest that the majority of the community would prefer to have a separate package for MD3 components. So in that case, it looks like we'd be building the new components on top of MUI Base (as we had planned to do with Material UI in the future). |
Beta Was this translation helpful? Give feedback.
-
Motivation
The #29345 Adopt Material Design 3 / Material You issue is now one of the top 5 most upvoted issues. Moreover, the Material Design 3 design kits are at 50% of the downloads of Material Design 2 (at the time of writing). It's time we start with the adoption 🎉. The goal of this RFC is to open up discussion for the different approaches we can take for adding a support for the new version of Material Design.
Requirements
No matter what implementation strategy we will choose, it will need to support the following:
Options
In order to make the implementation easier, we are going to be adding a new theme creator that will prepare the theme structure for Material You. This theme will be a merged version of the themes for Material Design 2 & Material Design 3. The reason of this is to allow us to be able to progressively upgrade to the new design system (in addition to this, not all components have specification for Material You, so we will need to have them render by default in the old Material Design 2 version for the time being). Because of some possible conflicts, some keys will be defined under an object with the
md3
key. This can be further polished and discussed in the pull request for it.In addition to this, we will be exposing a module augmentation file that can be imported in userland to ensure type safety.
The different implementation strategy is in terms how the components will be adding the styles for the different versions of the design systems. Here we have two options:
Option 1 - The Material UI components would be adding the styles for both design systems
Proof of concept 👉 #34622
In this implementation strategy, we would be updating the existing Material UI components, that based on the theme context would render different styles (note that the styles will not be merged, only the styles for the specific version of the design system will be added on the component). This is an example usage:
👍 Pros:
👎Cons:
varaint
prop will need to support both the MD2 and the MD3 variants)Option 2 - Add new component that will host the Material You styles
Proof of concept 👉 #34650
In this implementation strategy, we would be adding a brand new component that will host only the styles for Material You. For this implementation we would use the
@mui/base
package's headless hooks. This will be closer to how some of the future versions of Material UI components will anyway look like, which basically means that we would be step ahead when working on the future release.👍 Pros:
👎 Cons:
Additional comments
For those who can't wait, the community already started with adding Material You themes that can serve as a great starting point for the implementation - #29345 (comment). The problem with this is that the three object is big and not tree-shakable so be aware of it. In addition of this, the customization of the components is becoming a bit harder, as the styles for both design systems are added on the components.
Other options?
Please feel free to propose other options for implementation if you can think of any.
Beta Was this translation helpful? Give feedback.
All reactions