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

137
Visualizações
How to prevent override of defaultProps in MUI customTheme, unless explicity mentioned

I made a custom theme in Material-UI, overriding the defaultProps for the Textfield Component:

const customTheme = createTheme({
  components: {
    MuiTextField: {
      defaultProps: {
        InputProps: {
          notched: false,
        },
      },
    }
  }

When I try to use the component in my project, it works as expected, with the default prop being set to notched:false:

  <TextField label="Enter Something" />

However, when I try to mention some other prop on the InputProps prop, it overrides the notched prop, to the factory default:

  <TextField label="Enter Something" InputProps={{ readOnly:true }} /> // component behaves like I never set the defaultProps on the customTheme

How can I prevent it from overriding my custom theme, unless i explicitly set that prop on the component instance?

  <TextField label="Enter Something" InputProps={{ readOnly:true, notched:true }} />
about 4 years ago · Juan Pablo Isaza
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