<fabric-canvas>
<fabric-canvas>
is a Web Component wrapper for the popular javascript library fabric.js.
- Declarative API
- Responsive canvas size
- fabric.js ES module
Live demo ↗ | API documentation ↗
Installation
Install fabric-canvas
:
npm i fabric-canvas --save
Usage
Import the web component in your application:
;
Or import the static version:
;
In order to use the fabric API to create shapes, you must import the fabric
module along with the web component:
;
Add the <fabric-canvas>
element to the page:
Adding Shapes
JS
API
const rect = top: 100 left: 100 width: 200 height: 200 fill: 'red'; document;
HTML
API
Running demo
-
Fork the
fabric-canvas
repository and clone it locally. -
Make sure you have npm installed.
-
When in the
fabric-canvas
directory, runnpm install
to install dependencies. -
Run
npm start
to open the demo.
License
This project is licensed under the MIT License.