Annotation Interface Theme


Defines the theme to use for the application. Should be present only once for an app, in the `AppShellConfiguration` class.

The value property defines the name of the application theme. When the theme is present inside the project, it maps to the frontend/themes/&#60application-theme-name&#62/ folder or alternatively to a folder inside the static resources of a jar file, like src/main/resources/META-INF/resources/themes/&#60application-theme-name&#62/ . The application theme is always based on Lumo theme and this is the recommended way to theme applications starting from Flow 6.0 and Vaadin 19.

Alternatively , if instead of Lumo theme the Material theme or another "old style custom theme" is to be used, that can be specified with the themeClass property. This allows defining 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 the AppShellConfigurator implementation.

Only a single theme can be defined and having multiple instances will throw an exception.

Here is some examples:

 

 @Theme("my-theme")
 public class MyAppShell implements AppShellConfigurator {
 }
 
 
 

 @Theme(themeClass = Lumo.class)
 public class MyAppShell implements AppShellConfigurator {
 }
 
 
Since:
1.0
Author:
Vaadin Ltd
See Also:
  • Element Details

    • themeClass

      Class<? extends AbstractTheme> themeClass
      The theme translation handler. Defaults to Lumo, If not specified.
      Returns:
      theme handler
      Default:
      com.vaadin.flow.theme.AbstractTheme.class
    • variant

      String variant
      The theme variant, if any.
      Returns:
      the theme variant
      Default:
      ""
    • value

      String value
      The name of the theme to use. If this is not specified will default to Lumo.
      Default:
      ""