0.3.2 • Published 6 years ago

react-simple-sketch v0.3.2

Weekly downloads
22
License
MIT
Repository
github
Last release
6 years ago

react-simple-sketch

npm version

Simple sketch board that allows drawing lines, rectangles and paths.

Check the DEMO

How to use

Install

Run yarn add react-simple-sketch or npm install react-simple-sketch

Use

import SimpleSketch from "react-simple-sketch";

<SimpleSketch
    tool={this.state.tool}
    lineColor={this.state.color}
    lineWidth={this.state.lineWidth}
    width={600}
    height={300}
    style={{
        border: "2px solid #000",
        borderRadius: "5px"
    }}
    onChange={this.onSketchBoardChange}
    value={this.state.objects}
/>

Properties

PropertyTypeRequired
tool"line" | "rect" | "pathyes
widthnumberno
heightnumberno
lineWidthnumberno
lineColorstring (hex)no
styleReact.CSSPropertiesno
onChange(objects: ShapeObject) => voidno
valueShapeObject[]no

Running example

cd example/
yarn start

Todo

  1. Responsive version
0.3.2

6 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago