Marrow Diagram Embed
Embed self-contained, interactive HTML network diagrams compiled with Marrow directly in your Next.js or React application with automatic dark/light theme syncing, fullscreen mode, and minimal kiosk chrome.
The Marrow Diagram Embed (<MarrowEmbed /> or <TopologyViewport />) embeds interactive, offline network diagrams generated by the Marrow compiler into any web application, dashboard, or documentation portal.
Rather than faking nodes or reinventing diagram layout in React, Marrow diagrams bring their own deterministic ELK layout engine, vector SVGs, and telemetry inspectors inside a lightweight, isolated <iframe> container with zero CSS collisions.
Preview
Installation
npx shadcn@latest add https://marrowdiagram.vercel.app/r/topology-canvas.jsonOr via GitHub:
npx shadcn@latest add raiz-toff/Marrow/topology-canvasFeatures
- Native Marrow HTML Support: Embeds diagrams compiled directly by
marrow compileormarrow buildwithout runtime overhead or re-rendering logic. - Two-Way Theme Synchronization: Automatically detects host dark/light mode toggles and transmits
postMessage({ type: 'marrow:theme', theme })to the diagram in real time. - URL or In-Memory HTML: Supports loading static diagram files via
srcor in-memory compiled strings viahtml(srcDoc). - Kiosk and Minimal Chrome: Strips outer breadcrumbs, search docks, and sidebars using Marrow's
#embed=trueengine flag so the diagram integrates cleanly into host pages. - Fullscreen Mode: One-click fullscreen expansion for NOC video walls and operations dashboards.
- External Standalone Link: One-click button to launch the diagram standalone in a new tab.
Usage Examples
1. Embed Pre-Compiled Diagram (src)
When serving compiled diagrams from your /public folder or CDN:
import { MarrowEmbed } from "@marrow/ui";
export function DatacenterTopology() {
return (
<MarrowEmbed
src="/diagrams/datacenter.html"
title="Datacenter Fabric"
chrome="minimal"
height="620px"
/>
);
}2. Embed In-Memory Compiled HTML (html)
When fetching compiled HTML dynamically from an API, build script, or server action:
import { MarrowEmbed } from "@marrow/ui";
export function DynamicTopology({ compiledHtml }: { compiledHtml: string }) {
return (
<MarrowEmbed
html={compiledHtml}
title="Generated Network Topology"
height="600px"
theme="auto"
/>
);
}3. Diagram Presets Switcher
Switch between multiple architecture views inside the same container:
import { MarrowEmbed } from "@marrow/ui";
export function MultiSiteDiagram() {
return (
<MarrowEmbed
presets={[
{ label: "Campus Core", src: "/demo/tiered-embed.html" },
{ label: "Branch Offices", src: "/demo/zoned-embed.html" },
{ label: "Hub & Spoke WAN", src: "/demo/hub-spoke-embed.html" },
]}
height="600px"
/>
);
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
src | string | "/demo/tiered-embed.html" | URL or path to the compiled Marrow HTML diagram file. |
html | string | undefined | Raw compiled Marrow HTML string rendered directly via srcDoc. |
title | string | "Marrow Network Diagram" | Accessible title for the iframe and stage toolbar. |
chrome | 'minimal' | 'full' | 'minimal' | Chrome mode (minimal strips topbar, search dock, and sidebars). |
inspector | 'on' | 'off' | 'on' | Hardware and interface telemetry inspector drawer. |
minimap | 'on' | 'off' | 'on' | Radar navigation minimap overlay. |
theme | 'auto' | 'dark' | 'light' | 'auto' | Theme mode. Syncs live with host document dark/light mode. |
height | string | number | "600px" | Container height. |
showToolbar | boolean | true | Show top toolbar with title, fullscreen toggle, and external link. |
presets | MarrowEmbedPreset[] | undefined | Array of preset diagrams for quick switching. |
onReady | () => void | undefined | Callback fired when Marrow signals marrow:ready. |
className | string | undefined | Additional CSS classes for the outer container. |