I’m trying to render two large blobs of text side by side, each of which may or may not include new lines or any whitespace. I’m attempting to use a Material UI Grid
however the grids are not behaving the way I would expect.
I have created a small example here showing my issue https://codesandbox.io/s/react-mui-forked-rzzk26?file=/index.js
Based on the background color of the boxes added to the grid, the grid itself is working correctly however the text is overflowing
How can I cause the long text in the blue box to wrap to a new line and never overflow outside its parents bounds?
Thanks
2
Answers
EDIT: After a bt of debugging, I determined the culperate was this
Box
that was wrapping all other components in my application:Adding
overflow: "hidden"
to this components style resolved my issuesThis answer How to wrap text without spaces in React? got me to a working example. Its still not working in my main project but at least I've narrowed it down to something external to the grid causing issues.
You can use flexWrap: "wrap" with specific width. If it is not working then provide a code.