UIR

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-pad

Usage

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

PropTypeDefault
onDone

Called with every stroke (SVG path strings) when signing is finished.

(paths: string[]) => void—
onChange

Called when a stroke is added or the pad is cleared.

(paths: string[]) => void—
onCancel

Called when the card is closed with ×. Strokes are cleared.

() => void—
labels

Button and card texts.

{ start?, finish?, done?, title? }Start Signing…
width

Card width while signing.

number270
height

Card height while signing.

number330
strokeColor

Ink colour.

string"#111"
strokeWidth

Ink thickness.

number2.4
buttonColor

Pill and edit button background.

string"#f0f0f2"
doneColor

\"Signing Done\" pill colour.

string"#111"