Reputation: 121
What i'm trying to do is really simple: render html tag in TextField
or TextArea
.
But after googling for a long time i'm surprised to find out that Vaadin seems not to support it.Vaadin ComboBox
or ListBox
provides .setRender()
method to render content in whatever the way i want. But TextField
or TextArea
do not have functions like that.I wonder is there any way to do this?
Vaadin TextField
supports custom theme , but it didn't work when rendering.
textArea.addThemeVariants(TextAreaVariant.MATERIAL_ALWAYS_FLOAT_LABEL);
Upvotes: 2
Views: 2707
Reputation: 10643
TextField and TextArea are fields to edit plain text.
If you want to display html content, there is Html component in Flow to do that.
If you want to edit html content there is separate RichTextEditor for doing that.
Also if you allow user to input the html, remember to sanitize the html before displaying it with e.g. Jsoup in order to avoid xss i.e. JavaScript injection issues.
Upvotes: 1