Signature Pad

View as Markdown

Sign with a finger, a pen or the mouse, or type your name instead, with Undo and Clear.

Master services agreement between Northwind Ltd and Checkout Studio, effective 1 January 2027.

Your signature
×Ada Okafor, Head of ProductSign here

By signing you agree to the terms above.

When to use

Sign with a finger, a pen or the mouse, or type your name instead, with Undo and Clear. Use File Field instead when people upload a signed document instead.

Usage

import { SignaturePad } from "./ui/uicontext/components/SignaturePad.ts"
const Message = UiSchema.TaggedEnum({ Signed: { path: Schema.String, text: Schema.String } })export const Delivery = (h: Html.H<typeof Message.Type>) =>	SignaturePad(h, { key: "delivery", props: { label: "Received by" }, onEmit: { Changed: ({ path, text }) => Message.Signed({ path, text }) } })

Examples

Proof of delivery

Changed fires after each stroke, so the app knows at once whether there's a signature.

Parcel 3 of 3 · 12 Rua das Flores, Porto

Received by
×Sign here

Waiting for a signature.

API reference

Props

SignaturePad props
NameTypeDefaultDescription
idstring"signature"Names the pad's parts on the page; "signature" by default
labelrequiredstring—What's being signed for, above the pad: "Signature"
hintstring—Under the pad: "By signing you agree to the terms above."
namestring—The signer's name, shown on the line and offered when typing
disabledboolean——
invalidboolean—Says the pad must be signed

Events

SignaturePad events
EventPayloadDescription
Changed{ mode: "draw" | "type"; path: string; text: string }The signature now: drawn strokes as a path in a 600 by 200 box, or a typed name; both empty when cleared

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/signature-pad

Source