Gary Greenberg
Gary Greenberg

Reputation: 576

How to wrap a label to the textfield in Vaadin

In my Vaadin application I have a short integer field with a long label.

TextField pubYear = new TextField("Publishing Year);
pubYear.setWidth("60px");

I do need to keep this size of the field to fit into the form, but label is cut to "Publ...". Can I do something to wrap the label text. I have plenty of vertical room, but horizontal space is very limited.

Upvotes: 1

Views: 392

Answers (1)

Tatu Lund
Tatu Lund

Reputation: 10623

In Vaadin 23 the label element is in light DOM, so you can use regular global CSS like

vaadin-text-field > label {
  overflow-wrap: break-word;
  white-space: break-spaces;
}

Upvotes: 2

Related Questions