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

269
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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