Install the package
Use the same published version as this showcase, or review the upstream release notes before updating.
npm install @wieslawsoltes/drawingweb@0.1.0-alpha.1This package’s license: MIT. Retain upstream and bundled third-party notices when redistributing.
Mount your first view
Create a DiagramEngine and a measurable host, then attach a DrawingControl. Bind records with ObservableTable and DiagramBinding when needed.
<div class="toolbar"><button id="add">Add a step</button><button id="undo">Undo</button><button id="redo">Redo</button><button id="fit">Fit diagram</button></div><div id="diagram" class="stage" style="border:1px solid var(--line);border-radius:8px;overflow:hidden"></div><p class="hint">Select, drag and resize shapes. Double-click text to edit. Every action uses the same diagram engine.</p>The complete executable source is in the usage guide. Imports shown here are intended for a bundler or a browser import map; bare npm imports do not resolve in ordinary HTML by themselves.
Own the lifetime
Dispose bindings, controls, tables and owned engines. A control does not dispose an engine that it borrowed.
The playground replaces its entire isolated frame on each run. In your application, use the framework’s unmount or disposal hook instead. Do not dispose a shared model while another view still owns it.
Read the lifecycle guide →Know the contract
Source repositories can contain work newer than the published package. The showcase uses @wieslawsoltes/drawingweb@0.1.0-alpha.1.