There's no more MIDDLE_CENTER alignment in Vaadin 14?

I wanted to align my components at center of the screen.
But there’s only Alignment.CENTER, not the Alignment.MIDDLE_CENTER which was available in Vaadin 7~8.
Is there any method that I can do center alignment without css?

You can align only in one direction (horizontally for VerticalLayout, and vertically for HorizontalLayout) with setAlignItems(Alignment.CENTER);, but you can do the other direction with setJustifyContentMode(JustifyContentMode.CENTER);

Thank you but I think it doesn’t work.
I used Vertical Layout and used setAlignItems(Alignment.CENTER);.
So, it is Middle_Top of the layout.
And I added setJustifyContentMode(JustifyContentMode.CENTER);.
But it is still at the Middle_Top of the layout.
Is there any other method to do this? Or should I just add margin?

This might be a little late, but did you set the vertical layout height to full? Remember vertical layout default is to shrink-wrap height. :slight_smile:

I have the same problem and I have set the height to full:( Do you happen to know any solution.

This works for me:

/**
 * The main view contains a centered button.
 */
@Route
@PWA(name = "My Application", shortName = "My Application")
public class MainView extends VerticalLayout {
    public MainView() {
        Button button = new Button("A Button");
        add(button);
        setHeightFull();
        setAlignItems(Alignment.CENTER);//puts button in horizontal  center
        setJustifyContentMode(JustifyContentMode.CENTER);//puts button in vertical center
    }
}