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

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