LiveKit docs › Hooks › useEnsureLayoutContext

---

# useEnsureLayoutContext

Ensures that a layout context is provided, either via context or explicitly as a parameter. If not inside a `LayoutContext` and no layout context is provided, an error is thrown.

## Import

```typescript
import { useEnsureLayoutContext } from "@livekit/components-react";

```

## Properties

- **`layoutContext`** _(LayoutContextType)_ (optional): 

## Returns

```typescript
LayoutContextType;

```

---

This document was rendered at 2026-06-07T11:32:49.601Z.
For the latest version of this document, see [https://docs.livekit.io/reference/components/react/hook/useensurelayoutcontext.md](https://docs.livekit.io/reference/components/react/hook/useensurelayoutcontext.md).

To explore all LiveKit documentation, see [llms.txt](https://docs.livekit.io/llms.txt).