Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/react-signature-canvas

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/react-signature-canvas

TypeScript definitions for react-signature-canvas

  • 1.0.6
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
105K
decreased by-20.21%
Maintainers
0
Weekly downloads
 
Created

What is @types/react-signature-canvas?

@types/react-signature-canvas provides TypeScript definitions for the react-signature-canvas package, which is a React wrapper for the signature_pad library. This package allows you to easily integrate a signature canvas into your React applications, enabling users to draw signatures or other freehand drawings.

What are @types/react-signature-canvas's main functionalities?

Basic Signature Canvas

This code demonstrates how to set up a basic signature canvas using the react-signature-canvas package. The canvas allows users to draw signatures with a black pen.

import React from 'react';
import SignatureCanvas from 'react-signature-canvas';

const SignaturePad = () => {
  let sigPad = React.useRef(null);

  return (
    <div>
      <SignatureCanvas ref={(ref) => { sigPad = ref; }} penColor='black' canvasProps={{width: 500, height: 200, className: 'sigCanvas'}} />
    </div>
  );
};

export default SignaturePad;

Clear Signature Canvas

This code adds a button to clear the signature canvas. When the button is clicked, the clear function is called, which clears the canvas.

import React from 'react';
import SignatureCanvas from 'react-signature-canvas';

const SignaturePad = () => {
  let sigPad = React.useRef(null);

  const clear = () => {
    sigPad.clear();
  };

  return (
    <div>
      <SignatureCanvas ref={(ref) => { sigPad = ref; }} penColor='black' canvasProps={{width: 500, height: 200, className: 'sigCanvas'}} />
      <button onClick={clear}>Clear</button>
    </div>
  );
};

export default SignaturePad;

Save Signature as Image

This code adds a button to save the signature as an image. When the button is clicked, the save function is called, which logs the data URL of the signature image to the console.

import React from 'react';
import SignatureCanvas from 'react-signature-canvas';

const SignaturePad = () => {
  let sigPad = React.useRef(null);

  const save = () => {
    const dataURL = sigPad.toDataURL();
    console.log(dataURL);
  };

  return (
    <div>
      <SignatureCanvas ref={(ref) => { sigPad = ref; }} penColor='black' canvasProps={{width: 500, height: 200, className: 'sigCanvas'}} />
      <button onClick={save}>Save</button>
    </div>
  );
};

export default SignaturePad;

Other packages similar to @types/react-signature-canvas

FAQs

Package last updated on 23 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc