1.0.2 • Published 6 years ago

preact-fabric v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

preact-fabric

Simple and lightweight Fabric.js component for Preact; for :atom_symbol: Preact

Usage

fabric.js

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);

Edit kw0lql5ylv

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

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago