Skip to content

Commit f261224

Browse files
authored
[TextField] Use deprecatedPropType on the deprecated props (#27503)
1 parent 6014b62 commit f261224

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

docs/pages/api-docs/text-field.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ The `MuiTextField` name can be used for providing [default props](/customization
8181
| <span class="prop-name">onChange</span> | <span class="prop-type">func</span> | | Callback fired when the value is changed.<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback. You can pull out the new value by accessing `event.target.value` (string). |
8282
| <span class="prop-name">placeholder</span> | <span class="prop-type">string</span> | | The short hint displayed in the input before the user enters a value. |
8383
| <span class="prop-name">required</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, the label is displayed as required and the `input` element` will be required. |
84-
| <span class="prop-name">rows</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Number of rows to display when multiline option is set to true. |
85-
| <span class="prop-name">rowsMax</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Maximum number of rows to display. |
84+
| ~~<span class="prop-name">rows</span>~~ | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | *Deprecated*. Use `minRows` instead<br><br>Number of rows to display when multiline option is set to true. |
85+
| ~~<span class="prop-name">rowsMax</span>~~ | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | *Deprecated*. Use `maxRows` instead<br><br>Maximum number of rows to display. |
8686
| <span class="prop-name">select</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | Render a [`Select`](/api/select/) element while passing the Input element to `Select` as `input` parameter. If this option is set you must pass the options of the select as children. |
8787
| <span class="prop-name">SelectProps</span> | <span class="prop-type">object</span> | | Props applied to the [`Select`](/api/select/) element. |
8888
| <span class="prop-name">size</span> | <span class="prop-type">'medium'<br>&#124;&nbsp;'small'</span> | | The size of the text field. |

packages/material-ui/src/TextField/TextField.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react';
22
import PropTypes from 'prop-types';
33
import clsx from 'clsx';
44
import { refType } from '@material-ui/utils';
5+
import deprecatedPropType from '../utils/deprecatedPropType';
56
import Input from '../Input';
67
import FilledInput from '../FilledInput';
78
import OutlinedInput from '../OutlinedInput';
@@ -334,12 +335,18 @@ TextField.propTypes = {
334335
* Number of rows to display when multiline option is set to true.
335336
* @deprecated Use `minRows` instead.
336337
*/
337-
rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
338+
rows: deprecatedPropType(
339+
PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
340+
'Use `minRows` instead',
341+
),
338342
/**
339343
* Maximum number of rows to display.
340344
* @deprecated Use `maxRows` instead.
341345
*/
342-
rowsMax: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
346+
rowsMax: deprecatedPropType(
347+
PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
348+
'Use `maxRows` instead',
349+
),
343350
/**
344351
* Render a [`Select`](/api/select/) element while passing the Input element to `Select` as `input` parameter.
345352
* If this option is set you must pass the options of the select as children.

0 commit comments

Comments
 (0)