back to docs

embedding

use the web component or iframe embed to render graphs outside your app.

web component

import { defineGraphResponseElement } from '@intellea/graph-renderer'; import type { GraphResponseV0 } from '@intellea/graph-schema'; defineGraphResponseElement(); const element = document.querySelector('intellea-graph'); if (!element) throw new Error('missing graph element'); (element as HTMLElement & { graphResponse: GraphResponseV0 }).graphResponse = payload;

iframe

const iframe = document.querySelector('iframe'); if (!iframe?.contentWindow) throw new Error('missing iframe'); iframe.contentWindow.postMessage( { type: 'intellea:graph-response', payload }, '*' );

the embed shell loads a demo payload by default. send a postMessage payload to replace it.