Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

100
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

0

Try this :

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

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda