I don’t have any custom styling for VerticalLayout (At least for it’s color).
However, I will still show my changes related to @Theme, just in case they are causing the issue.
Previously, when I was using Vaadin 14, I could apply @Theme directly on MainView.java.
My theme folder was myapp, and all CSS files were inside that folder:
C:\Users\xxx\eclipse-workspace\projectA\frontend\themes\myapp
Example (Vaadin 14):
@Route("")
@Theme(themeFolder = "myapp")
@CssImport(value = "./themes/myapp/grid-style.css", themeFor = "vaadin-grid")
@CssImport(value = "./themes/myapp/vaadin-select-style.css", themeFor = "vaadin-text-field vaadin-text-area vaadin-integer-field vaadin-select multiselect-combo-box multiselect-combo-box-input vaadin-list-box")
@CssImport(value = "./themes/myapp/combo-box-item-style.css", themeFor = "vaadin-combo-box-item vaadin-combo-box-overlay")
@CssImport(value = "./themes/myapp/notification-card.css", themeFor = "vaadin-notification-card")
@CssImport(value = "./themes/myapp/upload-style.css", themeFor = "vaadin-upload vaadin-upload-file")
@CssImport(value = "./themes/myapp/vaadin-text-area.css", themeFor = "vaadin-text-area")
@PageTitle("Main")
public class MainView extends AppLayout {
}
In Vaadin 24, I believe @Theme must be moved to an AppShell configurator class.
Here is my current code:
@Theme(value = "myapp")
@CssImport(value = "./themes/myapp/grid-style.css", themeFor = "vaadin-grid")
@CssImport(value = "./themes/myapp/vaadin-select-style.css", themeFor = "vaadin-text-field vaadin-text-area vaadin-integer-field vaadin-select multiselect-combo-box multiselect-combo-box-input vaadin-list-box")
@CssImport(value = "./themes/myapp/combo-box-item-style.css", themeFor = "vaadin-combo-box-item vaadin-combo-box-overlay")
@CssImport(value = "./themes/myapp/notification-card.css", themeFor = "vaadin-notification-card")
@CssImport(value = "./themes/myapp/upload-style.css", themeFor = "vaadin-upload vaadin-upload-file")
@CssImport(value = "./themes/myapp/vaadin-text-area.css", themeFor = "vaadin-text-area")
public class AppShellConfig implements AppShellConfigurator {
}
Here is how I create the VerticalLayout:
VerticalLayout layout = new VerticalLayout();
layout.setClassName("sidemenu-menu");
layout.setSizeFull();
layout.setPadding(false);
layout.setSpacing(false);
layout.getThemeList().set("spacing-s", true);
layout.setAlignItems(FlexComponent.Alignment.STRETCH);

the css for sidemenu-menu:
.sidemenu-header {
height: var(--lumo-size-xl);
box-shadow: var(--lumo-box-shadow-s);
}
.sidemenu-header h1 {
font-size: var(--lumo-font-size-l);
margin: 0;
}
.sidemenu-menu #logo {
box-sizing: border-box;
box-shadow: inset 0 -1px var(--lumo-contrast-10pct);
padding: var(--lumo-space-s) var(--lumo-space-m);
}
Previously, the background was white when I defined a VerticalLayout.
Old color:

new Color: (The grey on the left is Vertical Overlay)

Why is it showing a grey background now in Vaadin 24?



