material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[TextField] applying style height doesn't move all the elements properly

Open jhanink opened this issue 11 years ago • 6 comments

choosing a shorter height to collapse the space between multiple vertically listed fields doesn't reposition the label, floating text label or input correctly

<div>
        <div style={this.style}>
          <TextField
            hintText="Please enter your first name"
            floatingLabelText="First Name"
              style={{border:'1px solid green',height:'40px'}}/>
        </div>
        <div style={this.style}>
          <TextField
            hintText="Please enter your middle name"
            floatingLabelText="Middle Name"
            style={{border:'1px solid green'}}/>
        </div>
        <div style={this.style}>
          <TextField
              hintText="Please enter your last name"
              floatingLabelText="Last Name"
              style={{border:'1px solid green'}}/>
        </div>
      </div>

text-field-jh1 text-field-jh2

jhanink avatar Jun 13 '15 05:06 jhanink

I know we also have props for floatingLabelStyle and hintStyle. However, after some tinkering around, I haven't been able to get this use case working successfully using only those props (in a non-hacky way of course).

cc: @oliviertassinari do you also wanna take a look at this? I feel like some code would need to change in the TextField source..

shaurya947 avatar Nov 16 '15 21:11 shaurya947

We have kind of the same issue when we change the font size. The component is using absolute value, it wasn't design with this concern in mind. I'm wondering if flex box couldn't make our life easier here.

oliviertassinari avatar Nov 16 '15 22:11 oliviertassinari

This is causing me pain as well.

djmccormick avatar Mar 13 '16 17:03 djmccormick

It's nasty, but until we get something better in place, I'm using negative top margin:

  floatingLabelStyle={{
        marginTop: -10
  }}

Dreculah avatar Mar 14 '16 21:03 Dreculah

I hope the above solution helps for now. TextField requires a re-write to do away with the styling issues.

I am closing this issue for now. If someone who has this issue does not gets help from the above solutions, please leave a comment below.

tintin1343 avatar May 03 '16 20:05 tintin1343

.MuiInput-input-25 { padding: 25px 0px 8px; }

Keagnn avatar Jul 17 '18 00:07 Keagnn