adding link/url within label in Vaadin 13.0.8

I have a need to show some text upon selecting a value in the select field and I am able to do that using a label. Now I am required to add a link to the label along with text based on my selection of value in the select field. I tried setting the property of label to innerHTML and that helped with showing the text and the link the first time the value is selected. However upon changing the value in the select field and selecting back the previous value, there is no value shown in the label.

Select field has values one, two and three
upon selecting one, the text should display as
“click [here]
( to see details for one”. where the word here should be a link pointing to some URL. Right now I am using Label to show the text “click [here]
( to see details for one”. This text will change based on the selection in the select field. Is lable the best option to show the static text with a link? If yes how can this be accomplished to always show when “one” is selected. If not, what is the best way to accomplish this.

Hi Antony,

Labels should be used to represent an item’s caption. In your case I would use a paragraph, something like this:

Anchor anchor = new Anchor("", "here");
Text value = new Text("");
Paragraph paragraph = new Paragraph(new Text("Click "), anchor, new Text(" to see details about "), value);

Select select = new Select<>();
select.setItems("One", "Two", "Three");
select.addValueChangeListener(e -> {
  anchor.setHref(select.getValue().toString() + ".com");

Thank you Joacim for the response. Really appreciate it. I will surely change label to paragraph.