Skip to content

dygufa/react-simple-sketch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-simple-sketch

npm version

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

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

Property Type Required
tool "line" | "rect" | "path yes
width number no
height number no
lineWidth number no
lineColor string (hex) no
style React.CSSProperties no
onChange (objects: ShapeObject) => void no
value ShapeObject[] no

Running example

cd example/
yarn start

Todo

  1. Responsive version

About

Simple sketch board that allows to draw lines, rectangles and paths

Resources

Stars

Watchers

Forks

Packages

No packages published