Signature padPro
Draw a signature with mouse, pen or finger; strokes thin with speed. Undo and clear.
pnpm dlx shadcn@latest add @lode/signature-padDraw with your mouse, finger or stylus. If you can't draw, type your name in the field your form provides instead.
When to use
- Agreements, delivery confirmations and consent forms.
When not to use
- As the only way to sign: offer a typed-name alternative for people who can't draw.
Installation
pnpm dlx shadcn@latest add @lode/signature-padPro components need an API key and the registry in components.json. See CLI and API keys.
1Install the dependencies
npm install motion lucide-react2Copy the source into your project
Usage
Import it from @/components/ui/signature-pad after installing.
import { SignaturePad } from "@/components/ui/signature-pad";
<SignaturePad onChange={(png) => setSignature(png)} />API reference
SignaturePad
A canvas you draw on with any pointer. Lines thin out as you move faster.
onChange
(dataUrl: string | null) => void
A PNG data URL after each stroke; null when cleared.
color
string
Ink color; defaults to the text color.
height= 180
number
Pad height in px.
label= "Signature"
string
Heading and accessible name.
| Prop | Type | Default | Description |
|---|---|---|---|
| onChange | (dataUrl: string | null) => void | – | A PNG data URL after each stroke; null when cleared. |
| color | string | – | Ink color; defaults to the text color. |
| height | number | 180 | Pad height in px. |
| label | string | "Signature" | Heading and accessible name. |
Keyboard interactions
| Keys | Action |
|---|---|
| Tab | Reach Undo and Clear |
Accessibility
- The canvas is an image labelled as empty or drawn.
- The hint tells people without a pointer to use a typed alternative.
Motion
- The "Sign here" hint fades out with the first stroke.
Responsive behavior
- Fills its container; redraws crisply on resize and high-DPI screens.
Performance
- Strokes are kept as points and redrawn only on resize or undo.
Notes for AI
- Upload the PNG data URL as a file; don't store it inline in a database row.
This page as Markdown, for assistants and coding agents:
/components/signature-pad/markdownThe full library index for assistants is at /llms.txt.
Related
Lode·229 doc pages·llms.txt