> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/developers/integrations/development/contentkit/component-reference/webframe.md).

# Webframe

ContentKit webframe component and frame communication

`webframe` embeds external content:

```tsx
<webframe source={{ url: 'https://www.gitbook.com' }} aspectRatio={16 / 9} />
```

| Props           | Type                     | Description         |
| --------------- | ------------------------ | ------------------- |
| `source`\*      | `object`                 | URL source.         |
| `source.url`\*  | `string`                 | External site URL.  |
| `aspectRatio`\* | `number`                 | Aspect ratio.       |
| `buttons`       | `Array<Button>`          | Overlay buttons.    |
| `data`          | `Record<string, string>` | State dependencies. |

### Receive data

Pass state through `data` with `element.dynamicState('content')`. The frame receives data and context through `message`:

```javascript
window.addEventListener('message', (event) => {
  const state = event.data?.state;
  if (!state) return;
  const content = state.content;
  const page = state.page;
});
```

GitBook provides `state.page` as `{ id, path, title }`. GitBook provides `state.visitor` with the `site:visitor:claims` scope.

### Send actions

Send a custom action to the integration with `postMessage`:

```javascript
window.parent.postMessage({ action: { type: 'doSomething' } }, '*');
```

Resize the container when frame content changes size:

```javascript
window.parent.postMessage({
  action: {
    action: '@webframe.resize',
    aspectRatio: 1.7,
    maxHeight: 400,
    maxWidth: 300
  }
}, '*');
```

Send `@webframe.ready` when the frame can receive updates. See [Actions](/docs/developers/integrations/development/contentkit/actions.md).

For requests that don't need frame messaging, use your integration’s public HTTP endpoint. Follow [Handle an HTTP request](/docs/developers/integrations/guides/receiving-requests.md).

The frame can navigate a published site with `@webframe.navigate`. Send `path` after the site’s base URL and an optional `anchor`.

Follow [Send data to a webframe](/docs/developers/integrations/guides/send-data-to-a-webframe.md) for a complete example.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gitbook.com/docs/developers/integrations/development/contentkit/component-reference/webframe.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
