Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular 2 material matTooltip multiline

I'm new to Angular 2 Material. What's the preferred way to make a tool tip multi-line?

For example, I might have the following tool tip:

AA BBBBBBBBBB CCCC DDDDD 

And, I may want to to have it display in a multi-line format like this:

AA BBBBBBBBBB  CCCC  DDDDD 
like image 359
Jonas Avatar asked Nov 01 '17 15:11

Jonas


1 Answers

First, create a class for your tooltip, to make it break lines on line breaks.

.my-tooltip {     white-space: pre-line; } 

Then, add the class to your tooltip and insert line breaks with the Unicode code 

<span      matTooltip="First line&#13;Second line"     matTooltipClass="my-tooltip"> </span> 
like image 137
Rodris Avatar answered Sep 21 '22 06:09

Rodris