---
url: https://lit-ui-router.dev/reference/lit-ui-router/core/parentUiViewContext.md
---
[lit-ui-router](../index.md) / parentUiViewContext

# Variable: parentUiViewContext

```ts
const parentUiViewContext: ParentUiViewContext;
```

Defined in: [packages/lit-ui-router/src/context.ts:504](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/lit-ui-router/src/context.ts#L504)

The context key every `<ui-view>` answers for, with itself, so a descendant
finds its enclosing view.

A `<ui-view>` seeks its own parent over the house `ui-view-context` event;
this key is the protocol form of that answer, for everyone else. The nearest
enclosing view wins, and no view answers its own request.

## Examples

```ts
import { consume } from '@lit/context';
import { LitElement } from 'lit';
import { parentUiViewContext } from 'lit-ui-router/context';
import type { ParentUiView } from 'lit-ui-router/context';

class MyElement extends LitElement {
  @consume({ context: parentUiViewContext })
  parentView!: ParentUiView;
}
```

```ts
import { parentUiViewContext, requestContext } from 'lit-ui-router/context';

declare const element: HTMLElement;

const parentView = requestContext(element, parentUiViewContext);
```
