dygufa / react-simple-sketch

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

Home Page:https://dygufa.com/react-simple-sketch/example/dist/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

https://dygufa.com/react-simple-sketch/example/dist/


Languages

Language:TypeScript 82.6%Language:HTML 11.0%Language:JavaScript 6.3%