[Material You] Add theme structure & Button component#34650
[Material You] Add theme structure & Button component#34650mnajdova merged 66 commits intomui:masterfrom
Conversation
@material-ui/core: parsed: +0.05% , gzip: +0.05% |
createMD3Theme creator v2…() util for material-next
Refactor to depend on CSS vars provider only
| export interface Opacity { | ||
| inputPlaceholder: number; | ||
| inputUnderline: number; | ||
| switchTrackDisabled: number; |
There was a problem hiding this comment.
TypeScript found this missing keys.
| import { getPaperUtilityClass } from './paperClasses'; | ||
|
|
||
| // Inspired by https://github.com/material-components/material-components-ios/blob/bca36107405594d5b7b16265a5b0ed698f85a5ee/components/Elevation/src/UIColor%2BMaterialElevation.m#L61 | ||
| export const getOverlayAlpha = (elevation) => { |
There was a problem hiding this comment.
Needed to be used in the extendTheme in @mui/material-next so it was extracted and exported.
I would not add all of the variables defined in the specs yet until we see them useful.
In long term, I'd say no. We should follow the m3 design specs to leverage their design tools, e.g. the Material Theme Builder (figma plugin) that generates tokens. If we have the theme structure close to their spec, I think we will have less unknown work from our side.
I am writing my thought in the discussion. I will post the link here when it is done. |
michaldudak
left a comment
There was a problem hiding this comment.
I don't have any remarks about Base usage. Just a tiny optimization/readability opportunity.
danilo-leal
left a comment
There was a problem hiding this comment.
Sweet, this is looking great⎯awesome work! Aside from the missing letter spacing declarations in a few of the text styles, there's nothing really standing out for me. I do wish though that the Playground demo would follow the same layout as in the Material 3 Figma file, just for the sake of ease of comparison as I think a bunch of folks will do the back & forth.
Co-authored-by: Danilo Leal <[email protected]> Signed-off-by: Marija Najdova <[email protected]>
The main reason why I didn't structure it like this, is because most of the items in figma are dependent on some interactions, like hover, focused etc. I guess we can think a bit more about how we want to document these components in a follow-up PR. We need to somehow fit them with the rest of the docs. |

What's the PR about
This is a proof of concept of how we can add support for Material You incrementally without introducing breaking changes (see #29345) and at the same time allow the new components to co-exist in an environment where @mui/material is used. 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.
👉 Playground link (inspired by #29345 (comment))
👉 Default theme showcase link - it should work without using
CssVarsProvider👉 Showcase of coexisting with @mui/material (Material Design 2) link
Implementation details
This POC uses a new factory for creating a Material Design 3 theme. It adds behind the scenes a new
useMaterialYouflag, and adds the necessary design tokens for the new design systems (the palette values are added under underpalette.md3, and all other tokens are under themd3key so that we can avoid conflicts with the existing theme).Usage