0.0.7 • Published 8 years ago

react-signature-pad-input v0.0.7

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

npm package

History

This module is forked from blackjs' initial module for capturing signatures. This module differs by allowing you to embed this signature pad within an existing form without a popup window.

React Signature Pad

A signature pad implementation for react.

Basic Usage

var React = require('react');
var SignaturePad = require('react-signature-pad');

React.render(
  <SignaturePad clearButton="true" />,
  document.body
)

Methods

<SignaturePad clearButton="true" ref="mySignature" />
...

var signature = React.findDOMNode(this.refs.mySignature);

// Methods

// ===============================================
// isEmpty() - returns boolean
// ===============================================

signature.isEmpty();

// ===============================================
// clear() - clears canvas
// ===============================================

signature.clear();

// ===============================================
// toDataURL() - retrieves image as a data url
// ===============================================

signature.toDataURL();

// ===============================================
// fromDataURL() - writes a base64 image to canvas
// ===============================================

signature.fromDataURL(base64String);

CSS

In order to make the signature pad work correctly you will need the css as well. All the relevant styles are in this file.

Example

$ npm start

Then navigate to http://localhost:8080/ in your browser and you should be able to see the signature pad in action.