Skip to content

[button] Remove deprecated classes#48012

Open
silviuaavram wants to merge 8 commits intomui:masterfrom
silviuaavram:chore/remove-deprecated-props-7
Open

[button] Remove deprecated classes#48012
silviuaavram wants to merge 8 commits intomui:masterfrom
silviuaavram:chore/remove-deprecated-props-7

Conversation

@silviuaavram
Copy link
Member

@silviuaavram silviuaavram commented Mar 17, 2026

@silviuaavram silviuaavram requested review from ZeeshanTamboli, Copilot and siriwatknp and removed request for Copilot March 17, 2026 12:54
@silviuaavram silviuaavram added the scope: button Changes related to the button. label Mar 17, 2026
@silviuaavram silviuaavram added breaking change Introduces changes that are not backward compatible. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. v9.x labels Mar 17, 2026
@mui-bot
Copy link

mui-bot commented Mar 17, 2026

Netlify deploy preview

Bundle size report

Bundle Parsed size Gzip size
@mui/material ▼-690B(-0.14%) ▼-170B(-0.12%)
@mui/lab 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

Generated by 🚫 dangerJS against 1542b3f

Copilot AI review requested due to automatic review settings March 17, 2026 13:39
Copy link
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

This PR removes deprecated Button utility CSS classes (e.g. textPrimary, outlinedSizeSmall, iconSizeSmall) from the Material UI Button implementation and updates the API docs/tests/migration guide to reflect the new “combine base classes” approach (e.g. .MuiButton-text.MuiButton-colorPrimary).

Changes:

  • Remove deprecated Button class keys from buttonClasses and stop generating/applying them in Button.
  • Update Button unit tests to assert the remaining non-deprecated class names (color*, size*, text|outlined|contained).
  • Remove deprecated class entries from the generated API docs JSON and add an upgrade-to-v9 migration section for the removals.

Reviewed changes

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

Show a summary per file
File Description
packages/mui-material/src/Button/buttonClasses.ts Drops deprecated class keys from the public buttonClasses contract and utility class generation list.
packages/mui-material/src/Button/Button.js Stops composing deprecated variant+color / variant+size / iconSize* utility classes and removes them from overrides resolvers.
packages/mui-material/src/Button/Button.test.js Updates assertions to use color* and size* classes instead of deprecated combined class names.
docs/translations/api-docs/button/button.json Removes deprecated class descriptions from translated API docs data.
docs/pages/material-ui/api/button.json Removes deprecated class entries from the generated Button API page JSON.
docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md Adds an upgrade note listing removed deprecated Button classes and suggested replacements.

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

You can also share your feedback on Copilot code review. Take the survey.

Copy link
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 deprecated Button CSS utility classes from the Material UI codebase as part of the v9 upgrade path, and updates tests/docs to reflect the new class composition approach (variant + color/size classes combined via selectors rather than dedicated “combined” class keys).

Changes:

  • Remove deprecated Button class keys from buttonClasses and stop generating them in Button’s utility classes / overrides resolvers.
  • Update Button and ButtonGroup tests to assert non-deprecated classes (outlined, colorPrimary, sizeSmall, etc.).
  • Remove deprecated class entries from the Button API docs and add an upgrade-to-v9 migration note listing the removed classes and replacements.

Reviewed changes

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

Show a summary per file
File Description
packages/mui-material/src/ButtonGroup/ButtonGroup.test.js Updates assertions to use non-deprecated Button classes.
packages/mui-material/src/Button/buttonClasses.ts Removes deprecated class keys from the ButtonClasses interface and generated utility classes.
packages/mui-material/src/Button/Button.test.js Rewrites tests to validate variant + color*/size* classes instead of deprecated combined classes.
packages/mui-material/src/Button/Button.js Stops emitting deprecated combined utility classes and removes them from overrides resolution paths.
docs/translations/api-docs/button/button.json Removes deprecated class descriptions from translated Button API docs.
docs/pages/material-ui/api/button.json Removes deprecated class entries from the Button API page data.
docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md Adds v9 upgrade guidance for removed deprecated Button classes and codemod usage.
Comments suppressed due to low confidence (1)

packages/mui-material/src/Button/Button.js:91

  • ButtonRoot's overridesResolver no longer includes styles.colorPrimary/styles.colorSecondary/etc. As a result, theme components.MuiButton.styleOverrides.color* entries won't be applied even though the corresponding utility classes are still generated on the root element. Include styles[color${capitalize(ownerState.color)}] (and optionally drop the special-casing for inherit) so color-based style overrides keep working after removing the deprecated variant+color classes.
    return [
      styles.root,
      styles[ownerState.variant],
      styles[`size${capitalize(ownerState.size)}`],
      ownerState.color === 'inherit' && styles.colorInherit,
      ownerState.disableElevation && styles.disableElevation,
      ownerState.fullWidth && styles.fullWidth,
      ownerState.loading && styles.loading,
    ];

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

You can also share your feedback on Copilot code review. Take the survey.

npx @mui/codemod@latest deprecations/button-classes <path>
```

The following deprecated `Button` CSS classes have been removed:
Copy link
Member

Choose a reason for hiding this comment

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

When we are removing classes, we are also removing the keys in the theme overrides styles key. These are a bit of an "older" API but still valid. Should we mention these as breaking changes too? cc @siriwatknp

Copy link
Member

Choose a reason for hiding this comment

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

yes.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 18, 2026
@silviuaavram silviuaavram force-pushed the chore/remove-deprecated-props-7 branch from 6727703 to 5180c68 Compare March 18, 2026 13:25
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 18, 2026
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. scope: button Changes related to the button. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. v9.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants