Skip to content

lit-ui-router / UIRouterLitElement

Class: UIRouterLitElement

Defined in: packages/lit-ui-router/src/ui-router.ts:32

Slots

  • default<ui-router> renders slotted content.

Events

  • ui-router-context<ui-router> listens to the ui-router-context event and provides the uiRouter instance.

Extends

Properties

PropertyTypeDescriptionDefined in
uiRouterUIRouterLit | undefinedRoot uiRouter singleton. If not provided, the element creates and assigns a new instance.packages/lit-ui-router/src/ui-router.ts:38

Methods

seekRouter()

ts
static seekRouter(candidate): UIRouterLit | undefined;

Defined in: packages/lit-ui-router/src/ui-router.ts:69

Discovers the UIRouterLit instance provided by the nearest enclosing <ui-router> element.

Dispatches a bubbling, composed ui-router-context event from the candidate element; the enclosing <ui-router> answers it with its router instance. Returns undefined when the candidate is not inside a <ui-router> (e.g. not yet connected).

This is the dependency-injection primitive for integrating external reactivity systems (state stores, controllers) with the router context — call it from hostConnected() / connectedCallback() instead of prop-drilling the router instance.

Parameters

ParameterType
candidateElement

Returns

UIRouterLit | undefined