Here’s a recently created ticket about the issue: https://github.com/vaadin/vaadin-list-box-flow/issues/38 which also contains a workaround (extend the component and implement HasSize yourself - you won’t need to implement any methods).
Yes I am aware of the workaround, but in the aforementioned java examples I think this was done differently, because the <vaadin-list-box> element there has no style="width:100%;" attribute (which is there for me when I use the workaround, using listBox.setWidth("100%");.
So I have reason to believe that there already is a way to define width of ListBox somehow. This is what I wanted to ask. Is there a way without the workaround, and if so, how?
There’s only another workaround, which would be accessing the Style object through the Element API (listBox.getElement().getStyle()). There you can add the value "100%" to the width property using the set method.