0

How do I properly change the height of React Material UI v4 Textfield? The following code messes up the label. Looking for a simple and easy method.

export const useTextFieldStyles = makeStyles({
  root: {
    minHeight: '42px',
  },
});

<TextField
{...params}
margin="dense"
value={listItem}
InputProps={{
  classes: {
    input: textFieldStyles.root,
  },
}}
/>

enter image description here

Referring to this link: Set TextField height material-ui

mattsmith5
  • 540
  • 4
  • 29
  • 67

2 Answers2

1

You can do this with changing style of mui component in your style classes like this

MuiInputLabel-outlined.MuiInputLabel-shrink 
{
  padding: .3rem !important;
  transform: translate(-14px, -14px) scale(0.7) !important;
}

You can change my params

sajadab
  • 383
  • 2
  • 11
0

The input element has a padding and is wrapped inside a div. To change the padding use:

<TextField
  inputProps={{ style: { padding: '10px' } }}
  ...
/>

You can use this for basically any style.

LW001
  • 2,452
  • 6
  • 27
  • 36
s0h3i1
  • 1
  • 2