Skip to main content
A plain HTML page can use editing without a build step. The npm package includes two standalone ES module bundles, available through jsDelivr:
  • dist/index.browser.mjs — the read-only renderer and the builders.
  • dist/editable.browser.mjs — the same, plus the editor and the commands.
Each bundle includes its dependencies except React and React DOM, which the page supplies through an import map. Styles load automatically; no stylesheet link is needed. Use only the editable bundle for a page that edits. It includes all read-only exports; loading both bundles duplicates the renderer.

The import map

Point @graphysdk/react at the editable bundle and React at jsDelivr’s ESM builds:
With this map, import both GraphProvider and EditableGraphRenderer from @graphysdk/react inside a <script type="module">. Unlike the npm setup, this uses no /editable subpath.
Replace <version> with a released SDK version. Pin exact versions when publishing, and keep all four React and React DOM entries on the same version to avoid duplicate React instances.

A page that edits

This page adds an Edit toggle, Undo and Redo buttons, and a Copy spec button. It uses createElement to render React without JSX.
onSpecChange updates latestSpec after each committed edit, undo or redo. Copy spec serializes that value as JSON; pass the parsed JSON back as spec to restore the chart. Clipboard access requires HTTPS or localhost. The ref keeps the latest spec without triggering a React render. Using state and passing the exact onSpecChange value back as spec also preserves history. See Saving the chart. handleRef connects the buttons and keyboard shortcuts to the chart. The module-level spec and data stay stable across renders, so toggling edit mode does not recompile the chart.