talira

HTML5 canvas 2D scene graph library for interactive graphics, design editors and whiteboards

open sourceMITfree

Konva is a JavaScript library for interactive 2D graphics on the HTML5 canvas. It gives you an object-oriented scene graph of stages, layers, groups and shapes instead of low-level drawing commands, with one event system for mouse and touch, drag and drop, a Transformer for resize and rotate handles, animations and tweens, cached nodes with image filters, and export of a stage or node to a canvas, data URL or Blob. It has no dependencies, and official bindings for React (react-konva), Vue, Svelte and Angular. People build design editors, whiteboards, diagram tools and image annotators with it. Anton Lavrenov has maintained it since 2015, when it began as a fork of Eric Rowell's KineticJS.

Problems it solves

  • build a drag-and-drop design editor in the browser with resizable, rotatable shapes
  • draw interactive shapes on an HTML canvas in React without writing low-level canvas code
  • make a whiteboard or diagram editor that works with touch and mouse
  • export a canvas drawing to an image at a higher pixel ratio

Features

  • object-oriented scene graph of stages, layers, groups and shapes
  • pointer and touch events with bubbling and delegation
  • drag and drop, and a Transformer for resize and rotate controls
  • animations and tweens
  • image filters on cached nodes such as blur, contrast and grayscale
  • export to canvas, data URL or Blob at a chosen pixel ratio
  • official React, Vue, Svelte and Angular bindings
  • no dependencies
  • TypeScript types

Alternatives

The same job

These do what Konva does.

  1. tldraw The infinite canvas SDK
  2. Fabric.js A JavaScript HTML5 canvas library with an interactive object model and SVG parser

Compare Konva with the top 3