2

I have 3 text fields in vertical layout and I want to place a button at the right of the 3rd text field in HorizontalLayout, but what happens is the button is placed in alignment with a caption of the text field. How I solved this issue in Vaadin 8?

2 Answers2

1

Assuming you want the button to align with the box of the TextField (rather than the caption of the field), and the two components are in the same Horizontal Layout, you can use the following:

buttonName.getElement().getStyle().set("margin-top", "auto");
schaphekar
  • 495
  • 1
  • 5
  • 18
0

You can use com.vaadin.ui.Alignment for basic alignment needs within ordered layouts. For example:

horizontalLayout.setComponentAlignment(button, Alignment.BOTTOM_LEFT);

The default alignment is TOP_LEFT.

Anna Koskinen
  • 1,362
  • 3
  • 22