Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

136
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda