how to set setHtmlContentAllowed(true) for MenuBar in Vaadin 14 Flow ?

I am working vaadin 14 upgrade from vaadin 8. I just want to know how to set setHtmlContentAllowed(true), addItemBefore() for MenuBar in Vaadin 14 Flow.

In Vaadin 8, i can able to do it like below,

menubar.setHtmlContentAllowed(true);//vaadin 8
menubar.addItemBefore();//VAADIN 8

Please advise / suggest the correct solution for vaadin 14.

The answer to your question depends on the context. However many new API’s in Vaadin 14 components allow to add component in addition to text in various places. In such cases you can create a new Html component instance

Tab tab = new Tab();
Html html = new Html("<span><b>A tab</b></span>");