Signature Pad React component for Tailwind CSS v4
v1.0.0Added in 1.0.0
A React signature pad: draw with a finger, pen or mouse in ink that thins with speed, or type a name, then export it as PNG or SVG.
Draw on the dashed area with a finger, a stylus or the mouse: the ink follows the pointer at full frame rate, gets thinner when you move fast and thicker when you slow down, and a tap leaves a dot. The page still scrolls when you swipe outside the area. The placeholder fades away with the first stroke and a small frosted toolbar fades in at the top corner with Undo (removes the last stroke) and Clear (removes everything); on touch screens each is a 44px target and long press shows its name. Tab reaches the Draw / Type switch first (arrows move between the two), then the drawing area: there mod+z undoes the last stroke and Delete or Backspace clears it, and a screen reader hears Signature added and Signature cleared. Type switches to a name field: the name appears on the baseline in a handwriting font and shrinks to fit when it is long. The ink is the text color on screen (white in dark mode) and repaints when the theme changes; exports are always dark ink on a transparent background, cropped to the signature. Rotating a phone keeps the signature, scaled to fit the new size. Read-only shows the saved signature as an image without the toolbar.
Signature Pad is a Pro React component in the React input components category, written in TypeScript for React 19 and Tailwind CSS v4. It installs as source with npx wingo-ui@latest add signature-pad, together with Field, Button, Segmented Control, Input, Tooltip and 4 more and the npm packages signature_pad, motion and lucide-react.
Add to a project
Requirements: React 19 and Tailwind CSS v4, in Next.js (App Router or Pages), Vite or React Router. Installation guide · Next.js setup · Vite setup
npx wingo-ui@latest add signature-padSignature Pad is part of Pro, with 298 more Pro items: $8 a month or $150 once. 14-day refund before you download any Pro item. See plans
Usage
Import SignaturePad from @/components/ui/signature-pad.
import { useState } from "react"
import { Button } from "@/components/ui/button"
import { SignaturePad, isSignatureEmpty, type SignatureData, type SignaturePadApi } from "@/components/ui/signature-pad"
export function ConfirmDelivery() {
const [signature, setSignature] = useState<SignatureData | null>(null)
const [api, setApi] = useState<SignaturePadApi | null>(null)
const confirm = async () => {
const png = await api?.toBlob()
if (png) console.log("Signature", png.size, "bytes")
}
return (
<div className="flex max-w-md flex-col gap-4">
<SignaturePad
label="Recipient signature"
description="Sign with your finger or mouse"
required
value={signature}
onValueChange={setSignature}
setApi={setApi}
placeholder="Sign here"
fileName="Recipient signature"
/>
<Button size="lg" disabled={isSignatureEmpty(signature)} onClick={confirm}>
Confirm delivery
</Button>
</div>
)
}Props
valueSignatureData | null ({ kind: "drawn"; strokes: SignatureStroke[]; width: number; height: number } | { kind: "typed"; text: string; font: string })The controlled signature; null when empty. Drawn strokes are in css px of a width x height box and are scaled by width when shown at another size, so a signature saved on a phone fits a desktop pad.
defaultValuedefault"null"SignatureData | nullThe uncontrolled start, for example a saved signature. A form reset puts it back.
onValueChange(value: SignatureData | null) => voidFires when a stroke ends (never per point), after undo and clear, when the mode switches and as you type.
onEnd() => voidA stroke finished.
modesdefault"["draw", "type"]"SignatureMode[] ("draw" | "type")The ways to sign. With one entry the Draw / Type switch is hidden. Type is the keyboard and screen reader path, so keep it unless another one exists.
mode"draw" | "type"The controlled mode. A typed value from outside switches to type, a drawn one to draw.
onModeChange(mode: SignatureMode) => voidThe person switched between Draw and Type.
defaultModedefault"draw""draw" | "type"The uncontrolled starting mode. Each mode keeps its own draft, so switching back restores the strokes or the name.
labeldefault""ReactNodeThe field label. It names the drawing area (aria-labelledby) and becomes the name field's label in type mode; a click on it focuses the pad.
descriptiondefault""ReactNodeHelper text under the pad, linked with aria-describedby. The error takes its place while it shows.
errordefault""ReactNodeReplaces the description with the animated error, rings the surface red and sets aria-invalid.
placeholderdefault"Sign here"stringCentered in the empty surface above the baseline; fades out with the first stroke. Empty shows nothing.
variantdefault"outline""soft" | "outline"outline is a dashed 2px zone (a signing area reads as a place to act), soft is the filled field look for forms full of soft inputs.
sizedefault"md""sm" | "md" | "lg"The label, the typed name field (32 / 40 / 48px) and the switch and toolbar buttons (lg gets 40px buttons).
radiusdefault"md""none" | "sm" | "md" | "lg" | "full"The surface corners: none, 12px, 16px (md), 24px; full falls back to 24px. The name field takes the same radius.
heightdefault200numberSurface height in px; the width is the container's. 200 fits a phone, 240 is roomy for couriers.
penColordefault"currentColor"stringThe ink on screen. currentColor reads the surface's text color (the foreground token, so white ink in dark mode) and repaints on theme changes; set classNames.surface to a text color class for a themed ink. Strokes drawn with a custom color keep it.
exportColordefault"#111111"stringThe ink in every export, whatever the theme: dark ink on a transparent background reads on any document. #1F3A93 is a classic blue pen.
minWidthdefault0.8numberThe thinnest stroke in px, reached on fast movements (signature_pad).
maxWidthdefault2.8numberThe thickest stroke in px, reached on slow movements and dots.
velocityFilterWeightdefault0.7numberHow much the previous speed smooths the next width, 0 to 1 (signature_pad). Higher is calmer ink.
guidedefaulttruebooleanA dashed baseline at 72% of the height with a × at its start, where people expect to sign.
typedFontdefault""Segoe Script", "Snell Roundhand", "Brush Script MT", "Apple Chancery", cursive"stringThe typed signature's font stack. System fonts only, nothing downloads; exports use the same stack. Exported as DEFAULT_SIGNATURE_FONT for rendering a typed signature elsewhere (a PDF, an email).
showToolbardefaulttruebooleanUndo and Clear at the top corner of the drawing area, shown once there is ink (type mode clears from the name field). Off when your own buttons do it through the api.
trimExportdefaulttruebooleanExports crop to the signature's bounds plus 12px of padding. Off keeps the full pad box, the signature where it was drawn.
fileNamedefault"signature"stringThe base name for api.download(), with the local date and time appended ("Signature-2026-09-24-1640.png").
setApi(api: SignaturePadApi) => voidCalled after mount and whenever the export settings change. SignaturePadApi: clear(), undo(), isEmpty(), getValue(), toBlob({ type, quality, trim, padding = 12, scale = 2, background, color }), toSVG({ trim, padding, background, color }), toDataURL(type = "image/png" | "image/svg+xml"), download({ format = "png" | "svg", ...toBlob options }) resolving with the file name.
requireddefaultfalsebooleanThe red mark after the label and aria-required. The check itself belongs to your form: isSignatureEmpty(value), exported by the file, is true for null, no strokes or a blank typed name.
invaliddefaultfalsebooleanThe invalid look (a red ring and a red dashed border) and aria-invalid without a message.
disableddefaultfalsebooleanDims to 50%, the pen stops listening, no toolbar, the switch and the name field are disabled.
readOnlydefaultfalsebooleanShows the signature as an image (role="img", named by the label and, for a typed one, the name) without the switch, the name field or the toolbar.
namedefault""stringForm field name: a hidden input carries the signature as a PNG data url (export color, trimmed), updated after each stroke. A form reset puts defaultValue back.
idstringThe drawing area's id (the name field's in type mode). Defaults to useId(); the label points at it.
fieldPropsPartial<FieldProps>Anything else for the Field wrapper: optional, labelAction, orientation, labelWidth, hideLabel.
labelsPartial<SignaturePadLabels>Every visible and announced string: draw, type, modes, typePlaceholder, undo, clear, canvas, canvasHint, signature, added, undone, cleared, empty, downloaded(fileName). English defaults in DEFAULT_SIGNATURE_PAD_LABELS.
classNamesPartial<Record<"root" | "modes" | "surface" | "canvas" | "typed" | "input" | "preview" | "guide" | "placeholder" | "toolbar" | "button" | "field" | "label" | "description" | "error" | "counter", string>>Extra classes for the inner parts. A text color on surface is the on-screen ink when penColor is currentColor.
Parts
isSignatureEmpty
functionisSignatureEmpty(value): true for null, a drawn value with no strokes or a typed value with a blank name. Use it to gate a submit button or a required check.
DEFAULT_SIGNATURE_PAD_LABELS
constantThe English strings for the switch, toolbar, placeholders and screen reader announcements. Spread it and override a few keys through labels.
DEFAULT_SIGNATURE_FONT
constantThe system script font stack typed signatures use by default. Reuse it to render a typed signature in a PDF or an email.
SignatureData
typeThe saved value: { kind: "drawn", strokes, width, height } or { kind: "typed", text, font }. Store it as JSON to show the signature again later.
SignaturePadApi
typeWhat setApi hands you: clear, undo, isEmpty, getValue, toBlob, toSVG, toDataURL and download.
SignaturePadProps
typeThe props of SignaturePad, for wrappers that pass them through.
Examples
Typed signature
Type mode with a script font, exported as a PNG.
Courier delivery
A phone-sized screen: a taller pad and a confirm button that waits for ink.
Blue ink
exportColor #1F3A93 with a wider pen; on screen the ink follows a themed text color.
Read-only
A saved signature with the signing date, shown as an image.
Validation
Required: sending without a signature shows the error.
Soft, in a form
variant soft next to soft inputs.
Dependencies
Files
- components/ui/signature-pad.tsx
FAQ
Is the React Signature Pad component free?
The preview, props and docs are free; copying the source needs a Pro plan. See plans.
How do I install Signature Pad?
Run npx wingo-ui@latest add signature-pad. It also adds the Wingo UI items it builds on (Field, Button, Segmented Control, Input, Tooltip and 4 more) and the npm packages signature_pad, motion and lucide-react. With shadcn, add the @wingo-ui registry with your API key, then run npx shadcn@latest add @wingo-ui/signature-pad.
See also
More React input components
Articles using this component
- React Signature Pad: Smooth Ink, Typed Mode, PNG and SVG
Component guides9 min read