Annotation Interface RouteParent


@Retention(RUNTIME) @Target(TYPE) public @interface RouteParent
Defines the logical parent of a navigation target.

This is a purely logical hierarchy used to build navigation aids such as breadcrumb trails and hierarchical menus. It is independent of the layout chain declared through Route.layout() and RoutePrefix: a route may be rendered inside one layout while logically belonging under a completely different route.

The parent can be defined either as a static value() or, when it needs to be computed, through a resolver(). Both are resolved without creating an instance of the route or its parent, which makes them usable for routes that are not currently shown, such as the ancestors of a breadcrumb trail.

Since:
25.2
Author:
Vaadin Ltd
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Gets the RouteParentResolver that resolves the logical parent dynamically without requiring an instance of the route or its parent.
    Class<? extends Component>
    Gets the static logical parent navigation target.
  • Element Details

    • value

      Class<? extends Component> value
      Gets the static logical parent navigation target.

      The parent inherits the RouteParameters of the annotated route, narrowed to the names the parent's own route template declares (so a parent with fewer or no parameters still resolves to a working link). Use a resolver() when the parent or its parameters need to be computed differently.

      Ignored when a resolver() is set. Defaults to Component itself, which marks "no static parent".

      Returns:
      the logical parent navigation target, or Component when no static parent is used
      Default:
      com.vaadin.flow.component.Component.class
    • resolver

      Class<? extends RouteParentResolver> resolver
      Gets the RouteParentResolver that resolves the logical parent dynamically without requiring an instance of the route or its parent.

      When set to a resolver other than the default RouteParentResolver marker, the resolver is used to resolve the parent and value() is ignored. This allows the parent to be computed from the route parameters even for routes that are not instantiated.

      Returns:
      the resolver type, or RouteParentResolver itself when no resolver is used
      Default:
      com.vaadin.flow.router.RouteParentResolver.class