JavaScript canvas libraries

Updated Nov 2026

JavaScript canvas libraries draw and update two-dimensional graphics in the browser through the HTML canvas element or SVG. Many of them keep each shape as an object that code can move, transform, or listen to for events. These libraries draw the diagrams, whiteboards, design editors, and games that run in web apps.

Popularity

Rough.js has the most monthly downloads in this comparison, at 97.6M.

LibraryMonthly downloadsStarsLast releaseLicense
Rough.js
97.6M
21.4KNov 2023MIT
ZRender
38.2M
6.3KMay 2026BSD-3-Clause
Konva
15.3M
15.0KOct 2026MIT
PixiJS
7.1M
48.8KNov 2026MIT
Fabric.js
5.2M
31.6KMay 2026MIT
@antv/g
1.6M
1.2KOct 2026MIT
Paper.js
1.5M
15.2KNov 2026MIT
p5.js
633.3K
24.4KNov 2026LGPL-2.1
Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

Draws lines, curves, arcs, polygons, circles, and ellipses in a hand-drawn style on canvas or SVG.

Downloads / mo
97.6M
Stars
21.4K
Last release
4.6.6
License
MIT

Quickstart

From Rough.js wiki
$ npm install roughjs
import rough from 'roughjs';
const rc = rough.canvas(document.getElementById('canvas'));
rc.rectangle(10, 10, 100, 80);

Rough.js examples

From open-source projects on GitHub

Draws the two-dimensional graphics underneath Apache ECharts.

Downloads / mo
38.2M
Stars
6.3K
Last release
6.1.0
License
BSD-3-Clause

Quickstart

From api.html
$ npm install zrender
import * as zrender from 'zrender';
const zr = zrender.init(document.getElementById('main'));
zr.add(new zrender.Circle({ shape: { cx: 80, cy: 80, r: 40 }, style: { fill: 'red' } }));

ZRender examples

From open-source projects on GitHub

Provides a canvas scene graph with shape events, dragging, transforms, animation, and image export.

Downloads / mo
15.3M
Stars
15.0K
Last release
10.9.1
License
MIT

Strengths

  • Gives each shape interaction events. Handle dragging, transforms, and animation on individual scene nodes.
  • Restores serialized node trees. Create a stage from JSON and reconnect application behavior afterward.

Limitations

  • Text input needs DOM elements. Overlay a native text input or textarea for editing.
  • JSON omits images and handlers. Restore image assets and event listeners after loading a saved stage.

Quickstart

From README.md
$ npm install konva
import Konva from 'konva';
const stage = new Konva.Stage({ container: 'container', width: 300, height: 200 });
const layer = new Konva.Layer();
layer.add(new Konva.Circle({ x: 80, y: 80, radius: 40, fill: 'red' }));
stage.add(layer);

Konva examples

From open-source projects on GitHub

Builds rendered scenes from sprites, graphics, text, and assets, with SVG texture or geometry loading.

Downloads / mo
7.1M
Stars
48.8K
Last release
8.23.0
License
MIT

Strengths

  • Loads SVG textures or geometry. Choose sprite textures or editable Graphics geometry for SVG artwork.
  • Exports rendered content as PNG. Download a scene or object as a PNG image.

Limitations

  • Changing text rebuilds its texture. Use BitmapText for text that changes every frame.
  • SVG textures lose vector scalability. Use Graphics geometry when SVG artwork must scale cleanly.

Quickstart

From README.md
$ npm install pixi.js
import { Application, Graphics } from 'pixi.js';
const app = new Application();
await app.init({ width: 300, height: 200 });
document.body.appendChild(app.canvas);
app.stage.addChild(new Graphics().rect(20, 20, 100, 80).fill('red'));

PixiJS examples

From open-source projects on GitHub

Adds interactive objects, transform controls, editable text, and scene serialization to a canvas.

Downloads / mo
5.2M
Stars
31.6K
Last release
7.4.0
License
MIT

Strengths

  • Provides ready-made object controls. Move, scale, rotate, skew, and group objects with built-in interactions.
  • Edits text directly on canvas. IText enters an editing state for interactive text input.

Limitations

  • Custom fields need export registration. Register application-specific properties before including them in serialized objects.

Quickstart

From README.md
$ npm install fabric
import { Canvas, Rect } from 'fabric';
const canvas = new Canvas('canvas', { width: 300, height: 200 });
canvas.add(new Rect({ left: 20, top: 20, width: 100, height: 80, fill: 'red' }));

Fabric.js examples

From open-source projects on GitHub

Renders graphics through DOM-compatible element and event APIs.

Downloads / mo
1.6M
Stars
1.2K
Last release
6.3.3
License
MIT

Quickstart

From getting-started
$ npm install @antv/g @antv/g-canvas
import { Canvas, Circle } from '@antv/g';
import { Renderer } from '@antv/g-canvas';
const canvas = new Canvas({ container: 'container', width: 300, height: 200, renderer: new Renderer() });
await canvas.ready;
canvas.appendChild(new Circle({ style: { cx: 80, cy: 80, r: 40, fill: 'red' } }));

@antv/g examples

From open-source projects on GitHub

Provides a vector scene graph with paths, point geometry, SVG import, and project serialization.

Downloads / mo
1.5M
Stars
15.2K
Last release
0.17.0
License
MIT

Strengths

  • Imports SVG as editable items. Convert external SVG artwork into Paper.js project items.
  • Serializes complete vector projects. Restore saved JSON data into a project.

Limitations

  • Node rendering needs extra packages. Use paper-jsdom-canvas for server-side canvas rendering.

Quickstart

From README.md
$ npm install paper
import paper from 'paper';
paper.setup(document.getElementById('canvas'));
new paper.Path.Circle({ center: [80, 80], radius: 40, fillColor: 'red' });

Paper.js examples

From open-source projects on GitHub

Draws shapes, text, and color on a canvas in a sketch that responds to the mouse.

Downloads / mo
633.3K
Stars
24.4K
Last release
2.4.0
License
LGPL-2.1

Quickstart

From get-started
$ npm install p5
function setup() {
  createCanvas(400, 400);
}
function draw() {
  background(220);
}

p5.js examples

From open-source projects on GitHub

FAQ

Konva and Fabric.js keep each shape as an object with its own events and transforms, the model behind editors and whiteboards. PixiJS renders sprite and graphics scenes, and Paper.js works with editable vector paths.

Rough.js draws lines, curves, arcs, polygons, circles, and ellipses in a hand-drawn, sketchy style on canvas or SVG. It has the most monthly downloads of these libraries, at 97.6M.

Fabric.js ships built-in controls to move, scale, rotate, and skew objects, and its IText edits text directly on the canvas. Konva gives each shape its own events and drag behavior, and text editing goes through a DOM input.

Konva does not support direct Konva.Text editing and recommends native DOM inputs. Fabric IText has a native editing state.

Images and event handlers must be manually restored after loading.

For coding agents

Found your canvas library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official