Components / Fonts and style helpers

Signature

Fonts and style helpers

The faces, the ink, the signing line and small helpers the components and the PDF share.

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

The typed faces need fonts.css from the package (about 400 kB, each face loaded when first shown), or your own @font-face rules for the family names in SIGNATURE_FONTS.

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.

The four faces

  • Ada Exampledelafield
    Mrs Saint Delafield
  • Ada Examplemuellerhoff
    Herr Von Muellerhoff
  • Ada Exampleallura
    Allura
  • Ada Exampleaurore
    La Belle Aurore

Line, baseline and ink

Ada Example

signatureLineFor(120) = {"height":122,"below":31} · baseline 0.74 · ink #0b1f4d

Download the PNG

Draw, then download the PNG.

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.

Fonts and style

NameTypeDefaultDescription
SIGNATURE_FONTS{ id, label, family, fontName }[]The four typed faces (SIL Open Font License 1.1).
SIGNATURE_FONT_IDSSignatureFontId[]Their ids, for validation.
DEFAULT_SIGNATURE_FONTSignatureFontId"delafield"The face used when none is chosen.
isSignatureFontId(x: unknown) => x is SignatureFontIdChecks a value from outside, such as a request body.
signatureFontFamily(id?: SignatureFontId) => stringCSS font-family for a face, with fallbacks.
SIGNATURE_INKstring"#0b1f4d"Signature ink, a deep blue-black. The PDF uses the same.
SIGNATURE_INK_RGB[number, number, number]The ink as 0 to 1 RGB, for PDF libraries.
SIGNATURE_BASELINEnumber0.74Where the signing line sits in the pad and in every drawn image, from the top.
SIGNATURE_PAD_HEIGHTnumber180Default pad height in CSS pixels.
signatureDataUrl(png: string) => stringA PNG from onChange as a data: URL.
signatureLineFor(padHeight: number) => { height, below }SignatureLine props that match a pad, so a drawing shows 1:1.
SIGNATURE_PAD_LABELSSignaturePadLabelsThe pad's English texts, to start a translation from.
SIGNATURE_CAPTURE_LABELSSignatureCaptureLabelsThe capture's English texts.