Is it possible to draw HTML contents in Vaadin 14 flow Label?

Viewed 429

Is it possible to draw HTML contents in Vaadin 14 flow Label? I know, it is available in Vaadin 7 package like below:

Label label = new Label("<br>title", ContentMode.HTML);

I have texts with <br> contents. Is there any alternative available to let the label to use them in Vaadin 14 flow?

1 Answers

It is possible. Example code:

Label label = new Label();
label.add(new Html("<b>bold text</b>"));

Make sure that you actually need a Label instead of Span or Div. The HTML tag <label> is intended as label for input fields, see here.

Related