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

97
Views
Style component according to their props when building MUI custom theme

I am building a custom MUI theme and I struggle to style the notchedOutline of a disabled <OutlinedInput />. I simply want that when the input is disabled, the border color is lighter than the default color.

Here is what I tried:

const theme = {
  mode: 'light',
  primary: {
    main: primaryBlue,
  },
  components: {
    MuiOutlinedInput: {
      styleOverrides: {
        // Ideally I could mix 'disabled' & 'notchedOutline' here
        notchedOutline: {
          borderColor: 'red' // it appear red
        },
        disabled: {
          borderColor: 'green', // but not green
        }
      }
    }
  }
}

Have you got any clues ?

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

After a lot of trial and errors I finally managed to customize border color of the disabled input!

const theme = {
  ...
  components: {
    MuiOutlinedInput: {
      styleOverrides: {
        // THE ANSWER
        root: {
          "&.Mui-disabled": {
            "& .MuiOutlinedInput-notchedOutline": {
              borderColor: 'grey' // change border color
            },
            "& .MuiInputAdornment-root p": {
              color: 'grey', // change adornment style
            },
          }
        },
      }
    }
  }
}

What confused me is that the input in itself didn't have the border. This was a sibling element <fieldset class='MuiOutlinedInput-notchedOutline'>

about 4 years ago · Juan Pablo Isaza Report

0

Try this :

'&$disabled': {
       borderColor: 'green',
      },
about 4 years ago · Juan Pablo Isaza Report

0

I think there is some problem with the disabled, Or border does not exist in disabled.

try this

MuiOutlinedInput: {
    styleOverrides: {
        root: {
            '.Mui-disabled': {
                border: '1px solid red',
            },
        },
    },
},
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!