-
-
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
[Material You] Add theme structure & Button component #34650
[Material You] Add theme structure & Button component #34650
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
@@ -34,6 +34,8 @@ export type SupportedColorScheme = DefaultColorScheme | ExtendedColorScheme; | |||
export interface Opacity { | |||
inputPlaceholder: number; | |||
inputUnderline: number; | |||
switchTrackDisabled: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeScript found this missing keys.
import useThemeProps from '../styles/useThemeProps'; | ||
import useTheme from '../styles/useTheme'; | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤩 I'm pumped!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any remarks about Base usage. Just a tiny optimization/readability opportunity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <67129314+danilo-leal@users.noreply.github.com> Signed-off-by: Marija Najdova <mnajdova@gmail.com>
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
useMaterialYou
flag, 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 themd3
key so that we can avoid conflicts with the existing theme).Usage