[TextField] inputClassName does not add a class to the input element but to its wrapper
Had a quick look through the sourcecode.
It seems the Input component accepts both className (for the wrapper) and inputClassName. The TextField component accepts these same props and passes on the inputClassName it receives to the className prop of the Input component (which in turn applies the class to the wrapper element, not the input element). This means there is no way of passing a class to the actual input element from a TextField component.
I've only just started using Material-UI so not sure if this is expected behavior or not. If it is the naming might be confusing.
Apart from these findings, the core issue we are having and tried solving by passing a class is the input element being smaller than the underline because underline's default style is set to 100% and the input element's is not.
Could you provide a reproduction example? That would help. I'm not sure what's your input.
inputClassName
The first issue (at least if our assumption of the expected behavior is correct) is actually really simple, we expected the following:
<TextField inputClassName="inputclass" />
to render the the inner native input element like this:
<input class="inputclass" />
but instead it renders the class to the wrapper
<div class="inputclass">
<input />
</div>
input element width
The reason we tried passing down a class to this input element, is because this piece of code:
<Paper style="width: 400px;">
<Textfield label="password"/>
</Paper>
results in the underline of the textfield being full width, but the input field itself isn't full width.

@Zuurkern What about having .inputclass > input {...} in your css?
Thing is, that this behaves correctly from component side of view. inputclass is applied to component, which is responsible for input, which is by-the-way implemented by html input. But not neccesarily. Which means, your class is set to the root element of that component for you to have proper customization powers. If that class is not applied to the root element of component, it would close doors to other people, who want to customize that wrapper element.
Probably connected to https://github.com/callemall/material-ui/issues/5834
What about having .inputclass > input {...} in your css?
@ArcanisCz I would discourage that pattern. It's likely to break.
@Zuurkern I see two options:
- We add a
inputDomClassnameproperty or whatever name we agree on. - You use the lower level components
FormControl,InputLabelandInput.
Our of curiosity, what do you want to change?
Apart from these findings, the core issue we are having and tried solving by passing a class is the input element being smaller than the underline because underline's default style is set to 100% and the input element's is not.
Oh my mad. I have just had that issue trying out the next branch.