Material UI - label overlap when using setValue
See original GitHub issueDescribe the bug I am using material-ui with react-hook-form. I am loading some data in useEffect hook and I’d like to set these to the form. Unfortunately when I do that, the label is overlapping the value (value is set to the field).
I guess I can use value
+ onChange
but I am not sure if it is the best solution (performance?).
To Reproduce Please see codesandbox link below
Codesandbox link (Required)
Expected behavior
Label is not overlapped with the field value.
Screenshots
Desktop (please complete the following information):
- OS: macOS
- Browser Chrome/Safari
- Version 83.0.4103.116/13.1.1
Issue Analytics
- State:
- Created 3 years ago
- Reactions:21
- Comments:16 (9 by maintainers)
Top Results From Across the Web
React Material UI Label Overlaps with Text
This is due to the undefined state of the value. This workaround works for me as a fallback: value= this.state.name || '';.
Read more >Label is overlapping with the selected value
Select control's label is overlapping with the selected option. ... need to be wrapped in div.md-form for them to have their material UI...
Read more >React Text Field component - Material UI
The TextField wrapper component is a complete form control including a label, input, and help text. It comes with three variants: outlined (default), ......
Read more >React Material Ui Label Overlaps With Text
Keep Material Ui Textfield Label On Top When Text Field Has No Value with the labels overlapping prefilled content Try adding classactive to...
Read more >Creating a custom form field control
This property is used to indicate whether the label should be in the floating position. We'll use the same logic as matInput and...
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
InputLabelProps={{ shrink: true }}
here you go in Safari:
https://codesandbox.io/s/react-hook-form-useform-template-czc4r?file=/src/index.js