Skip to content

[TextField] When changing font size, the text is not aligned.Β #19952

@OriginLive

Description

@OriginLive
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Similiar Issues:

#8017

Current Behavior 😯

When overriding font size, the text does not align correctly.

Expected Behavior πŸ€”

Text should be in the center, there should be a prop accepting font size. Currently, it's using transformation to move the label upwards on click. The coordinates do not account for different font size.

Steps to Reproduce πŸ•Ή

Here's my following code:

const theme = createMuiTheme({
  typography: {
    fontFamily: 'Averta',
    fontWeightRegular: 500,
  },
 overrides: {
    MuiTextField: {
      root: {
        fontSize: '20px'
      },
    },
    MuiInputLabel: {
      shrink: {
        fontSize: '20px',
      },
      root: {
        fontSize: '20px',
      },
}
});

an example of such text field would look like:
image

As you can see, the text isn't aligned, it's meant to be aligned at 12px. To exaggerate the problem, look at the following:

image

It's even more obvious with larger fonts.

Context πŸ”¦

I'm trying to change the height of the textfield component so that it matches our figma height and it's font-size (56px in height) and 20px font size. I assume it's also a problem to align with just using inputbase and outlined input.

Your Environment 🌎

Tech Version
Material-UI v4.9.5
React 16.13.0
Browser chrome-latest
TypeScript 3.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: text fieldChanges related to the text field.support: questionCommunity support but can be turned into an improvement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions