[TextField] Long labels break layout
See original GitHub issueThe textfield layout is not responsive when there are long labels.
- This is a v1.3.1 issue.
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
According to Material Design, long labels should be correctly positioned within the available input space:
Current Behavior
- Two or more line labels are overlapping the underline line.
Steps to Reproduce
https://codesandbox.io/s/6xjr79vx3w
import React from 'react';
import TextField from '@material-ui/core/TextField';
class TextFields extends React.Component {
render() {
return (
<form noValidate autoComplete="off">
<TextField
id="name"
label="This is a long label because things"
/>
</form>
);
}
}
export default TextFields;
Context
- All content is usually content managed, which means that the content editors could enter in label that may break the layout.
- If the enter in a label that is longer than the available space, example: “Do you have any association with a government entity?”, and the user is loading the page in an iPhone 5, there is no enough space to render the label in only one line.
Your Environment
Tech | Version |
---|---|
Material-UI | v1.3.1 |
React | v16.4.1 |
browser | Chrome |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:40 (22 by maintainers)
Top Results From Across the Web
[TextField] Long labels break layout #12255 - mui/material-ui
The textfield layout is not responsive when there are long labels. This is a v1.3.1 issue. I have searched the issues of this...
Read more >long label of \textfield with a break? - LaTeX Stack Exchange
As you can see the foobar text doesn't align on the left side, but instead goes under the textfield. I tried to use...
Read more >Input field with label in semantic-ui breaks layout
I played around a bit and found a work-around that uses right (or left) aligned icons instead of labels. Hope this helps.
Read more >C38: Using CSS width, max-width and flexbox to fit labels and ...
This technique ensures labels and inputs do not break out of their layout area, including in one-column layouts where it would cause horizontal...
Read more >Long label ends with ellipsis instead of breaking
Expected behavior. Long labels should break to 2 lines instead of ending with an ellipsis as it was recently. Actual behavior. Label text...
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 FreeTop 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
Top GitHub Comments
I found a workaround to trim label with ellipsis
and in my component
result looks like this:
@csantos1113 @oliviertassinari From specs: Labels should be short in other case use helper text instead