Reference

Router

Where the current page renders. May sit at any depth inside app; pages declare their own paths.

Router(transition: Enum, duration: String) { … }

Before 5.0

transition

none

fade

slide

No preview for this one: the example below shows how it is written.

Example

wf

Stack { Navbar { Navbar.Brand { Link("Ledger", to: "/") } Navbar.Links { Link("Learn", to: "/learn") Link("Reference", to: "/reference") } } Router(transition: .fade, duration: "200ms") Text("© 2026 Ledger").muted.sm }

Beside a sidebar, pages that slide

wf

Row { Sidebar { Sidebar.Item(to: "/learn", icon: "book") { Text("Learn") } Sidebar.Item(to: "/recipes", icon: "list") { Text("Recipes") } } Container { Router(transition: .slide, duration: "250ms") } }

Props

Props of Router
PropTypeUnsetMeaning

transition:

one of its cases

none

How a route change moves between pages, through the browser's View Transitions where it has them; none for a reader who asks for less motion. Written as a flag, .none, or by name, transition: .none.

  • .none (the default): The next page replaces the last at once
  • .fade: The last page fades out, the next fades in
  • .slide: The last page slides out to the left, the next in from the right

duration:

String

$animation-duration-normal, 300ms

How long each half of the transition plays, a CSS time, 200ms

Attribute families: global, aria, data. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.

Flags and cases

A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.

.none

.fade

.slide

Events

Every element also takes the props, the events and the attribute families listed on every element.

Slots

children

Renders with the class wf-router, stable across releases, so a stylesheet may target it.

These controls list the props' cases; the example below shows them written.