Skip to content
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

[ThemeProvider] Support setting default mode #43951

Merged
merged 4 commits into from
Oct 1, 2024

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Oct 1, 2024

closes #43622

Changes

The default mode can be controlled by a prop (see #43622 for use cases):

<ThemeProvider defaultMode="dark | light | system">

@siriwatknp siriwatknp added package: system Specific to @mui/system package: material-ui Specific to @mui/material enhancement This is not a bug, nor a new feature labels Oct 1, 2024
@siriwatknp siriwatknp requested review from Janpot and a team October 1, 2024 07:21
@mui-bot
Copy link

mui-bot commented Oct 1, 2024

Netlify deploy preview

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 980c206

Copy link
Member

@Janpot Janpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small suggestion to satisfy vale, otherwise looks good.

packages/mui-material/src/styles/ThemeProvider.test.tsx Outdated Show resolved Hide resolved
packages/mui-material/src/styles/ThemeProvider.tsx Outdated Show resolved Hide resolved
@@ -36,6 +36,12 @@ export interface ThemeProviderProps<Theme = DefaultTheme> extends ThemeProviderC
* @default document
*/
documentNode?: Document | null;
/**
* The default mode when the storage is empty,
Copy link
Member

@aarongarciah aarongarciah Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "storage" mean? Could we specify a bit more?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be local storage is more direct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Co-authored-by: Aarón García Hervás <[email protected]>
Signed-off-by: Siriwat K <[email protected]>
@siriwatknp siriwatknp merged commit f7feae3 into mui:master Oct 1, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is not a bug, nor a new feature package: material-ui Specific to @mui/material package: system Specific to @mui/system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Mui v6] Set default mode at first render
4 participants