Skip to content

[BREAKING CHANGE][styles] Remove deprecated v6 exports from @mui/material/styles#48588

Draft
silviuaavram wants to merge 2 commits into
mui:masterfrom
silviuaavram:dev/remove-deprecated-exports
Draft

[BREAKING CHANGE][styles] Remove deprecated v6 exports from @mui/material/styles#48588
silviuaavram wants to merge 2 commits into
mui:masterfrom
silviuaavram:dev/remove-deprecated-exports

Conversation

@silviuaavram
Copy link
Copy Markdown
Member

@silviuaavram silviuaavram commented May 28, 2026

This PR removes several deprecated exports that were scheduled for removal in v7:

  • createStyles — was a no-op helper from the @mui/styles (JSS) era. Removed source file, type declaration, and barrel export.
  • experimental_extendTheme — alias for extendTheme added during the CSS variables rollout. Removed source file and barrel export. Use extendTheme instead.
  • experimental_sx — error-throwing stub left after sx was moved to theme.unstable_sx. Removed from both JS and type declaration barrels.
  • CssVarsProvider — deprecated alias for ThemeProvider. Removed the public export; it remains an internal implementation detail used by ThemeProvider.
  • Experimental_CssVarsProvider — deprecated wrapper around CssVarsProvider that logged a console warning. Removed entirely.
  • getInitColorSchemeScript — deprecated wrapper that logged a warning directing users to <InitColorSchemeScript />. Removed entirely.

Copilot AI review requested due to automatic review settings May 28, 2026 14:32
@silviuaavram silviuaavram added breaking change Introduces changes that are not backward compatible. v10.x labels May 28, 2026
@code-infra-dashboard
Copy link
Copy Markdown

Deploy preview

https://deploy-preview-48588--material-ui.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/material ▼-916B(-0.18%) ▼-417B(-0.28%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes several deprecated v6-era exports from the @mui/material/styles public surface as part of the v7 breaking-change cleanup. The deprecated public CssVarsProvider is collapsed into an internal alias still consumed by ThemeProvider, while Experimental_CssVarsProvider, getInitColorSchemeScript, experimental_extendTheme, experimental_sx, and createStyles are removed entirely (source files, type declarations, and barrel exports).

Changes:

  • Drop createStyles, experimental_sx, and experimental_extendTheme from both JS and TS barrels and delete their source/declaration files.
  • Inline the previous public CssVarsProvider export as InternalCssVarsProvider and remove the Experimental_CssVarsProvider and getInitColorSchemeScript wrappers.
  • Update ThemeProvider.tsx to import the renamed internal alias.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/mui-material/src/styles/ThemeProviderWithVars.tsx Removes CssVarsProvider, Experimental_CssVarsProvider, getInitColorSchemeScript and exposes only InternalCssVarsProvider + useColorScheme.
packages/mui-material/src/styles/ThemeProvider.tsx Renames import to InternalCssVarsProvider as CssVarsProvider to track the new internal export name.
packages/mui-material/src/styles/index.js Removes barrel exports for createStyles, experimental_sx, and experimental_extendTheme.
packages/mui-material/src/styles/index.d.ts Removes corresponding type-level barrel exports.
packages/mui-material/src/styles/experimental_extendTheme.js Deletes the deprecated wrapper that warned and forwarded to extendTheme.
packages/mui-material/src/styles/createStyles.js Deletes the deprecated JSS-era no-op helper.
packages/mui-material/src/styles/createStyles.d.ts Deletes the matching type declaration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

export const CssVarsProvider = InternalCssVarsProvider;

export { useColorScheme, getInitColorSchemeScript, Experimental_CssVarsProvider };
export { InternalCssVarsProvider };
export const CssVarsProvider = InternalCssVarsProvider;

export { useColorScheme, getInitColorSchemeScript, Experimental_CssVarsProvider };
export { InternalCssVarsProvider };
@@ -45,7 +36,6 @@ export { default as withTheme } from './withTheme';

export * from './ThemeProviderWithVars';
@silviuaavram silviuaavram marked this pull request as draft May 29, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Introduces changes that are not backward compatible. v10.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants