Skip to content
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

[TextField] Make the position prop required in InputAdornment #25891

Merged
merged 2 commits into from
Apr 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 4 additions & 1 deletion docs/pages/api-docs/input-adornment.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"props": {
"position": {
"type": { "name": "enum", "description": "'end'<br>&#124;&nbsp;'start'" },
"required": true
},
"children": { "type": { "name": "node" } },
"classes": { "type": { "name": "object" } },
"component": { "type": { "name": "elementType" } },
"disablePointerEvents": { "type": { "name": "bool" } },
"disableTypography": { "type": { "name": "bool" } },
"position": { "type": { "name": "enum", "description": "'end'<br>&#124;&nbsp;'start'" } },
"sx": { "type": { "name": "object" } },
"variant": {
"type": {
Expand Down
9 changes: 9 additions & 0 deletions docs/src/pages/guides/migration-v4/migration-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,15 @@ As the core components use emotion as a styled engine, the props used by emotion
+<Input size="small" />
```

- 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.

```diff
-<TextField startAdornment={<InputAdornment>Kg</InputAdornment>} />
-<TextField endAdornment={<InputAdornment>Kg</InputAdornment>} />
+<TextField startAdornment={<InputAdornment position="start">Kg</InputAdornment>} />
+<TextField endAdornment={<InputAdornment position="end">Kg</InputAdornment>} />
```

### TextareaAutosize

- Remove the `rows` prop, use the `minRows` prop instead.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface InputAdornmentTypeMap<P = {}, D extends React.ElementType = 'di
/**
* The position this adornment should appear relative to the `Input`.
*/
position?: 'start' | 'end';
position: 'start' | 'end';
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/InputAdornment/InputAdornment.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ InputAdornment.propTypes /* remove-proptypes */ = {
/**
* The position this adornment should appear relative to the `Input`.
*/
position: PropTypes.oneOf(['end', 'start']),
position: PropTypes.oneOf(['end', 'start']).isRequired,
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
Expand Down