Signature Pad React component
A signature field that draws smooth, pressure-aware ink, with undo, clear, a typed-signature option for people who can't draw, and PNG and SVG export in a paper-ready ink colour.
About the Signature Pad component
Signature Pad is a box people sign in with a mouse, a finger or a stylus. The ink gets thinner on fast strokes and thicker on slow ones, and responds to pen pressure where the device reports it, so a signature looks like real ink. A Draw and Type switch lets people type their name instead, shown in a handwriting-style face, and the last stroke can be undone or the pad cleared.
onChange returns the result after every change: isEmpty, a transparent PNG as a data URL, standalone SVG markup, the mode and the typed name. penColor sets the ink on screen, and exportColor the color used in the PNG and SVG (near-black by default), so a signature drawn on a dark page still prints on white paper. minWidth and maxWidth set the stroke range, height the pad height, allowTyping the Type option, and label, helperText, placeholder, size and width the frame.
When to use it
Use Signature Pad for contracts, delivery confirmations, consent forms, waivers and check-ins. The ink responds to speed and pen pressure, so a signature drawn with a finger or an Apple Pencil looks like ink rather than a flat line.
Always keep the Type option on unless you have a reason not to: people who use a keyboard, a screen reader or switch access can't draw, and a typed name is legally accepted as an electronic signature in most places. Store the image together with who signed, when and what they agreed to; the image alone doesn't prove much.
Installation
Add the Signature Pad component to your project with the shadcn CLI. It lands in components/signature-pad.tsx as plain React + Tailwind CSS source you own and can edit.
npx shadcn@latest add @reactframe/signature-padOr copy the source by hand and install its dependencies:
npm install motion clsx tailwind-mergeProps
<SignaturePad /> accepts 15 props, all optional.
| Prop | Type | Default |
|---|---|---|
| onChange | (result: SignatureResult) => void | — |
| label | string | — |
| helperText | string | — |
| placeholder | string | "Sign here" |
| allowTyping Offer a "Type" tab that renders the typed name in a script face. | boolean | true |
| penColor Ink colour on screen; defaults to the theme's text colour. | string | — |
| exportColor Colour used in the exported PNG and SVG, so a signature drawn in dark mode still shows on white paper. | string | "#0A0A0A" |
| minWidth | number | 1.1 |
| maxWidth | number | 3.4 |
| height | number | 200 |
| size | "sm" | "md" | "lg" | "md" |
| theme | "dark" | "light" | "dark" |
- onChange(result: SignatureResult) => void
- labelstring
- helperTextstring
- placeholderstringDefault: "Sign here"
- allowTyping
Offer a "Type" tab that renders the typed name in a script face.
booleanDefault: true - penColor
Ink colour on screen; defaults to the theme's text colour.
string - exportColor
Colour used in the exported PNG and SVG, so a signature drawn in dark mode still shows on white paper.
stringDefault: "#0A0A0A" - minWidthnumberDefault: 1.1
- maxWidthnumberDefault: 3.4
- heightnumberDefault: 200
- size"sm" | "md" | "lg"Default: "md"
- theme"dark" | "light"Default: "dark"
Show all 15 propsShow fewer
| width | number | string | 440 |
| disabled | boolean | false |
| className | string | — |
- widthnumber | stringDefault: 440
- disabledbooleanDefault: false
- classNamestring
npm dependencies
Installed for you by the shadcn CLI.
Signature Pad FAQ
- What format does it export?
- Both a transparent PNG (as a data URL) and standalone SVG markup, in exportColor (near-black by default) so a signature drawn on a dark page still shows on a white PDF.
- Does it work on phones and tablets?
- Yes. It uses pointer events with touch scrolling disabled on the pad, and it reads pen pressure from a stylus when the device reports it.
- Can people type instead of drawing?
- Yes. The Draw / Type switch lets them type their name, which is shown and exported in a script face. Turn it off with allowTyping={false}.
- Why does the typed signature look different on Windows?
- The typed name uses the device's handwriting fonts (Snell Roundhand on Apple devices, Segoe Script on Windows, then others), so it looks a little different on each system. Load a script web font and set it in the component if it must look the same everywhere.