Skip to content

[Snackbar] Remove deprecated props#47997

Merged
siriwatknp merged 3 commits into
mui:masterfrom
siriwatknp:remove-deprecated-Snackbar-props
Mar 18, 2026
Merged

[Snackbar] Remove deprecated props#47997
siriwatknp merged 3 commits into
mui:masterfrom
siriwatknp:remove-deprecated-Snackbar-props

Conversation

@siriwatknp

Copy link
Copy Markdown
Member

Summary

Remove deprecated Snackbar props: ClickAwayListenerProps, ContentProps, TransitionComponent, TransitionProps.
Users should use slots/slotProps instead.

Breaking change

  • ClickAwayListenerPropsslotProps.clickAwayListener
  • ContentPropsslotProps.content
  • TransitionComponentslots.transition
  • TransitionPropsslotProps.transition

Migration:

 <Snackbar
-  ClickAwayListenerProps={CustomClickAwayListenerProps}
-  ContentProps={CustomContentProps}
-  TransitionComponent={CustomTransition}
-  TransitionProps={CustomTransitionProps}
+  slots={{ transition: CustomTransition }}
+  slotProps={{
+    clickAwayListener: CustomClickAwayListenerProps,
+    content: CustomContentProps,
+    transition: CustomTransitionProps,
+  }}
 />

Codemod:

npx @mui/codemod@latest deprecations/snackbar-props <path>

Test plan

  • TypeScript compilation passes
  • Unit tests pass (49 passed)
  • pnpm proptypes && pnpm docs:api regenerated
  • Migration guide updated
  • Docs text updated

@siriwatknp siriwatknp added breaking change Introduces changes that are not backward compatible. package: material-ui Specific to Material UI. labels Mar 17, 2026
@mui-bot

mui-bot commented Mar 17, 2026

Copy link
Copy Markdown

Netlify deploy preview

Bundle size report

Bundle Parsed size Gzip size
@mui/material ▼-260B(-0.05%) ▼-73B(-0.05%)
@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 7b9274a

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 17, 2026
npx @mui/codemod@latest deprecations/snackbar-props <path>
```

The deprecated `Snackbar` props have been removed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should list in these migration guide the props removed, to ease up the migration.

@siriwatknp siriwatknp changed the title [material-ui][Snackbar] Remove deprecated props [Snackbar] Remove deprecated props Mar 18, 2026
@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
}
slotProps={{
content: {
'aria-describedby': 'message-id',

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I take this opportunity to enable this sine DefinitelyTyped/DefinitelyTyped#22582 is merged

- TransitionComponent={CustomTransition}
- TransitionProps={CustomTransitionProps}
+ slots={{ transition: CustomTransition }}
+ slotProps={{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

in the guide we usually made use of actual props we could pass to those slots, should we also have that here?

@@ -216,11 +187,11 @@ const Snackbar = React.forwardRef(function Snackbar(inProps, ref) {
getSlotProps: (handlers) => ({
onEnter: (...params) => {
handlers.onEnter?.(...params);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

before removing handleEnter, we called handlers.onEnter and handleEnter had no onEnter because of destrcuturing right? now it's the same, as onEnter is called from handlers. just making sure I understand the flow :D

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes, correct.

@siriwatknp siriwatknp merged commit 40286df into mui:master Mar 18, 2026
23 checks passed
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. package: material-ui Specific to Material UI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants