Default
Sign with the mouse, a finger or a pen. The brush swells where you lean on it.
Sign on the screen. One brush pen with real pressure, a pencil baseline with its x, a clear button, and a typed-name fallback that is set in hand lettering. It carries the image in a hidden field, so it works in a plain form and can be required.
npx shadcn@latest add @wobko/signature-padFirst time here? Add the registry to components.json first. How to install
Sign with the mouse, a finger or a pen. The brush swells where you lean on it.
The typed fallback: the name is hand lettering with a brush swash under it. Anyone who cannot draw gets a signature that is still an image.
A real form: the signature is a required field that posts as a data URL. Submit it empty to see the red baseline; sign and it goes through.
The root: a Sketchpad with one pen, plus the value. The value is a data URL (svg by default, png on request) that is empty until the person has signed; the detail argument carries the strokes, so a signature can be stored as JSON and drawn again later.
| Prop | Type | Default | Description |
|---|---|---|---|
| name | string | - | Form field name. A hidden input carries the data URL, so FormData and native submit just work. |
| value / defaultValue / onValueChange | string / (value: string, detail: { mode, strokes, text }) => void | - | The signature image as a data URL, or "". Controlled, the value is the truth: a value the pad did not produce (a saved signature loaded from a server, or "" from a reset) replaces whatever was drawn or typed and is shown as an image until the person signs again. A brush signature is about 40 KB as an svg data URL (22 KB of it is the embedded pen grain); store the strokes from `detail` if that matters. |
| required | boolean | - | An empty pad blocks the form's submit with the native validation, focuses the canvas (the name field in type mode) and shows the message. A form reset clears the pad and calls onValueChange(""). |
| invalid / message | boolean / string | "Please sign in the box." | A red baseline and a polite alert. Set automatically when a required form is submitted empty. |
| disabled / readOnly | boolean | - | Draw nothing. Read-only hides the buttons and shows the signature. |
| mode / defaultMode / onModeChange | "draw" | "type" | "draw" | Draw with a pointer or type the name. |
| typedFallback | boolean | true | Offer "Type instead": the name is hand-lettered as outlines (no font needed in the exported image). Also the way in for people who cannot draw. |
| penColor / pen | SketchColor / "brush" | "felt" | "ink-you" / "brush" | The brush swells on down-strokes like a fountain pen; the felt keeps an even line. |
| format | "svg" | "png" | "svg" | png is rasterized in the browser through a canvas; where that is not possible the svg is kept. |
| width / height | number | 480 / 180 | Canvas units; the pad scales to its container. |
The files the CLI copies into your project.
Loading the source