com.vaadin.flow.theme.

Annotation Type Theme


  • @Target(value=TYPE)
     @Retention(value=RUNTIME)
     @Inherited
     @Documented
    public @interface Theme

    Defines that there is a theme to use and defines the theme handler implementation.

    The theme allows to define a way to translate base component url to the themed component url (@see AbstractTheme), which specifies components styles.

    By default com.vaadin.flow.theme.lumo.Lumo theme is used if it's in the classpath. You may disable theming with NoTheme annotation.

    Theme annotation should be added to your root navigation level, RouterLayout or to the top level @Route.

    Defining different Themes for different views will end throwing an exception.

    Here are examples:

    • On the navigation root
       
       @Route(value = "")
       @Theme(Lumo.class)
       public class Main extends Div {
       }
       
       
    • on the top level router layout
       
       @Theme(MyTheme.class)
       public class MainLayout extends Div implements RouterLayout {
       }
      
       @Route(value = "editor", layout = MainLayout.class)
       public class Editor extends Div {
       }
       
       

    Since:

    1.0

    Author:

    Vaadin Ltd

    See Also:

    AbstractTheme, NoTheme, RouterLayout, Route

    • Required Element Summary

      Required Elements
      Modifier and Type Required Element and Description
      Class<? extends AbstractTheme> value

      The theme translation handler.

    • Optional Element Summary

      Optional Elements
      Modifier and Type Optional Element and Description
      String variant

      The theme variant, if any.

    • Element Detail

      • value

        public abstract Class<? extends AbstractTheme> value

        The theme translation handler.

        Returns:

        theme handler

      • variant

        public abstract String variant

        The theme variant, if any.

        Returns:

        the theme variant

        Default:

        ""