Label that looks like "required"


Been working quite a while with Vaadin, but now i’m stuck at this.

I want a label that looks like a textfield that is required… under the label i have a link_button, and over the link_button i want a label that has a “red star” at the end of the line…


	Label labelLanguage = new Label("Language *" ); 

But i want the Label to read “Language *”

Just like when you make a TextField required :slight_smile:

Any way to do this? :slight_smile:

Grateful for any replies!

So the problem is just coloring the asterisk red? Perhaps something like:

new Label("Language <span style='color: red'>*</span>", Label.CONTENT_XHTML)

Well, a more proper way is to say:

<span class="v-required-field-indicator">*</span>

This is copied verbatim from the HTML tree of a required field, so it reuses the style setting for required indicators from the theme.

Nice thanks!

You’re king! :slight_smile: