Skip to content

lit-ui-router / routerContext

Variable: routerContext

ts
const routerContext: RouterContext;

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

The context key <ui-router> answers for: the router instance.

Speaks the community context-request protocol without depending on @lit/context — the key is a stable object, matched by identity, and the branded type is the one createContext() would have produced. An element written against @lit/context consumes it unchanged:

Example

ts
import { consume } from '@lit/context';
import { routerContext } from 'lit-ui-router/context';
import type { UIRouterLit } from 'lit-ui-router';

class MyElement extends LitElement {
  @consume({ context: routerContext })
  router!: UIRouterLit;
}

See