HTML5 canvas SVG Path Tutorial

To create an SVG path with Konva, we can instantiate a Konva.Path() object.

Paths are most commonly used when we want to export an SVG Path into an HTML5 Canvas path, or if we want to manifest complex drawings as a data string rather than creating a custom shape.

For a full list of attributes and methods, check out the Konva.Path documentation.

If you want to draw full SVG image into the canvas take a look into How to draw SVG image post.

Konva Path Demoview raw
<!DOCTYPE html>
<script src="[email protected]/konva.min.js"></script>
<meta charset="utf-8" />
<title>Konva Path Demo</title>
body {
margin: 0;
padding: 0;
overflow: hidden;
background-color: #f0f0f0;

<div id="container"></div>
var stage = new Konva.Stage({
container: 'container',
width: window.innerWidth,
height: window.innerHeight,

var layer = new Konva.Layer();

var path = new Konva.Path({
x: 50,
y: 40,
fill: 'green',
scale: {
x: 2,
y: 2,

// add the shape to the layer

// add the layer to the stage
Enjoying Konva? Please consider to support the project.