Components / Signature Capture

Signature

Signature Capture

Type a name or draw. The typed name shows in a script face on a signing line, as it will look in the document.

  • @signnative/ui
  • MIT
  • Client only · no backend

A typed or drawn signature is a picture, not an identity check.

Theme
The CSS variables this sets
:root {
  --signing-accent: #3157e8;
  --sig-accent: #3157e8;
  --sig-accent-soft: color-mix(in oklab, #3157e8 14%, white);
  --sig-radius: 8px;
  --radius-control: 8px;
  --radius-panel: 12px;
  --font-sans: var(--font-inter), ui-sans-serif, system-ui, sans-serif;
}

In the signer page kit, set the accent with accentProps(accent) on the element around the surface; it sets data-signing-accent and --signing-accent. The secure elements take the same values as a checked appearance object instead.

Type or draw

A prefilled name is reported once, on mount, so the person can adopt it as it is.

Your signature

Style

onChange: null

Empty, with Undo and a smaller pad

Your signature

Style

On a signing line

SignaturePreview shows what was captured; inside SignatureLine a drawing sits on the line exactly as drawn.

Your signature

Style

What the document field shows

Empty

Inside a card with its own heading

Adopt your signature

The card has its own heading, so the capture has none.

Style

Other wording

Signature

Pick a style

Phone width

Your signature

Style

Installation

npx shadcn@latest add …

Not published yet

Not in the registry (packages/ui/registry.json) yet.

API

className and children are left out: every component that takes them passes them on.

SignatureCapture

NameTypeDefaultDescription
onChange(s: CapturedSignature | null) => void{ kind: "typed", text, font }, { kind: "drawn", png }, or null while there is none.
defaultNamestring""Prefills the typed name. A prefilled name is reported once, on mount.
defaultValueCapturedSignature | nullnullA signature captured earlier, read on mount. Change key to reset.
titlestring"Your signature"Heading. Pass "" when a dialog or card around it has its own.
headingLevel2 | 32Heading level in the page outline.
padHeightnumber180Height of the drawing area.
undobooleanfalseShow Undo on the drawing pad.
labelsPartial<SignatureCaptureLabels>EnglishEvery text, for translation. labels.pad holds the pad's.

SignaturePreview

NameTypeDefaultDescription
signatureCapturedSignatureWhat to show.
onLinebooleanfalseInside SignatureLine: a drawing sits on the line exactly as drawn.
padHeightnumber180With onLine: the height of the pad it was drawn on, so it shows 1:1.

SignatureLine

NameTypeDefaultDescription
heightnumber120Height in CSS pixels.
belownumber24Space under the line. signatureLineFor(padHeight) gives a pad's geometry.

Accessibility

  • Typing is the keyboard and screen reader way to sign. Tab reaches the Type or Draw switch, the name input and the chosen font.
  • The Type or Draw switch and the font choices are radio groups: arrow keys move inside them.
  • The empty pad's name tells a screen reader user to choose Type.