Konva: a scene graph for interactive canvas apps
Konva.js is an HTML5 Canvas JavaScript framework for interactive graphics, design editors, whiteboards, and diagrams. Scene graph with events, drag and drop, transforms, animations, and export.
At a glance
- What is it?
- Konva is an MIT-licensed 2D canvas framework whose scene graph gives each shape its own events, drag behavior, transforms, animation and export controls. Here is how it installs, what it costs, and when Fabric.js is the better fit.
- Who is it for?
- Adopt Konva when you need a scene graph with per-shape events, drag, transforms and export, and you are willing to manage canvas hit detection yourself. Skip it if you only need a static chart or a single image annotation, or if you want a finished editor: the README points at Polotno, the maintainers' commercial SDK, for that.
- Can I use it commercially?
- Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
- Is it still maintained?
- Yes. The repository last received commits 8 days ago.
- What is it written in?
- Mainly TypeScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 27, 2026, and from our analysis. They are not legal advice.
Editorial analysis
The problem Konva solves for canvas editors
The raw Canvas 2D API is a drawing surface, not an object model. You call fillRect and move on; there is no object to attach a click handler to, no rectangle that remembers its own position after you transform it. Every editor built on canvas ends up writing the same missing layer: a list of shapes, a hit test that maps a pointer coordinate back to a shape, a transform stack, a redraw loop.
Konva supplies that layer. The README describes it as an open-source 2D canvas framework whose scene graph gives each shape its own events, drag behavior, transforms, animation, cache, and export controls. The intended audience is explicit: the README lists design editors, whiteboards, diagrams, annotations, maps, and other visual tools. If your app has a selection outline, a resize handle, or a shape the user can drag, Konva is aimed at you. If you are drawing a fixed chart, it is not.
Stage, Layer, Shape: how the scene graph is structured
The architecture is a tree of three node types. A Stage owns a container element and a width and height. Layers sit inside the stage. Shapes sit inside layers. The README's Quick Look shows the whole pattern: create a Konva.Stage bound to a container with explicit dimensions, create a Konva.Layer, create a Konva.Rect with x, y, width, height, fill and draggable set to true, then add the rect to the layer and the layer to the stage.
That draggable flag is the clearest illustration of the design. Drag behavior is a property of the node, not a gesture you wire up yourself, so the framework owns the pointer capture, the coordinate translation and the redraw. The same applies to transforms and animation: they attach to nodes in the graph rather than to the canvas as a whole.
The layer is the performance boundary. Konva renders each layer as its own canvas element, so a stage with several layers means several stacked canvases. The README lists FastLayer alongside Stage, Layer, Group and Shape as the core primitives, which tells you the project expects users to separate static background content from content that changes every frame. The README does not spell out the redraw semantics of FastLayer in the text available here, so treat that split as something to confirm in the API documentation before you build around it.
Installing Konva and drawing a draggable rectangle
The README gives four loading paths: a script tag from a CDN, npm, a minimal bundle built from konva/lib/Core, and a Node environment. For a browser app, npm is the ordinary route.
npm install konvaThen import it and build the smallest useful scene. This is the README's Quick Look example, which creates a container element, a 600 by 400 stage, one layer, and a blue rectangle that the user can drag.
import Konva from 'konva';
const container = document.createElement('div');
document.body.appendChild(container);
const stage = new Konva.Stage({ container, width: 600, height: 400 });
const layer = new Konva.Layer();
const box = new Konva.Rect({
x: 50, y: 50, width: 120, height: 80,
fill: '#00a8e8', draggable: true,
});
layer.add(box);
stage.add(layer);What you should see is a blue rectangle at 50, 50 that follows the pointer when you drag it. No event listeners were registered; draggable did the work.
TypeScript users need DOM definitions in tsconfig.json, which the README shows as a lib array containing es6 and dom. If you want a smaller bundle, the README documents importing Konva from konva/lib/Core and then importing only the shapes you need, such as Rect from konva/lib/shapes/Rect, noting that importing a shape injects it into the Konva object. Filters follow the same pattern, for example Blur from konva/lib/filters/Blur.
Server-side rendering needs a rendering backend you install yourself
Konva runs in Node, but not on its own. The README states that you also need to install canvas or skia-canvas manually as the rendering backend, and gives both commands.
# node-canvas backend
npm install konva canvas
# skia-canvas backend
npm install konva skia-canvasIn that environment you use the same scene graph API and omit the stage's container attribute, since there is no DOM to attach to. The backend is selected by an import side effect, either konva/canvas-backend or konva/skia-backend, and then you construct a Konva.Stage with only width and height.
import Konva from 'konva';
import 'konva/canvas-backend'; // or import 'konva/skia-backend'
const stage = new Konva.Stage({
width: 500,
height: 500,
});Two constraints come straight from the README. DOM events require a browser, so anything event-driven is off the table server-side. And canvas feature support depends on the selected backend, which means the two backends are not interchangeable for every drawing operation. The README does not enumerate which features differ, so that is a question for your own rendering tests, not for the documentation as it stands.
Where Konva is the wrong tool
Konva draws into canvas, which means nothing it renders is in the DOM. Text inside a Konva.Text node is not selectable, not searchable, and not reachable by a screen reader in the way an HTML element would be. If your product needs accessible, copyable text as a first-class requirement, a canvas scene graph works against you and an SVG or DOM approach works with you.
The scene graph also carries memory cost that scales with node count. Every shape is a JavaScript object with its own transform state, event subscriptions and cache, and the README presents cache as a per-shape control rather than something automatic. A diagram with a few thousand nodes is a different engineering problem from a whiteboard with fifty.
The third boundary is scope. Konva is a graphics framework, not an editor. There is no built-in text editing UI, no template library, no export dialog. The README says as much by pointing at Polotno, the commercial design editor SDK built on Konva by the Konva maintainers, with templates, text editing and export, installed via npm install polotno. If you want an editor rather than the primitives to build one, the README is telling you to buy rather than build.
Konva vs Fabric.js: two different bets on the object model
Fabric.js is the comparison people search for most often, and the difference is architectural. Fabric wraps canvas in an object model of its own, with its own serialization format and a long-standing set of built-in interactions. Konva's README frames its scene graph around per-shape events, drag, transforms, animation, cache and export controls, and the framework is written in TypeScript with shipped type definitions, which matters if your editor code is typed end to end.
The practical split: Fabric's object model is more opinionated and its serialization story is more central to how you persist a document. Konva leans on the scene graph as a rendering and interaction layer and leaves more of the document model to you. Neither is a superset. If you need to load and save a canvas document in a format another Fabric-based tool understands, Konva gives you nothing for that, and you would be writing the serializer.
A second alternative is not drawing to canvas at all. If your shapes are few, mostly static, and need to be accessible and styleable, SVG plus DOM events is less machinery than a scene graph. Konva earns its place when shape count, per-frame redraw, or pixel-level export push you off the DOM.
Maintenance, licence and what an upgrade costs
The repository is not archived. Its last push was on 2026-09-19, and the release history shows 10.4.0 on 2026-09-07, 10.5.0 on 2026-09-08 and 10.6.0 on 2026-09-19, so releases are landing close together right now. That cadence is a double-edged fact: you get fixes quickly, and you also get more surface to re-test.
The README states Konva is MIT licensed and does not require a license key. The repository's licence file is present at the top level, and the GitHub API reports the licence as NOASSERTION, which means the automated classifier did not recognise it. The README's MIT statement is the clear signal; if your organisation needs the licence field to resolve mechanically, that mismatch is worth resolving before you ship. Nothing here is legal advice.
Upgrade cost is mostly about the public API you touch. Konva ships compiled output in lib plus konva.js and konva.min.js, with subpath exports for the backend modules, so a version bump can change what your imports resolve to. The project's own test script runs type tests, browser tests, Node tests and import tests, which tells you the maintainers treat import resolution as something that can break. If you import from deep paths like konva/lib/Core or konva/lib/shapes/Rect, budget for re-checking those specifiers on each major version. Funding comes partly from Polotno and from named backers, so the commercial SDK and the open-source framework share a maintainer team.
Editorial conclusion
Adopt Konva when you need a scene graph with per-shape events, drag, transforms and export, and you are willing to manage canvas hit detection yourself. Skip it if you only need a static chart or a single image annotation, or if you want a finished editor: the README points at Polotno, the maintainers' commercial SDK, for that. Before committing, verify the Node rendering path with your chosen backend, since the README states that canvas feature support depends on whether you install canvas or skia-canvas.
Frequently asked questions
How does Konva work?
It builds a scene graph of Stage, Layer and Shape nodes on top of the HTML5 canvas. Each shape carries its own events, drag behavior, transforms, animation, cache and export controls, so interactions attach to nodes rather than to the raw drawing surface.
Is Konva open source?
Yes. The README states that Konva is MIT licensed and does not require a license key. The repository's licence file is at the top level, though the GitHub API reports the licence as NOASSERTION.
What is React Konva?
It is the React integration for Konva, published as react-konva and documented in the React guide linked from the README. Konva also lists vue-konva, svelte-konva and ng2-konva for other frameworks.
how to use konva js
Create a Konva.Stage bound to a container with a width and height, add a Konva.Layer, add shapes such as Konva.Rect to the layer, then add the layer to the stage. Setting draggable: true on a shape makes it follow the pointer without extra event listeners.
how to install react konva
The README lists react-konva as the React package and links to the React guide at konvajs.org. The available material does not give the install command for react-konva, only for konva itself via npm install konva.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/konvajs-konva)