[Textfield] Border lines of Textfield cross over the text label shrinked by MuiInputLabel
See original GitHub issue- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
Borders of Textfield component cross over the shrinked text label.
Expected Behavior 🤔
Border lines overlapping with the shrinked text label are hidden.
Steps to Reproduce 🕹
https://codesandbox.io/s/elegant-leakey-zsflw?file=/src/App.tsx
source code
import {
createTheme,
Stack,
TextField,
ThemeProvider
} from "@material-ui/core";
import React from "react";
const theme = createTheme({
components: {
MuiInputLabel: {
defaultProps: { shrink: true }
}
}
});
function App() {
return (
<ThemeProvider theme={theme}>
<Stack sx={{ m: 5 }} spacing={2}>
{/*NG*/}
<TextField label="Abcdefghi" />
{/*OK*/}
<TextField label="Abcdefghi" InputLabelProps={{ shrink: true }} />
</Stack>
</ThemeProvider>
);
}
export default App;
Steps:
shrink: true
is specified intheme
.InputLabelProps = {{shrink: true}}
is not specified inTextField
.
Context 🔦
Your Environment 🌎
`npx @material-ui/envinfo`
my browser: Google Chrome 90.0.4430.212(Official Build)(x86_64)
my pc: macOS Big Sur ver 11.2.2
npx @material-ui/envinfo
System:
OS: Linux 5.4 Debian GNU/Linux 10 (buster) 10 (buster)
Binaries:
Node: 14.17.0 - /usr/local/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 6.14.13 - /usr/local/bin/npm
Browsers:
Chrome: Not Found
Firefox: Not Found
npmPackages:
@emotion/react: ^11.4.0 => 11.4.0
@emotion/styled: ^11.3.0 => 11.3.0
@material-ui/core: ^5.0.0-alpha.35 => 5.0.0-alpha.35
@material-ui/icons: ^5.0.0-alpha.35 => 5.0.0-alpha.35
@material-ui/private-theming: 5.0.0-alpha.35
@material-ui/styled-engine: 5.0.0-alpha.34
@material-ui/system: 5.0.0-alpha.35
@material-ui/types: 6.0.1
@material-ui/unstyled: 5.0.0-alpha.35
@material-ui/utils: 5.0.0-alpha.35
@types/react: ^17.0.8 => 17.0.9
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
typescript: ^4.1.2 => 4.3.2
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top Results From Across the Web
[Textfield] Border lines of Textfield cross over the text label ...
Borders of Textfield component cross over the shrinked text label. ... Border lines overlapping with the shrinked text label are hidden.
Read more >material ui textField border doesn't show completely
To remove label of text field you can achieve this by two way. Solution 1. - Just add InputLabelProps={{shrink: false}} property to ...
Read more >InputLabel API - Material UI - MUI
if true , the label will indicate that the input is required. shrink, bool, false. If true , the label is shrunk.
Read more >Text fields - Material Design
Place label text within the boundary of a text field box; Ensure text field outlines or strokes meet 3:1 minimum color contrast ratio...
Read more >Mui outlined input border color. Props ... - Thought Sprinklers
The text field calls the onChanged callback whenever the user changes the text in ... the border The label value in outlined overlaps...
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
There is a bug;
If I run my app with no theme overrides, text fields look like this
If I put the following into my theme setup;
It looks like this;
Something, somewhere is not taking into account of the overridden font sizes.
Pretty sure this is a general problem when we reach into
*Props
but ignore theme default props.