Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

355
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!