Skip to content

Commit f389f2c

Browse files
authored
[TextField] Make the position prop required in InputAdornment (#25891)
1 parent f544ebc commit f389f2c

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

docs/pages/api-docs/input-adornment.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
{
22
"props": {
3+
"position": {
4+
"type": { "name": "enum", "description": "'end'<br>&#124;&nbsp;'start'" },
5+
"required": true
6+
},
37
"children": { "type": { "name": "node" } },
48
"classes": { "type": { "name": "object" } },
59
"component": { "type": { "name": "elementType" } },
610
"disablePointerEvents": { "type": { "name": "bool" } },
711
"disableTypography": { "type": { "name": "bool" } },
8-
"position": { "type": { "name": "enum", "description": "'end'<br>&#124;&nbsp;'start'" } },
912
"sx": { "type": { "name": "object" } },
1013
"variant": {
1114
"type": {

docs/src/pages/guides/migration-v4/migration-v4.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,15 @@ As the core components use emotion as a styled engine, the props used by emotion
12361236
+<Input size="small" />
12371237
```
12381238

1239+
- Set the InputAdornment `position` prop to `start` or `end`. Use `start` if used as the value of the `startAdornment` prop. Use `end` if used as the value of the `endAdornment` prop.
1240+
1241+
```diff
1242+
-<TextField startAdornment={<InputAdornment>Kg</InputAdornment>} />
1243+
-<TextField endAdornment={<InputAdornment>Kg</InputAdornment>} />
1244+
+<TextField startAdornment={<InputAdornment position="start">Kg</InputAdornment>} />
1245+
+<TextField endAdornment={<InputAdornment position="end">Kg</InputAdornment>} />
1246+
```
1247+
12391248
### TextareaAutosize
12401249

12411250
- Remove the `rows` prop, use the `minRows` prop instead.

packages/material-ui/src/InputAdornment/InputAdornment.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export interface InputAdornmentTypeMap<P = {}, D extends React.ElementType = 'di
4242
/**
4343
* The position this adornment should appear relative to the `Input`.
4444
*/
45-
position?: 'start' | 'end';
45+
position: 'start' | 'end';
4646
/**
4747
* The system prop that allows defining system overrides as well as additional CSS styles.
4848
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ InputAdornment.propTypes /* remove-proptypes */ = {
180180
/**
181181
* The position this adornment should appear relative to the `Input`.
182182
*/
183-
position: PropTypes.oneOf(['end', 'start']),
183+
position: PropTypes.oneOf(['end', 'start']).isRequired,
184184
/**
185185
* The system prop that allows defining system overrides as well as additional CSS styles.
186186
*/

0 commit comments

Comments
 (0)