Search code examples
cssspringvaadinvaadin7vaadin-spring-boot

Use multiple themes in spring boot vaadin application


By default we can apply styling to vaadin spring boot applications by annotating UI class with@Theme(themename). In my particular situation i annotated with @Theme(ValoTheme.THEME_NAME) ,but it's not over. Unfortunately, i didn't figured out how to set background for layout without dealing with css and extra files(And it seems the only solution unavoidable).

How to use both themes valotheme and custom (just for setting up background image) at the same time?

Many thanks for suggestions


Solution

  • You can extend a Vaadin theme in your own custom theme. If you extend the Valo theme in your theme, then you get Valo theme plus your own customization and additions:

    @import "../valo/valo.scss";
    
    @mixin mytheme {
      @include valo;
    
      // your own scss here
    }