{"id":16513699,"url":"https://github.com/nitin42/react-handy-renderer","last_synced_at":"2025-10-13T04:32:39.729Z","repository":{"id":87330582,"uuid":"121219821","full_name":"nitin42/react-handy-renderer","owner":"nitin42","description":"✏️  Draw 2D primitives in sketchy style with React","archived":false,"fork":false,"pushed_at":"2018-02-12T12:09:03.000Z","size":54,"stargazers_count":60,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-03T18:52:58.442Z","etag":null,"topics":["canvas","colors","primitives","react","shapes","sketch"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nitin42.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-12T08:26:01.000Z","updated_at":"2024-07-25T18:12:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"9b1a89fe-673a-4ee7-972e-314e87908383","html_url":"https://github.com/nitin42/react-handy-renderer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nitin42/react-handy-renderer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitin42%2Freact-handy-renderer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitin42%2Freact-handy-renderer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitin42%2Freact-handy-renderer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitin42%2Freact-handy-renderer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nitin42","download_url":"https://codeload.github.com/nitin42/react-handy-renderer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitin42%2Freact-handy-renderer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279013685,"owners_count":26085390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["canvas","colors","primitives","react","shapes","sketch"],"created_at":"2024-10-11T16:09:59.659Z","updated_at":"2025-10-13T04:32:39.693Z","avatar_url":"https://github.com/nitin42.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-handy-renderer\n\n\u003e ***✏️ \u0026nbsp; Draw 2D primitives in sketchy style with React***\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://i.gyazo.com/470b052326829e7749197f40f545b5d6.png\" /\u003e\n\u003c/p\u003e\n\n## Motivation\n\n[Theory on design and effects of sketchy rendering](http://openaccess.city.ac.uk/1274/)\n\n## Demo\n\nYou can find the demo [here](https://codesandbox.io/s/nrpq071nwm) on CodeSandbox (switch on \"module view\" on the top right and go to /demo)\n\n## Install\n\n```\nnpm install react-handy-renderer\n```\n\n## Usage\n\n`react-handy-renderer` exposes a set of **five** primitives:\n\n* **Rectangle**\n* **RoundedRect**\n* **Line**\n* **Curve**\n* **Ellipse**\n\nand one wrapper component called **Paper** which serves as a canvas on which these primitives are drawn.\n\nHere is a basic example -\n\n```js\nimport React from 'react';\nimport { render, Paper, Ellipse } from 'react-handy-renderer';\n\nfunction Sketch() {\n  return (\n    \u003cPaper bowing={0.2} width={600} height={500}\u003e\n      \u003cEllipse\n        position={{ x: 480, y: 100 }}\n        width={50}\n        height={50}\n        color=\"mistyrose\"\n        weight={0.9}\n        roughness={3}\n      /\u003e\n    \u003c/Paper\u003e    \n  );\n}\n\nrender(\u003cSketch /\u003e, document.getElementById('canvas-container'));\n```\n\n## Examples\n\n### RoundedRect\n\n![bounded-rect](https://i.gyazo.com/f1602364b59f2e13a371e52de7ba92af.png)\n\n```js\n\u003cRoundedRect\n  position={{ x: 300, y: 100 }}\n  width={50}\n  height={50}\n  color=\"red\"\n  weight={2}\n  radius={2}\n  roughness={1.8}\n/\u003e\n```\n\n### Rectangle\n\n![rectangle](https://gyazo.com/7d55a47ef9bb1d47159d91efe6ad8550.png)\n\n```js\n\u003cRectangle\n  position={{ x: 390, y: 100 }}\n  width={50}\n  height={50}\n  color=\"green\"\n  weight={1}\n  roughness={2.3}\n/\u003e\n```\n\n### Ellipse\n\n![ellipse](https://i.gyazo.com/c6946d28eac3770f8301ecc123c3ab94.png)\n\n```js\n\u003cEllipse\n  position={{ x: 480, y: 100 }}\n  width={50}\n  height={50}\n  color=\"blue\" // or color={[10, 10, 10, 20]}\n  weight={0.9}\n  roughness={3}\n  bowing={9}\n  maxOffset={10}\n/\u003e\n```\n\n### Line\n\n![line](https://gyazo.com/4d23913e79fa6b0e9ffe9d72a251df68.png)\n\n```js\n\u003cLine\n  from={{ x: 230, y: 140 }}\n  to={{ x: 530, y: 140 }}\n  weight={4}\n  color=\"mistyrose\"\n  roughness={2}\n/\u003e\n```\n\n### Curve\n\n![curve](https://i.gyazo.com/26a679011206d25e195afafc029ab111.png)\n\n```js\n\u003cCurve\n  c1={{ x: 30, y: 50 }}\n  c2={{ x: 70, y: 90 }}\n  c3={{ x: 130, y: 510 }}\n  c4={{ x: 230, y: 200 }}\n  color=\"blue\"\n  weight={2}\n  roughness={2}\n/\u003e\n```\n\n## Usage with ReactDOM renderer\n\nYou can also render the primitives when working with ReactDOM as this just renders to a canvas node.\n\nExample -\n\n```js\nimport React, { Component } from 'react'\nimport {\n  render as create,\n  Paper,\n  Rectangle,\n  Main,\n  Ellipse,\n  Line,\n  RoundedRect,\n  Curve,\n} from 'react-handy-renderer'\n\nfunction Sketch() {\n  return (\n    \u003cPaper bowing={0.2} width={500} height={500}\u003e\n      \u003cLine\n        from={{x: 10, y: 40}}\n        to={{x: 40, y: 60}}\n        weight={10}\n        color=\"red\"\n      /\u003e\n    \u003c/Paper\u003e\n  )\n}\n\n// Renders the canvas node\ncreate(\u003cSketch /\u003e, document.getElementById('root'))\n\n// create function has already rendered the canvas node.\n// So now you can continue to use React with ReactDOM as you used to.\n// Make changes directly to the \u003cSketch /\u003e component.\nclass App extends Component {\n  render() {\n    return (\n      \u003cdiv\u003e\n        REACT HANDY RENDERER\n      \u003c/div\u003e\n    )\n  }\n}\n\nexport default App\n```\n\n## API\n\n### Paper\n\nWrapper component for creating the canvas.\n\n**Props**\n\n* `width` - width of the canvas\n\n* `height` - height of the canvas\n\n* `roughness` - Number value for changing the roughness of shapes\n\n* `bowing` - Number value for changing the bowing of lines\n\n* `maxOffset` - Number value for giving coordinates an offset,\n\n[Example](#usage)\n\n### Curve\n\n**Props**\n\n* `c1` - First control point's `x` and `y` coordinate values\n\n* `c2` - Second control point's `x` and `y` coordinate values\n\n* `c3` - Third control point's `x` and `y` coordinate values\n\n* `c4` - Fourth control point's `x` and `y` coordinate values\n\n* `roughness` - Number value for changing the roughness\n\n* `bowing` - Number value for changing the bowing of lines\n\n* `maxOffset` - Number value for giving coordinates an offset,\n\n* `color` - String value for color\n\n[Example](#curve)\n\n### Ellipse\n\n**Props**\n\n* `position` - It is an object that takes `x` and `y` coordinate values.\n\n* `width` - defines width\n\n* `height` - defines height\n\n* `color` - sets the color for stroke\n\n* `weight` - sets the stroke thickness\n\n* `roughness` - Number value for changing the roughness\n\n* `bowing` - Number value for changing the bowing of lines\n\n* `maxOffset` - Number value for giving coordinates an offset,\n\n* `fill` - sets the fill color for filling the ellipse\n\n[Example](#ellipse)\n\n### Rectangle\n\n**Props**\n\n* `position` - It is an object that takes `x` and `y` coordinate values.\n\n* `width` - defines width\n\n* `height` - defines height\n\n* `color` - sets the color for stroke\n\n* `weight` - sets the stroke thickness\n\n* `roughness` - Number value for changing the roughness\n\n* `bowing` - Number value for changing the bowing of lines\n\n* `maxOffset` - Number value for giving coordinates an offset,\n\n[Example](#rectangle)\n\n### RoundedRect\n\n**Props**\n\n* `position` - It is an object that takes `x` and `y` coordinate values.\n\n* `width` - defines width\n\n* `height` - defines height\n\n* `radius` - sets the radius\n\n* `color` - sets the color for stroke\n\n* `weight` - sets the stroke thickness\n\n* `roughness` - Number value for changing the roughness\n\n* `bowing` - Number value for changing the bowing of lines\n\n* `maxOffset` - Number value for giving coordinates an offset,\n\n[Example](roundedrect)\n\n### Line\n\n**props**\n\n* `from` - An object that takes `x1` and `y1` coordinate value.\n\n* `to` - An object that takes `x2` and `y2` value\n\n* `color` - sets the color for stroke\n\n* `weight` - sets the stroke thickness\n\n* `roughness` - Number value for changing the roughness\n\n* `bowing` - Number value for changing the bowing of lines\n\n* `maxOffset` - Number value for giving coordinates an offset,\n\n[Example](#line)\n\n## Todo\n\n- [ ] Define hachures\n- [ ] More examples\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitin42%2Freact-handy-renderer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnitin42%2Freact-handy-renderer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitin42%2Freact-handy-renderer/lists"}