How to wrap a label to the textfield in Vaadin

260 Views Asked by At

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.

1

There are 1 best solutions below

0
On BEST ANSWER

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;
}