-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
[docs][codemod] Add v7 migration docs for deprecated Autocomplete APIs and Autocomplete codemod #47945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ZeeshanTamboli
merged 7 commits into
mui:master
from
ZeeshanTamboli:autocomplete-v7-deprecated-props-migration-docs-and-codemod
Mar 12, 2026
Merged
[docs][codemod] Add v7 migration docs for deprecated Autocomplete APIs and Autocomplete codemod #47945
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f446991
Add migrating from deprecated apis docs to v7
ZeeshanTamboli 33608bd
fix docs
ZeeshanTamboli 3ddb7dc
update docs
ZeeshanTamboli c1ec320
Add codemod
ZeeshanTamboli 596833a
prettier
ZeeshanTamboli 59e3d09
Merge branch 'master' into autocomplete-v7-deprecated-props-migration…
ZeeshanTamboli a2312ab
Apply suggestions from code review
ZeeshanTamboli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
docs/data/material/migration/upgrade-to-v7/migrating-from-deprecated-apis.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # Migrating from deprecated APIs | ||
|
|
||
| <p class="description">Learn how to migrate away from recently deprecated APIs before they become breaking changes.</p> | ||
|
|
||
| ## Why you should migrate | ||
|
|
||
| Features become deprecated over time as maintainers make improvements to the APIs. | ||
| Migrating to these improved APIs results in a better developer experience, so it's in your best interest to stay up to date. | ||
| Deprecated APIs often become breaking changes in subsequent major versions, so the sooner you migrate, the smoother the next major update will be. | ||
|
|
||
| ## Autocomplete | ||
|
|
||
| Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#autocomplete-props) below to migrate the code as described in the following sections: | ||
|
|
||
| ```bash | ||
| npx @mui/codemod@latest deprecations/autocomplete-props <path> | ||
| ``` | ||
|
|
||
| ### renderTags prop | ||
|
|
||
| The deprecated `renderTags` prop has been removed. Use `renderValue` instead. | ||
|
|
||
| ```diff | ||
| <Autocomplete | ||
| multiple | ||
| options={options} | ||
| - renderTags={(value, getTagProps, ownerState) => | ||
| - value.map((option, index) => ( | ||
| - <Chip label={option.label} {...getTagProps({ index })} /> | ||
| - )) | ||
| - } | ||
| + renderValue={(value, getItemProps, ownerState) => | ||
| + value.map((option, index) => ( | ||
| + <Chip label={option.label} {...getItemProps({ index })} /> | ||
| + )) | ||
| + } | ||
| /> | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ### useAutocomplete deprecated fields removed | ||
|
ZeeshanTamboli marked this conversation as resolved.
Outdated
|
||
|
|
||
| The following deprecated members have been removed from the `useAutocomplete` hook return value: | ||
|
ZeeshanTamboli marked this conversation as resolved.
Outdated
|
||
|
|
||
| - `getTagProps` → use `getItemProps` | ||
| - `focusedTag` → use `focusedItem` | ||
|
|
||
| #### getTagProps | ||
|
|
||
| ```diff | ||
| const { | ||
| - getTagProps, | ||
| + getItemProps, | ||
| } = useAutocomplete(props); | ||
|
|
||
| // ... | ||
| -<Chip {...getTagProps({ index })} /> | ||
| +<Chip {...getItemProps({ index })} /> | ||
| ``` | ||
|
|
||
| #### focusedTag | ||
|
|
||
| ```diff | ||
| const { | ||
| - focusedTag, | ||
| + focusedItem, | ||
| } = useAutocomplete(props); | ||
| ``` | ||
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
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
6 changes: 6 additions & 0 deletions
6
docs/pages/material-ui/migration/v7/migrating-from-deprecated-apis.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; | ||
| import * as pageProps from 'docs/data/material/migration/upgrade-to-v7/migrating-from-deprecated-apis.md?muiMarkdown'; | ||
|
|
||
| export default function Page() { | ||
| return <MarkdownDocs {...pageProps} />; | ||
| } |
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.