Documentation versions (currently viewingVaadin 24)

Using a Theme in Multiple Applications

Steps and examples for using a theme in multiple applications.

An application theme can be used in multiple applications by packaging it as a JAR dependency as shown in the following steps.

First, create a new Maven project with the following structure and add your theme files to the theme folder (1):

[project root]
├── src
│   └── main
│       └── resources
│           └── META-INF
│               └── resources
│                   └── themes
│                       └── my-theme  (1)
└── pom.xml

Second, update pom.xml as follows:

  • Configure the theme library’s identifiers and packaging format.

  • Configure the Vaadin platform version.

  • Add dependency management.

  • Update dependencies to only contain the com.vaadin.vaadin.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=""

    <!-- Identifiers --> (1)

        <vaadin.version>24.3.12</vaadin.version> (2)

    <dependencyManagement> (3)

    <dependencies> (4)


Third, if the theme uses npm assets, add a class (1) with the corresponding @NpmPackage annotations:

[project root]
└── src
    └── main
        └── java
            └── com
                └── vaadin
                    └── flow
                        └── theme
                            └──  (1)
Dependency Class Package

The package in which the java class is placed doesn’t have to be com.vaadin.flow.theme package as in the example above, but it’s recommended for themes that are going to be used in Vaadin Spring Boot applications, as it’s always automatically scanned.

Other recommended packages are com.vaadin.flow.component and com.vaadin.shrinkwrap. See Vaadin’s Spring package scanning documentation for using other custom packages.

Last, create the JAR file by running the command mvn install in the project root folder. The file is generated in the target sub-folder.

To use the packaged theme in an application, add the JAR as a dependency in the application project’s pom.xml, and apply the theme either using the @Theme annotation, or in theme.json as a parent-theme to the application’s own theme.