-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[POC] Add support for Material You (alter the existing components) #34622
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@material-ui/core: parsed: +4.11% , gzip: +2.65% |
useMaterialYou
flag in the themecreateMD3Theme
creator
createMD3Theme
creator
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
design: material
This is about Material Design, please involve a visual or UX designer in the process
proof of concept
Studying and/or experimenting with a to be validated approach
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the PR about
This PR is a proof of concept of how we can add support for Material You incrementally without introducing breaking changes (see #29345). This would mean that we would support both Material Design 2 and Material Design 3 in parallel. In a future major release, we can then drop the support for MD2. The implementation is inspired by flutter/flutter#103537
👉 Playground link (inspired by #29345 (comment))
Implementation details
This POC uses a new factory for creating a Material Design 3 theme. It adds behind the scenes a new
useMaterialYou
flag, and adds the necessary design tokens for the new design systems (the palette values are added under underpalette.md3
so that we can avoid conflicts with the existing theme).The new
useMaterialYou
flag is then used in the component's styles generation. If the flag is set then the MD3 styles are being added on the component, otherwise the default MD2 styles are added. I've decided for this implementation so that we can make the components customization easier.The new design tokens is available in both the standard theme usage, as well as the new CSS variables approach.
Usage
ThemeProvider
CssVarsProvider
TODOs: