Skip to content
Advertisement

Line break in a CardHeader element subtitle (MaterialUI / ReactJS)

I’m using pretty old Material UI (Ver. 0.20.1) components.

Here’s a chunk of my code:

JavaScript

So i have a subtitle string with a bunch of variables in it that i wanted to use a line break to separate visually but adding n or even '...string' + <br/> + 'string...' doesn’t work. What should i do?

Advertisement

Answer

I can’t test in a sandBox but if we look in the version 0.20.1 documentation of Material-ui we can read that:

property: subtitle type: node Can be used to render a subtitle in Card Header.

so you can create a node for example a list:

JavaScript

and pass it to subtitle like this:

JavaScript

UPDATE:
I found a codeSanbox template so here a working example

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