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

272
Views
React MUI: Overriding color only for specific component

I have tried for a while to override the style of a component, but only for one specific color and/or variant combination. I can't find a way to do that. Take as example the following alert:

<Alert severity="success" variant="outlined">Hello!</Alert>

I want to override the text color in the alert only for the outlined/success combination. I tried with this theme overrides and it doesn't work:

const theme = createMuiTheme({
    components: {
        MuiAlert: {
            styleOverrides: {
                outlined: {
                    severity: {
                        error: {
                            color: "#ffffff",
                        }
                    }
                }
            }
        }
    }
})

What is wrong with this approach?

I could get what I need by adding a colored span as the alert content or I could do the same with a css class but I feel these are workarounds and not proper solutions, and it will remove any benefit of a centralized theme provider.

about 4 years ago · Santiago Trujillo
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!