I want to have a layout where I put some buttons at the right side of a HorizontalLayout. The only way to achieve something like that, is to use “margin-left = auto” (as proposed here https://vaadin.com/forum/thread/17198105/button-alignment-in-horizontal-layout). Is there no other way to do this in a more Java way, like it was previously in vaadin8? If not, is such a feature planned?
I would also be very interested in that feature.
Currently, one can align items vertically in a HorizontalLayout, and align items horizontally in a VerticalLayout.
However I have more use-cases where I want to align horizontally in a HorizontalLayout, instead of align vertically. Especially since this was possible in Vaadin 8, migrating developers will look for a similar layouting to their Vaadin 8 counterpart.
IMO we need to be able to align both axes in both Horizontal- and VerticalLayout.
You can use the Justify Content feature to do this (set it to ‘end’), as shown in an example [here]
(https://vaadin.com/components/vaadin-ordered-layout/java-examples). These layouts are based on flexbox which has a ton of customization options; but I agree that the Java API is not the most transparent though. You can find a handy reference on flexbox [here]
(https://css-tricks.com/snippets/css/a-guide-to-flexbox/). All of those features should work with Horizontal and VerticalLayout. Hope this helps
The Justify Content is indeed really helpful in this case. Thank you for the flexbox reference link, it has great visualizations of the different justify-content modes.
However, it looks like the three modes BETWEEN, AROUND, EVENLY do not do what was “promised” by the css-tricks page. If those worked, I think the Justify Content feature would be very sufficient for my needs.
Edit: This has apparently already been reported in a [github issue]
(https://github.com/vaadin/vaadin-ordered-layout/issues/66), but can’t be fixed until Support for IE 9 is dropped.
A workaround is also mentioned in the issue: set spacing of the justified layout to false