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

115
Views
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 answers
Answer question

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