[TextField] helperText fixed height
See original GitHub issueProblem description
I’m a bit confused as to how have a proper error text in a form using TextField (think 'Both password should match").
I tried different approach:
- display the error text in
label
when there is an error- you don’t have a label anymore, it’s a bit confusing
- display the error text in
helperText
- the height change depending if there is an error or not. It’s not great to have clean layout and the form start to move around with each error.
- setting
helperText
to an empty string doesn’t fix the height issue.
- force
helperText
to be aFormHelperText
with an error string or not- even if it’s not a string,
TextField
will still wrap it in anotherFormHelperText
which lead to a<p>
inside a<p>
and a complain by react. This is not the behavior expected when you read the documentation.
- even if it’s not a string,
- change the
margin
property- none of them gives a stable height in this case.
Any hint ?
Versions
- Material-UI: 1.0.0-beta.4
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Text field with helper text should be the same height as without
I render " " to render empty helper text so the height of the input is always the same and the rest doesn't...
Read more >How to set the height knowing that under input will helper text ...
Rudolf's answer is close to what you need, but the minHeight needs to be applied to the TextField ( FormControl if using lower-level ......
Read more >fix height of TextField material Ui Code Example - Code Grepper
Queries related to “fix height of TextField material Ui” ... material ui textfield helper text size · text field material ui dimensions ·...
Read more >React Text Field component - Material UI - MUI
The multiline prop transforms the text field into a TextareaAutosize element. Unless the rows prop is set, the height of the text field...
Read more >How to Set MUI TextField Height and Width: The 3 Best Ways
Set MUI Height and Width with 'sx' Prop ... Perhaps the simplest way to set TextField width and height is to use only...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ho, actually, using a space for
helperText
is working. I got confused somehow.For the next guy, I’m using this finally (for redux-form):
So it’s working, but it still feel a bit awkward to me. Anyway …
In my project I fixed it in this way, blank space is the hack here