Gathering detailed insights and metrics for react-signature-canvas
Gathering detailed insights and metrics for react-signature-canvas
Gathering detailed insights and metrics for react-signature-canvas
Gathering detailed insights and metrics for react-signature-canvas
@types/react-signature-canvas
TypeScript definitions for react-signature-canvas
react-native-signature-canvas
React Native Signature Component based Canvas for Android && IOS && expo
smooth-signature
前端H5带笔锋手写签名,支持PC端和移动端,无框架限制,Vue、React等均可使用
react-native-signature-pad
React Native wrapper around szimek's Canvas based Signature Pad
A React wrapper component around signature_pad (in < 150 LoC). 100% test coverage, types, examples, & more. Unopinionated and heavily updated fork of react-signature-pad
npm install react-signature-canvas
Typescript
Module System
Node Version
NPM Version
91.2
Supply Chain
92.3
Quality
78.2
Maintenance
100
Vulnerability
100
License
v1.1.0-alpha.2: add `exports.types` to `package.json`
Updated on Mar 29, 2025
v1.1.0-alpha.1: native TypeScript release
Updated on Feb 15, 2025
v1.0.7: peerDeps support for React 19
Updated on Jan 03, 2025
v1.0.6: peerDeps support for React 18
Updated on Jun 16, 2022
v1.0.5: peerDeps support for React 17
Updated on Feb 09, 2022
v1.0.4: same as v1.0.3, botched release. see v1.0.5 instead
Updated on Feb 09, 2022
TypeScript (83.58%)
JavaScript (13.22%)
CSS (2.36%)
HTML (0.84%)
Total Downloads
38,867,332
Last Day
10,179
Last Week
351,858
Last Month
1,411,403
Last Year
14,235,439
NOASSERTION License
589 Stars
153 Commits
125 Forks
5 Watchers
9 Branches
1 Contributors
Updated on Jun 03, 2025
Minified
Minified + Gzipped
Latest Version
1.1.0-alpha.2
Package Id
react-signature-canvas@1.1.0-alpha.2
Unpacked Size
40.93 kB
Size
11.84 kB
File Count
10
NPM Version
10.9.2
Node Version
22.14.0
Published on
Mar 29, 2025
Cumulative downloads
Total Downloads
Last Day
-5.4%
10,179
Compared to previous day
Last Week
-2.1%
351,858
Compared to previous week
Last Month
4.6%
1,411,403
Compared to previous month
Last Year
43.8%
14,235,439
Compared to previous year
5
31
A React wrapper component around signature_pad.
Originally, this was just an unopinionated fork of react-signature-pad that did not impose any styling or wrap any other unwanted elements around your canvas -- it's just a wrapper around a single canvas element!
Hence the naming difference.
Nowadays, this repo / library has significantly evolved, introducing new features, fixing various bugs, and now wrapping the upstream signature_pad
to have its updates and bugfixes baked in.
This fork also allows you to directly pass props to the underlying canvas element, has new, documented API methods you can use, has new, documented props you can pass to it, has a live demo, has a CodeSandbox playground, has 100% test coverage, and is written in TypeScript.
1npm i -S react-signature-canvas
1import React from 'react' 2import { createRoot } from 'react-dom/client' 3import SignatureCanvas from 'react-signature-canvas' 4 5createRoot( 6 document.getElementById('my-react-container') 7).render( 8 <SignatureCanvas penColor='green' 9 canvasProps={{width: 500, height: 200, className: 'sigCanvas'}} />, 10)
The props of SignatureCanvas mainly control the properties of the pen stroke used in drawing. All props are optional.
velocityFilterWeight
: number
, default: 0.7
minWidth
: number
, default: 0.5
maxWidth
: number
, default: 2.5
minDistance
: number
, default: 5
dotSize
: number
or function
,
default: () => (this.minWidth + this.maxWidth) / 2
penColor
: string
, default: 'black'
throttle
: number
, default: 16
There are also two callbacks that will be called when a stroke ends and one begins, respectively.
onEnd
: function
onBegin
: function
Additional props are used to control the canvas element.
canvasProps
: object
<canvas />
elementbackgroundColor
: string
, default: 'rgba(0,0,0,0)'
clear
convenience method (which itself is called internally during resizes)clearOnResize
: bool
, default: true
Of these props, all, except for canvasProps
and clearOnResize
, are passed through to signature_pad
as its options.
signature_pad
's internal state is automatically kept in sync with prop updates for you (via a componentDidUpdate
hook).
All API methods require a ref to the SignatureCanvas in order to use and are instance methods of the ref.
1import React, { useRef } from 'react' 2import SignatureCanvas from 'react-signature-canvas' 3 4function MyApp() { 5 const sigCanvas = useRef(null); 6 7 return <SignatureCanvas ref={sigCanvas} /> 8}
isEmpty()
: boolean
, self-explanatoryclear()
: void
, clears the canvas using the backgroundColor
propfromDataURL(base64String, options)
: void
, writes a base64 image to canvastoDataURL(mimetype, encoderOptions)
: base64string
, returns the signature image as a data URLfromData(pointGroupArray)
: void
, draws signature image from an array of point groupstoData()
: pointGroupArray
, returns signature image as an array of point groupsoff()
: void
, unbinds all event handlerson()
: void
, rebinds all event handlersgetCanvas()
: canvas
, returns the underlying canvas ref.
Allows you to modify the canvas however you want or call methods such as toDataURL()
getTrimmedCanvas()
: canvas
, creates a copy of the canvas and returns a trimmed version of it, with all whitespace removed.getSignaturePad()
: SignaturePad
, returns the underlying SignaturePad reference.The API methods are mostly just wrappers around signature_pad
's API.
on()
and off()
will, in addition, bind/unbind the window resize event handler.
getCanvas()
, getTrimmedCanvas()
, and getSignaturePad()
are new.
You can interact with the example in a few different ways:
Run npm start
and navigate to http://localhost:1234/.
Hosted locally via the example/
directory
View the live demo here.
Hosted via the gh-pages
branch, a standalone version of the code in example/
Play with the CodeSandbox here.
Hosted via the codesandbox-example
branch, a slightly modified version of the above.
No vulnerabilities found.
Reason
7 commit(s) and 6 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
all dependencies are pinned
Details
Reason
license file detected
Details
Reason
4 existing vulnerabilities detected
Details
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-02
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More