minWidth in HorizontalLayout / VerticalLayout

I am using vaadin 8.
How can i set without css the minWidth of a Horizontal- / VerticalLayout.

For example, something like this

public class AccountView extends HorizontalLayout implements View {

Unfortunately you can’t. See https://github.com/vaadin/framework/issues/1360

There is a plugin for Vaadin 7 that adds that functionality though (https://github.com/jouni/restrain source: https://github.com/jouni/restrain). Maybe you can adapt that for Vaadin 8.


Well, depending on whether you see this as CSS or Java you can do something like
UI.getCurrent().getPage().getStyles().add(“.min125px{min-width: 125px !important;}”);

and then add that to your components button.addStyleName(“min125px”);

(from https://stackoverflow.com/questions/30977967/how-can-i-set-min-width-size-for-my-sub-window-in-vaadin)