NPM version NPM total downloads License


A lightweight Javascript library for creating Vector graphics and manipulating SVG.

Lightweight library for manipulating SVG.



Install it from npm:

$ npm install --save vector.svg


If you prefer CDN, then just insert it into your HTML page:

<script src=""></script>


This is a simple Drawing Pad built with Vector.svg library.

Getting Started

First of all, create a HTML page consisting of a HTML element with an id attribute and ready to serve as the container of the drawing:

<!DOCTYPE html>
  <title>Vector.svg Getting Started</title>

<div id="paper"></div>


Then, create a SVG Document within the container element:

var paper = Vector("paper", 400, 300);

Now, lets create some basic shapes:

var paper = Vector("paper", 400, 300);

var circle =;
circle.attr("stroke", "red")
      .attr("fill", "purple");

var rect = paper.rect(100, 100).x(100).y(100);
rect.attr("stroke", "purple")
    .attr("fill", "green");

That’s it. Here is the JSFiddle link.

Documentation and Wiki