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

135
Vistas
How to override padding inherited from "@ .MuiAlert-icon"?

I need to override the padding inherited from "@ .MuiAlert-icon". The inspector from chrome shows

.MuiAlert-icon {
    display: flex;
    opacity: 0.9;
    padding: 7px 0;
    font-size: 22px;
    margin-right: 12px;
}

I'm trying to override it using the makeStyles from material UI. Here's the code i'm trying.

import Alert from "@material-ui/lab/Alert";
import Icon from "@material-ui/core/Icon";
import {  makeStyles } from "@material-ui/core";
  
const useStyles = makeStyles({
  icon: {
    overflow: 'visible',
    "& .MuiAlert-icon": {
      padding: 'none',
    }

  },
  outerTheme: {

  }
});
  
interface idVerifyProps {
    status: string; 
  }


const IDverify = ({ status }: idVerifyProps) => {
  const classes = useStyles();
  const svgIcon = (
    <Icon className={classes.icon}>
      <img alt="edit" src="../../../checkIcon.png" />
    </Icon>
  );
    return (
      <div >
        <Alert severity="error" style={{ backgroundColor: "#E6FFE9",}} icon={svgIcon}>{status}</Alert>
      </div>
    );
  };
  export default IDverify;

I don't know where the 7px padding is coming from. I'm assuming its just a default setting for whatever reason with the Icon component. I just need to set the padding to zero.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

you need to use classes={{ icon: <your_class> }}

alertIcon: {
  padding: 0,
},
return (
      <div >
         <Alert
            severity="error"
            style={{ backgroundColor: "#E6FFE9",}}
            icon={svgIcon}
            classes={{ icon: classes.alertIcon }}
         >
           {status}
         </Alert>
      </div>
    );

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