Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

356
Visualizações
Remove inner padding border in Material UI Outlined Text Field

I am using Material UI v5 Outlined TextField component to create a form. As shown in the picture below there is a white padding border coming in the TextField. I have made CSS that input field color changes to yellow on focus.

My code is as follows

// CSS
.OutlinedTextFieldCSSStyle {
    font-size: 13px !important;
    padding: 0 !important;
}

// Material-Ui styles
export const useStyles = makeStyles({
    OutlinedTextField: {
        "& .MuiOutlinedInput-root": {
            "& fieldset": {
                borderColor: "#949595",       // grey color
                borderWidth: 1.5,
            },
            "&:hover fieldset": {
                borderColor: "#949595",       // grey color
            },
            "&.Mui-focused fieldset": {
                outline: "none",
                borderColor: "#949595",       // grey color
                boxShadow: "0 5px 5px 0px #949595",
            },
        },

        "& .Mui-focused": {
            "& .MuiOutlinedInput-input": {
                backgroundColor: "#FFFF80 !important",       // yellow color
                borderColor: "#FFFF80 !important",           // yellow color
                borderWidth: 0,
                outline: "none",
            },
        },
        "& .MuiOutlinedInput-input": {
            backgroundColor: "#F5F5F5 !important",
            borderWidth: 0,
            outline: "none",
            borderColor: "white !important",
        },
    }
});

// TextField
<TextField
    {...params}
    type="text"
    size="large"
    variant="outlined"
    fullWidth
    className={classes.OutlinedTextField}
    InputProps={{
        ...params.InputProps,
        classes: {
            input: "OutlinedTextFieldCSSStyle",
        },
    }}
/>


enter image description here

How can I remove this white padding border so that the textfield entire background color is yellow/grey and the font size covers the entire textbox ?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can add your padding: 0 into your .MuiOutlinedInput-input style definitions:

export const useStyles = makeStyles({
  OutlinedTextField: {
    // ... your other styles
    "& .MuiOutlinedInput-input": {
      backgroundColor: "#F5F5F5 !important",
      borderWidth: 0,
      outline: "none",
      borderColor: "white !important",
      padding: 0 // <-- added zero padding instruction
    }
  }
});
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda