Annotation Interface Theme


Deprecated.
As of Vaadin 25, this annotation is deprecated. The theming system has been reworked to use StyleSheet to load one or more stylesheets from public static resources locations or CssImport to load one or more stylesheets from a src/main/frontend/ folder and use mechanisms native to HTML, CSS and React (e.g. @import url("morestyles.css") in CSS).
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:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<? extends AbstractTheme>
    Deprecated.
    The theme translation handler.
    Deprecated.
    The name of the theme to use.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use ColorScheme annotation instead
  • Element Details

    • themeClass

      Class<? extends AbstractTheme> themeClass
      Deprecated.
      The theme translation handler.
      Returns:
      theme handler
      Default:
      com.vaadin.flow.theme.AbstractTheme.class
    • variant

      @Deprecated(since="25.0", forRemoval=true) String variant
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use ColorScheme annotation instead
      The theme variant, if any.

      Deprecated: Use ColorScheme annotation instead to set the color scheme for the application.

      Returns:
      the theme variant
      Default:
      ""
    • value

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