[card] Remove deprecated CardHeader props#47995
Open
silviuaavram wants to merge 1 commit intomui:masterfrom
Open
[card] Remove deprecated CardHeader props#47995silviuaavram wants to merge 1 commit intomui:masterfrom
silviuaavram wants to merge 1 commit intomui:masterfrom
Conversation
Netlify deploy previewBundle size report
|
36 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Removes the deprecated CardHeader props (titleTypographyProps / subheaderTypographyProps) and updates the implementation, TypeScript types, type tests, and documentation to rely on slotProps instead (including adding an upgrade-to-v9 migration note).
Changes:
- Removed deprecated props from
CardHeaderruntime implementation and PropTypes. - Removed deprecated props (and related generics) from
CardHeaderTypeScript definitions. - Updated type tests and API docs JSON, and added a v9 migration snippet/codemod pointer.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/mui-material/src/CardHeader/CardHeader.spec.tsx | Replaces deprecated prop type tests with slotProps-based tests (currently has several missing @ts-expect-error annotations). |
| packages/mui-material/src/CardHeader/CardHeader.js | Removes deprecated prop handling and PropTypes entries (note: removed prop names may now leak via ...other). |
| packages/mui-material/src/CardHeader/CardHeader.d.ts | Removes deprecated props and related generics from public TS types. |
| docs/translations/api-docs/card-header/card-header.json | Removes deprecated prop entries from translated API docs. |
| docs/pages/material-ui/api/card-header.json | Removes deprecated prop entries from the generated API docs page JSON. |
| docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md | Adds migration guidance and codemod command for the removed CardHeader props. |
Comments suppressed due to low confidence (1)
packages/mui-material/src/CardHeader/CardHeader.js:88
- After removing
titleTypographyProps/subheaderTypographyPropsfrom the destructuring, those props will now remain in...otherand end up being forwarded to the root slot (as unknown DOM attributes) if consumers still pass them. Consider explicitly destructuring and discarding these removed props (without supporting them) to avoid leaking them to the DOM and triggering React unknown-prop warnings.
const {
action,
avatar,
component = 'div',
disableTypography = false,
subheader: subheaderProp,
title: titleProp,
slots = {},
slotProps = {},
...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.
| React.createElement<CardHeaderProps>(CardHeader, { | ||
| // @ts-expect-error | ||
| titleTypographyProps: true, | ||
| slotProps: { |
Comment on lines
135
to
140
| <CardHeader | ||
| component={CustomComponent} | ||
| stringProp="string" | ||
| numberProp={1} | ||
| titleTypographyProps={{ component: CustomComponent, stringProp: 'stringProp', numberProp: 2 }} | ||
| slotProps={{ title: { component: CustomComponent, stringProp: 'stringProp', numberProp: 2 } }} | ||
| />; |
| <CardHeader titleTypographyProps={{ component: 'incorrectComponent' }} />; | ||
| <CardHeader titleTypographyProps={{ component: 'a', href: 'href' }} />; | ||
| <CardHeader slotProps={{ title: { component: 'incorrectComponent' } }} />; | ||
| <CardHeader slotProps={{ title: { component: 'a', href: 'href' } }} />; |
Comment on lines
+232
to
237
| <CardHeader slotProps={{ subheader: { component: 'a', href: 'href' } }} />; | ||
| <CardHeader | ||
| subheaderTypographyProps={{ | ||
| component: CustomComponent, | ||
| stringProp: 'stringProp', | ||
| numberProp: 2, | ||
| slotProps={{ | ||
| subheader: { component: CustomComponent, stringProp: 'stringProp', numberProp: 2 }, | ||
| }} | ||
| />; |
| <CardHeader subheaderTypographyProps={{ component: 'incorrectComponent' }} />; | ||
| // @ts-expect-error | ||
| <CardHeader subheaderTypographyProps={{ component: CustomComponent, numberProp: 2 }} />; | ||
| <CardHeader slotProps={{ subheader: { component: 'incorrectComponent' } }} />; |
Comment on lines
299
to
316
| <CardHeader | ||
| titleTypographyProps={{ component: CustomComponent, numberProp: 2 }} | ||
| subheaderTypographyProps={{ component: CustomComponent, numberProp: 2 }} | ||
| slotProps={{ | ||
| title: { component: CustomComponent, numberProp: 2 }, | ||
| subheader: { component: CustomComponent, numberProp: 2 }, | ||
| }} | ||
| />; | ||
| <CardHeader | ||
| // @ts-expect-error | ||
| titleTypographyProps={{ component: CustomComponent, numberProp: 2 }} | ||
| subheaderTypographyProps={{ component: CustomComponent, numberProp: 2, stringProp: 'yada' }} | ||
| slotProps={{ | ||
| title: { component: CustomComponent, numberProp: 2 }, | ||
| subheader: { component: CustomComponent, numberProp: 2, stringProp: 'yada' }, | ||
| }} | ||
| />; | ||
| <CardHeader | ||
| titleTypographyProps={{ component: CustomComponent, numberProp: 2, stringProp: 'yada' }} | ||
| // @ts-expect-error | ||
| subheaderTypographyProps={{ component: CustomComponent, numberProp: 2 }} | ||
| slotProps={{ | ||
| title: { component: CustomComponent, numberProp: 2, stringProp: 'yada' }, | ||
| subheader: { component: CustomComponent, numberProp: 2 }, | ||
| }} | ||
| />; |
Comment on lines
204
to
212
| <CardHeader | ||
| titleTypographyProps={{ | ||
| component: CustomComponent, | ||
| stringProp: 'stringProp', | ||
| numberProp: '', | ||
| slotProps={{ | ||
| title: { | ||
| component: CustomComponent, | ||
| stringProp: 'stringProp', | ||
| numberProp: '', | ||
| }, | ||
| }} | ||
| />; |
Comment on lines
272
to
277
| <CardHeader | ||
| titleTypographyProps={{ component: CustomComponent, stringProp: 'stringProp', numberProp: 2 }} | ||
| subheaderTypographyProps={{ | ||
| component: CustomComponent, | ||
| stringProp: 'stringProp', | ||
| numberProp: 2, | ||
| slotProps={{ | ||
| title: { component: CustomComponent, stringProp: 'stringProp', numberProp: 2 }, | ||
| subheader: { component: CustomComponent, stringProp: 'stringProp', numberProp: 2 }, | ||
| }} | ||
| />; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.