Skip to content

[alert] Remove deprecated props#47965

Open
silviuaavram wants to merge 1 commit intomui:masterfrom
silviuaavram:chore/remove-deprecated-props-1
Open

[alert] Remove deprecated props#47965
silviuaavram wants to merge 1 commit intomui:masterfrom
silviuaavram:chore/remove-deprecated-props-1

Conversation

@silviuaavram
Copy link
Member

@silviuaavram silviuaavram commented Mar 13, 2026

@silviuaavram silviuaavram added scope: alert Changes related to the alert. 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 breaking change Introduces changes that are not backward compatible. labels Mar 13, 2026
@mui-bot
Copy link

mui-bot commented Mar 13, 2026

Netlify deploy preview

Bundle size report

Bundle Parsed size Gzip size
@mui/material ▼-100B(-0.02%) ▼-27B(-0.02%)
@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 e78fb7c

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 the deprecated components / componentsProps API from Alert in MUI Material, aligning the component with the slots / slotProps customization model and updating related tests/types/docs for v9.

Changes:

  • Removed components and componentsProps handling from packages/mui-material/src/Alert/Alert.js and from the public TypeScript types.
  • Updated Alert tests to use slots / slotProps for close button/icon customization.
  • Updated API docs JSON + added a v9 migration note documenting the removed props.

Reviewed changes

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

Show a summary per file
File Description
packages/mui-material/src/Alert/Alert.js Removes deprecated prop support and simplifies forwarded slot configuration.
packages/mui-material/src/Alert/Alert.d.ts Drops deprecated props from the public TS surface.
packages/mui-material/src/Alert/Alert.test.js Updates tests to exercise slots/slotProps for close button/icon.
docs/translations/api-docs/alert/alert.json Removes deprecated prop entries from translated API docs.
docs/pages/material-ui/api/alert.json Removes deprecated prop entries from generated API JSON.
docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md Documents the Alert deprecations removal and shows the replacement API.
Comments suppressed due to low confidence (1)

packages/mui-material/src/Alert/Alert.js:175

  • By removing components and componentsProps from the destructured props, any consumer still passing these (or having them in theme defaultProps) will leave them inside ...other and they will be forwarded to the root slot via useSlot (as DOM attributes on the underlying element), causing React unknown-prop warnings and invalid HTML. Even if the props are removed from the public API, they should be explicitly omitted from other (e.g. destructure them into unused variables) so they are not spread to the root slot.
const Alert = React.forwardRef(function Alert(inProps, ref) {
  const props = useDefaultProps({ props: inProps, name: 'MuiAlert' });
  const {
    action,
    children,
    className,
    closeText = 'Close',
    color,
    icon,
    iconMapping = defaultIconMapping,
    onClose,
    role = 'alert',
    severity = 'success',
    slotProps = {},
    slots = {},
    variant = 'standard',
    ...other
  } = props;

💡 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.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 13, 2026
@silviuaavram silviuaavram force-pushed the chore/remove-deprecated-props-1 branch from 3f59e9a to e78fb7c Compare March 13, 2026 14:42
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 13, 2026
@ZeeshanTamboli ZeeshanTamboli changed the title [alert]: remove deprecated props [alert] Remove deprecated props Mar 14, 2026
```

#### Alert deprecated props removed

Copy link
Member

Choose a reason for hiding this comment

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


#### Alert deprecated props removed

The deprecated `components` and `componentsProps` props have been removed. Use `slots` and `slotProps` instead.
Copy link
Member

@siriwatknp siriwatknp Mar 16, 2026

Choose a reason for hiding this comment

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

How about this format?

Suggested change
The deprecated `components` and `componentsProps` props have been removed. Use `slots` and `slotProps` instead.
The deprecated `components` and `componentsProps` props have been removed.
Migrate to `slots` and `slotProps` with the codemod below:
```bash
npx codemod …

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: alert Changes related to the alert. 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