The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

lwr-router-container

A router container provides navigation context by processing all navigation wires and events from its descendants in the DOM.

PropertyTypeRequired/OptionalDescription
routerRouter objectOptionalObtained from the createRouter() API.
history-disabledBooleanOptionalSet history-disabled to true if your router container shouldn't alter the browser's History API during navigation events or location changes.

A router container fires these events:

  • onhandlenavigation

  • onprenavigate

    • Dispatched when a navigation event is received and a RouteDefinition match is found. event.preventDefault() cancels the navigation event. event.detail is a RouteChange object.

  • onpostnavigate

    • Dispatched when a navigation event has completed. event.detail is a DomRoutingMatch object for the current location.

  • onerrornavigate

    • Dispatched when there's an error processing a navigation event. (For example, no RouteDefinition match or a prenavigate cancellation.) event.detail is a MessageObject.

See Also