Class RouterLink

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.router.RouterLink
All Implemented Interfaces:
AttachNotifier, BlurNotifier<RouterLink>, DetachNotifier, Focusable<RouterLink>, FocusNotifier<RouterLink>, HasComponents, HasElement, HasEnabled, HasStyle, HasText, AfterNavigationObserver, AfterNavigationHandler, Serializable

@Tag("a") public class RouterLink extends Component implements HasText, HasComponents, HasStyle, AfterNavigationObserver, Focusable<RouterLink>
A link that handles navigation internally using Router instead of loading a new page in the browser.

The href attribute of Component.getElement() will only be up-to-date when the component is attached to a UI.

Since:
1.0
Author:
Vaadin Ltd
See Also:
  • Constructor Details

    • RouterLink

      public RouterLink()
      Creates a new empty router link.
    • RouterLink

      public RouterLink(Class<? extends Component> navigationTarget)
      Creates a new router link for the given navigation target.
      Parameters:
      navigationTarget - navigation target
    • RouterLink

      public RouterLink(String text, Class<? extends Component> navigationTarget)
      Creates a new router link for the given navigation target using the given text.
      Parameters:
      text - link text
      navigationTarget - navigation target
    • RouterLink

      public RouterLink(Class<? extends C> navigationTarget, T parameter)
      Creates a new router link for the given navigation target using the given parameter.
      Type Parameters:
      T - url parameter type
      C - navigation target type
      Parameters:
      navigationTarget - navigation target
      parameter - url parameter for navigation target
    • RouterLink

      public RouterLink(String text, Class<? extends C> navigationTarget, T parameter)
      Creates a new router link for the given navigation target using the given text and parameter.
      Type Parameters:
      T - url parameter type
      C - navigation target type
      Parameters:
      text - link text
      navigationTarget - navigation target
      parameter - url parameter for navigation target
    • RouterLink

      public RouterLink(Class<? extends Component> navigationTarget, RouteParameters parameters)
      Creates a new router link for the given navigation target using the given parameters.
      Parameters:
      navigationTarget - navigation target
      parameters - route parameters for navigation target
    • RouterLink

      public RouterLink(String text, Class<? extends Component> navigationTarget, RouteParameters parameters)
      Creates a new router link for the given navigation target using the given text and parameters.
      Parameters:
      text - link text
      navigationTarget - navigation target
      parameters - route parameters for navigation target
    • RouterLink

      public RouterLink(Router router, Class<? extends Component> navigationTarget) throws IllegalArgumentException
      Creates a new router link for the given navigation target.
      Parameters:
      router - router used for navigation
      navigationTarget - navigation target
      Throws:
      IllegalArgumentException - if navigation target requires parameters
    • RouterLink

      public RouterLink(Router router, String text, Class<? extends Component> navigationTarget) throws IllegalArgumentException
      Creates a new router link for the given navigation target using the given text.
      Parameters:
      router - router used for navigation
      text - link text
      navigationTarget - navigation target
      Throws:
      IllegalArgumentException - if navigation target requires parameters
    • RouterLink

      public RouterLink(Router router, Class<? extends C> navigationTarget, T parameter)
      Creates a new router link for the given navigation target using the given parameter.
      Type Parameters:
      T - url parameter type
      C - navigation target type
      Parameters:
      router - router used for navigation
      navigationTarget - navigation target
      parameter - url parameter for navigation target
    • RouterLink

      public RouterLink(Router router, String text, Class<? extends C> navigationTarget, T parameter)
      Creates a new router link for the given navigation target using the given text and parameter.
      Type Parameters:
      T - url parameter type
      C - navigation target type
      Parameters:
      router - router used for navigation
      text - link text
      navigationTarget - navigation target
      parameter - url parameter for navigation target
    • RouterLink

      public RouterLink(Router router, Class<? extends Component> navigationTarget, RouteParameters parameters)
      Creates a new router link for the given navigation target using the given parameters.
      Parameters:
      router - router used for navigation
      navigationTarget - navigation target
      parameters - route parameters for navigation target
    • RouterLink

      public RouterLink(Router router, String text, Class<? extends Component> navigationTarget, RouteParameters parameters)
      Creates a new router link for the given navigation target using the given text and parameters.
      Parameters:
      router - router used for navigation
      text - link text
      navigationTarget - navigation target
      parameters - route parameters for navigation target
  • Method Details