I am using this code:

com.vaadin.flow.component.Html text = new com.vaadin.flow.component.Html("<span><b>TEST</b></span>");

It is working.

Now I am using this code:

com.vaadin.flow.component.Html text = new com.vaadin.flow.component.Html("<span><ul><li>TEST</li></ul></span>");

An my error is:

java.lang.IllegalArgumentException: HTML must contain exactly one top level element

What I have to do to show my html code correctly. Is com.vaadin.flow.component.Html the wrong component?

I am using Vaadin 14.1.2.

Thank you very much,

Found same problem on Vaadin 14.1.17
Anybody here can tell us if this is a simple Html Vaadin Component limit or maybe a bug to be fixed ?
Thanks in advance. Any hint will be appreciated.

I have no problem with these examples. Vaadin 14.1.17, new created project.

In my case I was filling the HTML Component with a string obtained from a simple HTML file containing the Head section. Fixed after removing the Head section.
Here attached a simple test file.
18110527.html (4.44 KB)