Package Exports
- react-konva
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-konva) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
React Konva

React Konva is a JavaScript library for drawing complex canvas graphics using React.
It provides declarative and reactive bindings to the Konva Framework.
DEMO
An attempt to make React work with the HTML5 canvas library. The goal is to have similar declarative markup as normal React and to have similar data-flow model.
Currently you can use all Konva components as React components and all Konva
events are supported on them in same way as normal browser events are supported.
You can even inspect the components in React dev tools.
Installation
npm instal react konva react-konva --saveExample
import React from 'react';
import ReactDOM from 'react-dom';
import {Layer, Rect, Stage, Group} from 'react-konva';
class MyRect extends React.Component {
constructor(...args) {
super(...args);
this.state = {
color: 'green'
};
this.handleClick = this.handleClick.bind(this);
}
handleClick() {
this.setState({
color: Konva.Util.getRandomColor()
});
}
render() {
return (
<Rect
x={10} y={10} width={50} height={50}
fill={this.state.color}
shadowBlur={10}
onClick={this.handleClick}
/>
);
}
}
function App() {
return (
<Stage width={700} height={700}>
<Layer>
<MyRect/>
</Layer>
</Stage>
);
}
ReactDOM.render(<App/>, document.getElementById('container'));All react-konva components correspond to Konva components of the same
name. All the parameters available for Konva objects are valid props for
corresponding react-konva components, unless otherwise noted.
Core shapes are: Rect, Circle, Ellipse, Line, Image, Text, TextPath, Star, Label, SVG Path, RegularPolygon. Also you can create custom shape.
To get more info about Konva you can read Konva Overview.
Comparisons
react-konva vs react-canvas
react-canvas is a completely different react plugin. It allows you to draw DOM-like objects (images, texts) on canvas element in very performant way. It is NOT about drawing graphics, but react-konva is exactly for drawing complex graphics on <canvas> element from React.
react-konva vs react-art
react-art allows you to draw graphics on a page. It also supports SVG for output. But it has no support of events of shapes.
react-konva vs vanilla canvas
Performance is one of the main buzz word in react hype.
I made this plugin not for performance reasons. Using vanilla