Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Padding inside Panel Component
Hello,
The components inside panel are getting a margin of 26px around them. I am not changing any default styles for these components. Not able to find where it is coming from.
Is there a way to change them easily for Panel?
Found the solution.
// Adjust the panels default layout (a VerticalLayout)
VerticalLayout layout = (VerticalLayout) mypanel.getContent();
layout.setMargin(false); // we don't want a margin
layout.setSpacing(false); // and no spacing between components
As you found out, Vaadin Panels and Windows contain a VerticalLayout by default inside them, and that layout has margins enabled.
Spacing is not enabled by default, so you should need to disable that, though.
Thanks Jouni. That is helpful. Got the code sampler demos.