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

118
Visualizações
Override MUI component root node element with styled()

I want to use the "component" prop with a MUI component (ListItem for example) using the styled() API. My setup below causes an error saying that "component" is not a valid prop. What is the correct way to do this? I can't find any example of this in the docs. Is my only option to use the sx syntax?

const StyledListItem = styled(ListItem)`
  // some styles here
`;

const MyComponent = () => (
  <StyledListItem component="a" target="_blank" href="#"/>
);

Should I use shouldForwardProps here?

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

0

what you currently have for component is not the correct type of value. It needs to be a elementType which is actually a component and not a string.

<StyledListItem component="a" target="_blank" href="#" />

something like this...

<StyledListItem component={element} target="_blank" href="#" />
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