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

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

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 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