Skip to content
Advertisement

Vaadin 14 – Cannot get a Details/AccordionPanel to use window width

Unlike many other Vaadin “container” components, the com.vaadin.flow.component.details.Details and com.vaadin.flow.component.accordion.AccordionPanel classes do not allow for setSizeFull() (I have tried both). I’m trying to figure out how to have one of these on a form and have it expand horizontally across the parent view. Instead, it’s showing a narrow view that is not very useful. It has some reasonable vertical size. I need to know how to control the size of this component.

Here is the form class:

JavaScript

I tried different variations, where I inserted a VerticalLayout (that has setSizeFull()) into the mix, such that I returned a Details -> VerticalLayout -> Grid, but that changed nothing.

Advertisement

Answer

Apparently Details and Accordion don’t implement HasSize, so they don’t have the required methods.

You can use the lower level element API to set the width and height as a workaround:

JavaScript

Another option is to use Alignment.STRETCH.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement