Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
63f66be
initial commit
ZeeshanTamboli Feb 28, 2026
2d39118
Fix props in Autocomplete
ZeeshanTamboli Feb 28, 2026
7c5e2d6
fix tests
ZeeshanTamboli Feb 28, 2026
4011147
docs updates
ZeeshanTamboli Mar 2, 2026
a59adb8
fix types
ZeeshanTamboli Mar 2, 2026
0579515
Merge branch 'master' into textfield-remove-deprecated-props
ZeeshanTamboli Mar 2, 2026
4a529cc
add fallback to slotProps.input
ZeeshanTamboli Mar 2, 2026
10be3d1
fix proptypes
ZeeshanTamboli Mar 2, 2026
16e5d16
rerun CI
ZeeshanTamboli Mar 2, 2026
2598aae
Fix regression tests
ZeeshanTamboli Mar 2, 2026
8547986
Add breaking changes docs
ZeeshanTamboli Mar 2, 2026
2c0f392
Update docs
ZeeshanTamboli Mar 2, 2026
e46332b
Merge branch 'master' into textfield-remove-deprecated-props
ZeeshanTamboli Mar 5, 2026
abcbf92
resolve review
ZeeshanTamboli Mar 5, 2026
b1f8568
Merge branch 'master' into textfield-remove-deprecated-props
ZeeshanTamboli Mar 5, 2026
00d0552
Merge branch 'textfield-remove-deprecated-props' of https://github.co…
ZeeshanTamboli Mar 5, 2026
728a857
Resolve conflict
ZeeshanTamboli Mar 5, 2026
b2f7125
fix
ZeeshanTamboli Mar 5, 2026
3b04322
Merge branch 'master' into textfield-remove-deprecated-props
ZeeshanTamboli Mar 5, 2026
7567f66
Merge branch 'master' into textfield-remove-deprecated-props
ZeeshanTamboli Mar 10, 2026
0ea1749
Add codemod for Autocomplete renderInput
ZeeshanTamboli Mar 10, 2026
cc4c2e9
Add in upgrade-to-v9 docs
ZeeshanTamboli Mar 10, 2026
df39945
prettier
ZeeshanTamboli Mar 10, 2026
3c89919
fix codemod
ZeeshanTamboli Mar 10, 2026
f010a26
resolve conflicts
ZeeshanTamboli Mar 12, 2026
9f3a7b2
resolve conflict
ZeeshanTamboli Mar 13, 2026
05ca025
[codemod] Add tests for MyAutocomplete and CustomAutocomplete
ZeeshanTamboli Mar 13, 2026
7d01e7e
Merge branch 'master' into textfield-remove-deprecated-props
ZeeshanTamboli Mar 13, 2026
9ae79cf
remove normalization regex
ZeeshanTamboli Mar 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/data/material/components/autocomplete/Asynchronous.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ export default function Asynchronous() {
{...params}
label="Asynchronous"
slotProps={{
...params.slotProps,
input: {
...params.InputProps,
...params.slotProps.input,
endAdornment: (
<React.Fragment>
{loading ? <CircularProgress color="inherit" size={20} /> : null}
{params.InputProps.endAdornment}
{params.slotProps.input.endAdornment}
</React.Fragment>
),
},
Expand Down
5 changes: 3 additions & 2 deletions docs/data/material/components/autocomplete/Asynchronous.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ export default function Asynchronous() {
{...params}
label="Asynchronous"
slotProps={{
...params.slotProps,
input: {
...params.InputProps,
...params.slotProps.input,
endAdornment: (
<React.Fragment>
{loading ? <CircularProgress color="inherit" size={20} /> : null}
{params.InputProps.endAdornment}
{params.slotProps.input.endAdornment}
</React.Fragment>
),
},
Expand Down
3 changes: 2 additions & 1 deletion docs/data/material/components/autocomplete/CountrySelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ export default function CountrySelect() {
{...params}
label="Choose a country"
slotProps={{
...params.slotProps,
htmlInput: {
...params.inputProps,
...params.slotProps.htmlInput,
autoComplete: 'new-password', // disable autocomplete and autofill
},
}}
Expand Down
3 changes: 2 additions & 1 deletion docs/data/material/components/autocomplete/CountrySelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ export default function CountrySelect() {
{...params}
label="Choose a country"
slotProps={{
...params.slotProps,
htmlInput: {
...params.inputProps,
...params.slotProps.htmlInput,
autoComplete: 'new-password', // disable autocomplete and autofill
},
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export default function CustomInputAutocomplete() {
id="custom-input-demo"
options={options}
renderInput={(params) => (
<div ref={params.InputProps.ref}>
<input type="text" {...params.inputProps} />
<div ref={params.slotProps.input.ref}>
<input type="text" {...params.slotProps.htmlInput} />
</div>
)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export default function CustomInputAutocomplete() {
id="custom-input-demo"
options={options}
renderInput={(params) => (
<div ref={params.InputProps.ref}>
<input type="text" {...params.inputProps} />
<div ref={params.slotProps.input.ref}>
<input type="text" {...params.slotProps.htmlInput} />
</div>
)}
/>
Expand Down
3 changes: 2 additions & 1 deletion docs/data/material/components/autocomplete/FreeSolo.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ export default function FreeSolo() {
{...params}
label="Search input"
slotProps={{
...params.slotProps,
input: {
...params.InputProps,
...params.slotProps.input,
type: 'search',
},
}}
Expand Down
3 changes: 2 additions & 1 deletion docs/data/material/components/autocomplete/FreeSolo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ export default function FreeSolo() {
{...params}
label="Search input"
slotProps={{
...params.slotProps,
input: {
...params.InputProps,
...params.slotProps.input,
type: 'search',
},
}}
Expand Down
4 changes: 2 additions & 2 deletions docs/data/material/components/autocomplete/GitHubLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ export default function GitHubLabel() {
getOptionLabel={(option) => option.name}
renderInput={(params) => (
<StyledInput
ref={params.InputProps.ref}
inputProps={params.inputProps}
ref={params.slotProps.input.ref}
inputProps={params.slotProps.htmlInput}
autoFocus
placeholder="Filter labels"
/>
Expand Down
4 changes: 2 additions & 2 deletions docs/data/material/components/autocomplete/GitHubLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ export default function GitHubLabel() {
getOptionLabel={(option) => option.name}
renderInput={(params) => (
<StyledInput
ref={params.InputProps.ref}
inputProps={params.inputProps}
ref={params.slotProps.input.ref}
inputProps={params.slotProps.htmlInput}
autoFocus
placeholder="Filter labels"
/>
Expand Down
9 changes: 6 additions & 3 deletions docs/data/material/components/autocomplete/autocomplete.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,12 @@ In the event you want the avoid autofill, you can try the following:
```jsx
<TextField
{...params}
inputProps={{
...params.inputProps,
autoComplete: 'new-password',
slotProps={{
...params.slotProps,
htmlInput: {
...params.slotProps.htmlInput,
autoComplete: 'new-password',
},
}}
/>
```
Expand Down
48 changes: 48 additions & 0 deletions docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,51 @@ If you were using `MuiTouchRipple` in your theme, remove it and use global CSS w
### JSDOM support

v9 removes all usage of `process.env.NODE_ENV === 'test'`. The `NODE_ENV` variable will exclusively be used for for tree-shaking. Our libraries have been updated to auto-detect DOM environments that don't support layout such as [JSDOM](https://github.com/jsdom/jsdom) and [happy-dom](https://github.com/capricorn86/happy-dom) through user agent sniffing.

### Deprecated APIs removed

APIs that were deprecated earlier have been removed in v9.

#### TextField deprecated props removed

The deprecated `TextField` props have been removed.
Use the `slotProps` prop instead:

```diff
<TextField
- InputProps={CustomInputProps}
- inputProps={CustomHtmlInputProps}
- SelectProps={CustomSelectProps}
- InputLabelProps={CustomInputLabelProps}
- FormHelperTextProps={CustomFormHelperTextProps}
+ slotProps={{
+ input: CustomInputProps,
+ htmlInput: CustomHtmlInputProps,
+ select: CustomSelectProps,
+ inputLabel: CustomInputLabelProps,
+ formHelperText: CustomFormHelperTextProps,
+ }}
/>
```

If you render a `TextField` from `Autocomplete`, the `params` shape also changed to match the new `TextField` API:

```diff
<Autocomplete
renderInput={(params) => (
<TextField
{...params}
- inputProps={{
- ...params.inputProps,
- autoComplete: 'new-password',
+ slotProps={{
+ ...params.slotProps,
+ htmlInput: {
+ ...params.slotProps.htmlInput,
+ autoComplete: 'new-password',
+ },
}}
/>
)}
/>
```
25 changes: 0 additions & 25 deletions docs/pages/material-ui/api/text-field.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,9 @@
"defaultValue": { "type": { "name": "any" } },
"disabled": { "type": { "name": "bool" }, "default": "false" },
"error": { "type": { "name": "bool" }, "default": "false" },
"FormHelperTextProps": {
"type": { "name": "object" },
"deprecated": true,
"deprecationInfo": "Use <code>slotProps.formHelperText</code> instead. This prop will be removed in a future major release. See <a href=\"https://mui.com/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"fullWidth": { "type": { "name": "bool" }, "default": "false" },
"helperText": { "type": { "name": "node" } },
"id": { "type": { "name": "string" } },
"InputLabelProps": {
"type": { "name": "object" },
"deprecated": true,
"deprecationInfo": "Use <code>slotProps.inputLabel</code> instead. This prop will be removed in a future major release. See <a href=\"https://mui.com/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"inputProps": {
"type": { "name": "object" },
"deprecated": true,
"deprecationInfo": "Use <code>slotProps.htmlInput</code> instead. This prop will be removed in a future major release. See <a href=\"https://mui.com/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"InputProps": {
"type": { "name": "object" },
"deprecated": true,
"deprecationInfo": "Use <code>slotProps.input</code> instead. This prop will be removed in a future major release. See <a href=\"https://mui.com/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"inputRef": { "type": { "name": "custom", "description": "ref" } },
"label": { "type": { "name": "node" } },
"margin": {
Expand All @@ -57,11 +37,6 @@
"required": { "type": { "name": "bool" }, "default": "false" },
"rows": { "type": { "name": "union", "description": "number<br>&#124;&nbsp;string" } },
"select": { "type": { "name": "bool" }, "default": "false" },
"SelectProps": {
"type": { "name": "object" },
"deprecated": true,
"deprecationInfo": "Use <code>slotProps.select</code> instead. This prop will be removed in a future major release. See <a href=\"https://mui.com/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"size": {
"type": {
"name": "union",
Expand Down
10 changes: 6 additions & 4 deletions docs/src/modules/components/AppLayoutDocsFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,12 @@ export default function AppLayoutDocsFooter(props) {
rows={2}
value={comment}
onChange={handleChangeTextfield}
inputProps={{
'aria-label': t('feedbackCommentLabel'),
'aria-describedby': 'feedback-description',
ref: inputRef,
slotProps={{
htmlInput: {
'aria-label': t('feedbackCommentLabel'),
'aria-describedby': 'feedback-description',
ref: inputRef,
},
}}
/>
{rating !== 1 && typeof window !== 'undefined' && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,70 +72,54 @@ const styles = ({ theme }) => ({
});

function TextField(props) {
const {
InputProps = {},
InputLabelProps,
noBorder,
size = 'medium',
SelectProps,
...other
} = props;
const { slotProps = {}, noBorder, size = 'medium', ...other } = props;

const {
classes: { input: InputPropsClassesInput, ...InputPropsClassesOther } = {},
...InputPropsOther
} = InputProps;
} = slotProps.input ?? {};

return (
<MuiTextField
InputProps={{
classes: {
root: classes.root,
input: clsx(
classes.input,
inputStyleMappingClasses[size],
{
[classes.inputBorder]: !noBorder,
},
InputPropsClassesInput,
),
...InputPropsClassesOther,
slotProps={{
...slotProps,
input: {
classes: {
root: classes.root,
input: clsx(
classes.input,
inputStyleMappingClasses[size],
{
[classes.inputBorder]: !noBorder,
},
InputPropsClassesInput,
),
...InputPropsClassesOther,
},
disableUnderline: true,
...InputPropsOther,
},
inputLabel: {
...slotProps.inputLabel,
shrink: true,
},
disableUnderline: true,
...InputPropsOther,
}}
InputLabelProps={{
...InputLabelProps,
shrink: true,
}}
SelectProps={SelectProps}
{...other}
/>
);
}

TextField.propTypes = {
/**
* Props applied to the [`InputLabel`](https://mui.com/material-ui/api/input-label/) element.
* Pointer events like `onClick` are enabled if and only if `shrink` is `true`.
* @deprecated Use `slotProps.inputLabel` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
InputLabelProps: PropTypes.object,
/**
* Props applied to the Input element.
* It will be a [`FilledInput`](https://mui.com/material-ui/api/filled-input/),
* [`OutlinedInput`](https://mui.com/material-ui/api/outlined-input/) or [`Input`](https://mui.com/material-ui/api/input/)
* component depending on the `variant` prop value.
* @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
InputProps: PropTypes.object,
noBorder: PropTypes.bool,
/**
* Props applied to the [`Select`](https://mui.com/material-ui/api/select/) element.
* @deprecated Use `slotProps.select` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
SelectProps: PropTypes.object,
size: PropTypes.oneOf(['large', 'medium', 'small', 'xlarge']),
slotProps: PropTypes.shape({
formHelperText: PropTypes.object,
htmlInput: PropTypes.object,
input: PropTypes.object,
inputLabel: PropTypes.object,
root: PropTypes.object,
select: PropTypes.object,
}),
};

export default styled(TextField)(styles);
Loading
Loading