Skip to content
Advertisement

React – Material UI Typography how to break long string to multiple lines

I’m using ReactJS and the components library called MaterialUI. I’m having an issue with the Typography component.

What happens is that if I write a long text it exceed its container and doesn’t go on a new line:

JavaScript

below an image:

enter image description here

This happens in the mobile mode and also in desktop mode.

Do you know how to fix this behavior? I would like the long words will be split on a new line if the maximum width of the container has been reached.

Advertisement

Answer

Solution

Use word-wrap, it works for Material-UI’s Typography.

JavaScript

Ref: QA: wrap long string without any blank


Demo

JavaScript

Try it online:
Edit wizardly-noether-n9435

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement