Skip to content

[card] Remove deprecated CardHeader props#47995

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

[card] Remove deprecated CardHeader props#47995
silviuaavram wants to merge 1 commit intomui:masterfrom
silviuaavram:chore/remove-deprecated-props-6

Conversation

@silviuaavram
Copy link
Member

@silviuaavram silviuaavram commented Mar 16, 2026

Copilot AI review requested due to automatic review settings March 16, 2026 15:48
@silviuaavram silviuaavram added breaking change Introduces changes that are not backward compatible. scope: card Changes related to the card. 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 16, 2026
@mui-bot
Copy link

mui-bot commented Mar 16, 2026

Netlify deploy preview

Bundle size report

Bundle Parsed size Gzip size
@mui/material ▼-75B(-0.01%) 🔺+7B(0.00%)
@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 36354a8

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 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 CardHeader runtime implementation and PropTypes.
  • Removed deprecated props (and related generics) from CardHeader TypeScript 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 / subheaderTypographyProps from the destructuring, those props will now remain in ...other and 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 },
}}
/>;
@oliviertassinari oliviertassinari changed the title [cardheader] Remove deprecated props [card] Remove deprecated CardHeader props Mar 17, 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: card Changes related to the card. 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.

3 participants