Documentation versions (currently viewingVaadin 23)

You are viewing documentation for Vaadin 23. View latest documentation

Custom Widget Set and MPR

By default there is no need for a custom widget set as MPR functions by using the AppWidgetset that’s automatically built and configured by scanning the dependencies. For more information on the AppWidgetset and widget set compilation see Add-ons and Widget Set part of application environment.

When using MPR you can’t use Content Delivery Network (CDN) for the widget set. This means that the configuration <vaadin.widgetset.mode>cdn</vaadin.widgetset.mode> should be removed.

To use a custom widget set for the legacy framework embedded with MPR, add MprWidgetset annotation to your AppShellConfigurator configuration class.

public class Configuration implements AppShellConfigurator {

public class MainLayout extends Div implements RouterLayout {

@Route(value = "", layout = MainLayout.class)
public class RootTarget extends Div {
    public RootTarget() {
      LegacyWrapper addressbookWrapper = new LegacyWrapper(
                  new AddressbookLayout());

The AppWidgetset contains widget sets things found by scanning the dependencies, but at times you might only want to have specific widget sets included or you have the need for an optimized widget set with eager and lazy parts.

The widget set should start with <!-- WS Compiler: manually edited --> in the module so that it’s not manually updated with imports
The custom widget set XML needs to import MprWidgetSet, for example, <inherits name="com.vaadin.mpr.MprWidgetSet"/>
After changing the widget set XML, remember to recompile it. When using Vaadin Maven plugin, you can run mvn vaadin:compile.