[TextField] Problems with changing the input label fontSize
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
I tried to change the fontsize of the lable using
const theme = createTheme({
components: {
MuiInputLabel: {
defaultProps: {
sx: {
fontSize: "13px",
},
},
},
},
});
Achieved

But On focusing the fontsize appears too small which make a empty space on the right (Look into pic below)

Please let me know how can I get Rid of it.
Or I can change the Font size only when the input is not focused.
What I wanted it to look like is
(Small font size when Field is empty)
and
(Normal font size when Field is Filled)
Originally posted by @iamadityaaz in https://github.com/mui/material-ui/issues/13840#issuecomment-1046002798
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the MuiInputLabel defaultProps and sx configuration shown in the issue, then inspect the TextField label behavior in its focused and filled states. Done means the label has the requested font size in each state without the unwanted empty space shown in the screenshots.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100