Router

A Router object for configuring a set of routes.

Overview

The Router object is used for configuring how frames are nested in one another. The Routes property defines a hierarchically nested set of frames. In this hierarchy, each frame can contain a RouterOutlet block and a set of children frames that can appear in the outlet. For more information on routes, see the “Fundamentals” section of the Workbench documentation.

Example

Below is an example configuration.

kind: Solution
version: v0
router:
  kind: Router
  routes:
    - frame: home-frame
      children:
        - frame: sub-frame1 # route is /home-frame/sub-frame1
        - frame: sub-frame2 # route is /home-frame/sub-frame2
frames:
  home-frame:
    kind: Frame
    contents:
      my-button1:
        kind: Button
        text: Go to sub frame 1
        routerLink: /home-frame/sub-frame1
      my-button2:
        kind: Button
        text: Go to sub frame 2
        routerLink: /home-frame/sub-frame2
      my-outlet:
        kind: RouterOutlet # contains children frames
  sub-frame1:
    kind: Frame
    contents:
      text1:
        kind: Text
        text: This is sub-frame 1
        type: display-1
  sub-frame2:
    kind: Frame
    contents:
      text1:
        kind: Text
        text: This is sub-frame 2
        type: display-1

RouterConfig

Name Type Required Description
kind "Router" Yes The router can be used to navigate between frames in the solution
routes List<RouteConfig> No List of frames

RouteConfig

Name Type Required Description
frame string Yes The frame to which you want to route
children List<RouteConfig> No Children are used to define sub-routes