1.0.2 • Published 6 years ago
preact-fabric v1.0.2
preact-fabric
Simple and lightweight Fabric.js component for Preact; for :atom_symbol: Preact
Usage
const { h, Component, render } = require("preact");
import Fabric from "preact-fabric";
class Demo extends Component {
constructor() {
super();
}
render() {
return (
<div>
<Fabric
config={{
isDrawingMode: true,
}}
style={{
border: '1px solid #000',
}}
attrs={{
width: '300px',
height: '300px',
}}
init={canvas => {
canvas.setBackgroundColor('#0fa', canvas.renderAll.bind(canvas));
}}
/>
</div>
);
}
}
render(<Demo />, document.body);
Install
$ npm install --save preact-fabric
<script src="https://unpkg.com/preact-fabric@1.0.0/dist/preact-fabric.min.js"></script>
Properties
config
Type: Object
style
Type: Object
attrs
Type: Object
init
Type: Function
License
MIT © Ahmet Şimşek