vaadin 10 + Spring does not load custom-style.html

Hi everybody
I am using the vaadin base with spring project.
Vaadin 10 + Spring does not load custom-style.html when I navigate from a route (“login”) to route (“main-view”) that happens, however when loading only the main-view java class the styles work

@PageTitle("My Starter Project")
public class MainView extends VerticalLayout implements RouterLayout {
public MainView() {
		MyButton btnButton6=new MyButton();
        btnButton6.withCaption("Button Css buttonalerta");



<dom-module id="vaadin-button-styles" theme-for="vaadin-button">
				background-color: var(--color-rojo);
				box-shadow: 0 2px 5px 0 rgba( 0, 0, 0, 0.26);
			:host(.buttonalerta) [part="label"]
, [part="prefix"]
, [part="suffix"]
				letter-spacing: .010em;
				font-size: 12px;
				font-weight: bold;
				text-transform: uppercase;
				color: var(--color-blanco);

My Login

@PageTitle("My Starter Project")
public class LoginScreen extends FlexLayout {

    private TextField username;
    private PasswordField password;
    private Button login;
    private Button forgotPassword;

    public LoginScreen() {
	private void login() {



This is because @HtmlImport("frontend://styles/styles-combobox.html") is not imported for Login as it is only defined for MainLayout. If Login had @Route(value="login", layout=MainLayout.class) then the style would be imported for login also.

Your choices would thus be to add the styles import to Login or to have MainLayout only contain common things and have everything use it as a layout to get the same settings.

  • Mikael

Mikael Grankvist, Thank you. Works very well