Blocks / Signature pad

Signature pad

Draw, type or upload a signature; a PNG data URL out. A pen for the keyboard.

import { SignaturePad, signatureBlob, SIGNATURE_FONTS } from "@forgeron/ui";
/01 → Default

Draw with a pointer. From the keyboard: Space puts the pen down or lifts it, the arrows move it, Backspace undoes. Or use the Type or Upload tab.

Nothing signed yet
import { SignaturePad, type SignatureValue } from "@forgeron/ui";
import { useState } from "react";

export default function Default() {
  const [value, setValue] = useState<SignatureValue | null>(null);
  return (
    <div style={{ display: "grid", gap: 8, width: "100%", maxWidth: 560 }}>
      <SignaturePad label="Your signature" value={value} onChange={setValue} />
      <span style={{ color: "var(--ink-dim)", font: "400 11px/16px var(--font-mono)" }}>
        {value ? `${value.method} · ${value.dataUrl.slice(0, 30)}…` : "Nothing signed yet"}
      </span>
    </div>
  );
}
API → Props
PropTypeDefaultDescription
value / defaultValue / onChange{ dataUrl, method, text?, font? } | null—The signature: PNG data URL (SVG without a canvas). null when cleared.
modes / mode / onModeChange("draw" | "type" | "upload")[]all threeThe ways to sign, in order.
fonts{ id, label, family, italic? }[]SIGNATURE_FONTSThe fonts of the Type tab (system fonts).
inkstring—Colour of the exported image; dark by default, whatever the theme.
maxUploadSizenumber2 MBBiggest image on the Upload tab, in bytes.
label / defaultText / disabledstring; string; boolean—Name, first typed name, off.
classNamestring—Extra classes.