Marrow

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

Loading diagram…

Installation

npx shadcn@latest add https://marrowdiagram.vercel.app/r/topology-canvas.json

Or via GitHub:

npx shadcn@latest add raiz-toff/Marrow/topology-canvas

Features

  • Native Marrow HTML Support: Embeds diagrams compiled directly by marrow compile or marrow build without 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 src or in-memory compiled strings via html (srcDoc).
  • Kiosk and Minimal Chrome: Strips outer breadcrumbs, search docks, and sidebars using Marrow's #embed=true engine 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

PropTypeDefaultDescription
srcstring"/demo/tiered-embed.html"URL or path to the compiled Marrow HTML diagram file.
htmlstringundefinedRaw compiled Marrow HTML string rendered directly via srcDoc.
titlestring"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.
heightstring | number"600px"Container height.
showToolbarbooleantrueShow top toolbar with title, fullscreen toggle, and external link.
presetsMarrowEmbedPreset[]undefinedArray of preset diagrams for quick switching.
onReady() => voidundefinedCallback fired when Marrow signals marrow:ready.
classNamestringundefinedAdditional CSS classes for the outer container.