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

268
Visualizações
Material UI - Text goes outside the Container/Box?

I have an Alert where it displays long strings. Here is my code:

<Container maxWidth="md">    
<Box sx={{ mt: 3, border:1}}>
    <Box>
        {hasSubmitted ?
            <div>
                <Alert sx={{mt:3}} severity="success">
                {receivedData}
                </Alert>
            </div>
        : null}
    </Box>
</Box>
</Container>

However it then shows up like this: Text goes out

Very new to Material UI. How can I fix this? Thank you!

Update

I used this instead:

<Typography
     variant="body2"
     align="center"
     style={{ wordWrap: "break-word"}}
     sx={{mt:3}}
>
      {receivedData}
</Typography>

It works but it's not an Alert now. I think the problem is on the Alert component. Still if anyone has any solutions, I'm still open for them. Thank you!

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

try using the break word css property. Read more here

<Container maxWidth="md">    
<Box sx={{ mt: 3, border:1}}>
    <Box style={{width:'100%}}>
        {hasSubmitted ?
            <div style={{width:'100%}}>
                <Alert sx={{mt:3}} severity="success" style={{wordWrap:'break-word', width:'100%}}>
                {receivedData}
                </Alert>
            </div>
        : null}
    </Box>
</Box>
</Container>
about 4 years ago · Juan Pablo Isaza Relatório

0

It's not recommended to use style prop, in order to customize the component Alert use global class name or styleOverrides property, in your example I used global class name:

.MuiAlert-message {
 min-width: 0;
 word-wrap: break-word;
}

Check this: https://mui.com/api/alert/#css

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