@jzohdi/react-draw
TypeScript icon, indicating that this package has built-in type declarations

0.9.29 • Public • Published

reactdraw

A drawing library in react

view storybook docs/demo here

https://user-images.githubusercontent.com/31998568/183299492-4cf5a7da-e7b8-4418-9b47-d04143db7baa.mp4

Installation

npm install @jzohdi/react-draw
yarn add @jzohdi/react-draw

Usage

The example below creates a bare free draw area with no other tools or options. See demo

import { ReactDraw, freeDrawTool } from "@jzohdi/react-draw";

export default function MyComponent() {
  <div>
    <h1>Example page title</h1>
    <ReactDraw
      drawingTools={[freeDrawTool]}
      actionTools={[]}
      hideBottomBar={true}
      hideTopBar={true}
    >
      ... any child you want can go inside the drawing area.
    </ReactDraw>
  </div>;
}

Props

See docs for more info

export type ReactDrawProps = {
  children?: ReactChild;
  layout?: LayoutOption;
  drawingTools: DrawingTools[];
  hideTopBar?: boolean;
  actionTools: ActionTools[];
  hideBottomBar?: boolean;
  shouldKeepHistory?: boolean;
  shouldSelectAfterCreate?: boolean;
  id: string;
  styleComponents?: StyleComponents;
  menuComponents?: MenuComponent[];
};

Contributing

Pull requests or issues are welcome!

Local Development

Local development is done using storybook. After install dependencies:

npm run storybook

After changes are made create dist and docs:

npm run add

License

ISC, see License for details

Package Sidebar

Install

npm i @jzohdi/react-draw

Weekly Downloads

22

Version

0.9.29

License

ISC

Unpacked Size

230 kB

Total Files

9

Last publish

Collaborators

  • jzohdi