SignaturePad
A "Start Signing" pill morphs into a dashed card you draw in with your finger, with a pen following along. Finishing morphs it into a "Signing Done" pill with an edit button.
Preview
Installation
npx @codewithrabby/ui@latest add signature-padUsage
import { SignaturePad } from "@/components/uir/signature-pad";
<SignaturePad
onDone={(paths) => saveSignature(paths)}
labels={{ start: "Sign here" }}
/>
// render a saved signature
<Svg>
{paths.map((d, i) => <Path key={i} d={d} stroke="#111" fill="none" />)}
</Svg>Props
| Prop | Type | Default |
|---|---|---|
onDoneCalled with every stroke (SVG path strings) when signing is finished. | (paths: string[]) => void | — |
onChangeCalled when a stroke is added or the pad is cleared. | (paths: string[]) => void | — |
onCancelCalled when the card is closed with ×. Strokes are cleared. | () => void | — |
labelsButton and card texts. | { start?, finish?, done?, title? } | Start Signing… |
widthCard width while signing. | number | 270 |
heightCard height while signing. | number | 330 |
strokeColorInk colour. | string | "#111" |
strokeWidthInk thickness. | number | 2.4 |
buttonColorPill and edit button background. | string | "#f0f0f2" |
doneColor\"Signing Done\" pill colour. | string | "#111" |