Skip to content

Signature Pad

InputsSince 0.13.0

Captures a handwritten signature with a mouse, pen, or touch on a high-DPI canvas. Strokes are smoothed (quadratic curves through point midpoints) and vary in width with pen pressure, or with speed for mouse and touch. Undo removes the last stroke, Clear removes everything, and the signature exports as a PNG or SVG data URL. Because drawing is pointer-only, a typed-name mode is always offered for keyboard and screen-reader users: the name is rendered on the pad as the signature. SignaturePad is a Form control; native forms receive the signature as a data URL.

  • Natural strokesSmoothed curves whose width follows pen pressure or drawing speed, sharp on high-DPI screens.
  • Typed alternativeA Type mode for keyboard and screen-reader users renders the name as the signature.
  • Undo and clearRemove the last stroke or start over, with spoken confirmation.
  • PNG and SVGExport data URLs or submit them with a native form.
  • Resize safePoints are stored relative to the pad, so the signature rescales with the layout.

Use it for

  • Acknowledging documents: offer letters, policies, timesheets, delivery receipts.
  • Any place a person must sign in the browser, with a typed alternative.

Use something else for

  • Legally qualified electronic signatures (certificates, identity proofing): use a signing service; a drawn image alone proves little.
  • Free drawing or annotation: the pad has one pen and no shapes.
Anatomy
<div class="aui-field aui-signature-pad">
<label class="aui-field__label">Signature</label>
<div class="aui-field__description">help</div>
<div class="aui-signature-pad__box" role="group" aria-labelledby="label">
<div class="aui-signature-pad__toolbar">
<div class="aui-signature-pad__modes" role="group" aria-label="Signature method">
<button aria-pressed="true">Draw</button><button aria-pressed="false">Type</button>
</div>
<div class="aui-signature-pad__actions"><button aria-label="Undo last stroke"/><button aria-label="Clear signature"/></div>
</div>
<div class="aui-signature-pad__pad">
<canvas role="img" aria-label="Signature pad, empty"></canvas>
<span class="aui-signature-pad__baseline"/><span class="aui-signature-pad__placeholder">Sign here</span>
</div>
<div class="aui-signature-pad__typed" hidden><label>Type your full name</label><input type="text"></div>
</div>
<div class="aui-field__error">error</div>
<input type="hidden" name="signature">
</div>

Use the bar above each frame to switch theme, density, direction, and locale.

Signature Pad in the Personal preferences showcase

Section titled “Signature Pad in the Personal preferences showcase”

The part of the Personal preferences showcase that uses Signature Pad. Change its options, use it with the keyboard, and watch the event log; the link in the frame opens the full showcase. The bar above the frame switches theme, density, direction, and locale.

Showcase source
// Preferences showcase: a personal settings page with the new form controls. An accent
// color with swatches, a contrast hint, and the eyedropper where supported; a satisfaction rating
// with half steps; team assignment between two searchable lists (with drag); a work location
// cascader whose cities load from a simulated server; a mention comment box with @people and
// #tags from a simulated directory; a masked phone number; and an acknowledgement signature.
import { Cascader, type CascaderOption, type CascaderValue } from '@absoluteui/components/cascader';
import { ColorPicker } from '@absoluteui/components/color-picker';
import { MaskedInput, MASK_PRESETS } from '@absoluteui/components/masked-input';
import { MentionInput, type MentionSuggestion } from '@absoluteui/components/mention-input';
import { Rating } from '@absoluteui/components/rating';
import { SignaturePad } from '@absoluteui/components/signature-pad';
import { TransferList, type TransferListItem } from '@absoluteui/components/transfer-list';
import { action, choice, createShowcase, hostIn, section, status, toggle, wait } from './kit.js';
const sc = createShowcase({
title: 'Personal preferences',
description: 'Pick an accent color, rate onboarding, choose your team and location, leave a comment with mentions, and sign.',
simulated: true,
});
// Appearance: color.
const appearance = section(sc, 'Appearance', ['color-picker']);
const color = ColorPicker.create(hostIn(appearance), {
label: 'Accent color',
description: 'Used for your calendar entries and highlights.',
value: '#2563eb',
presets: [
{ value: '#2563eb', label: 'Blue' },
{ value: '#15803d', label: 'Green' },
{ value: '#b45309', label: 'Amber' },
{ value: '#b91c1c', label: 'Red' },
{ value: '#7c3aed', label: 'Violet' },
],
recent: ['#0f766e', '#be185d'],
contrastWith: '#ffffff',
name: 'accent',
});
sc.listen(color.host, ['aui-change'], 'color');
// Feedback: rating.
const feedback = section(sc, 'Feedback', ['rating']);
const rating = Rating.create(hostIn(feedback), {
label: 'How was your onboarding?',
allowHalf: true,
value: 4,
labels: ['Poor', 'Fair', 'Good', 'Very good', 'Excellent'],
name: 'onboarding',
});
sc.listen(rating.host, ['aui-change'], 'rating');
Rating.create(hostIn(feedback), { label: 'Team average', value: 4.5, allowHalf: true, display: true, size: 'sm' });
// Team: transfer list over a realistic directory size.
const team = section(sc, 'Team', ['transfer-list']);
const FIRST = ['Ana', 'Ben', 'Chen', 'Divya', 'Elif', 'Farah', 'Goran', 'Hana', 'Ivan', 'Jun', 'Kofi', 'Lena', 'Mateo', 'Nora', 'Omar', 'Priya'];
const LAST = ['Ruiz', 'Okafor', 'Wang', 'Iyer', 'Kaya', 'Haddad', 'Petrov', 'Sato', 'Novak', 'Kim', 'Mensah', 'Fischer', 'Silva', 'Berg', 'Aziz', 'Rao'];
const people: TransferListItem[] = [];
for (let i = 0; i < 240; i++) {
const name = `${FIRST[i % FIRST.length] ?? ''} ${LAST[Math.floor(i / FIRST.length) % LAST.length] ?? ''}`;
people.push({ value: `p${String(i)}`, label: name, description: ['Engineering', 'Finance', 'People', 'Sales'][i % 4] ?? '', ...(i % 37 === 5 ? { disabled: true } : {}) });
}
const transfer = TransferList.create(hostIn(team), { label: 'Project team', items: people, value: ['p1', 'p2'], draggable: true, maxSelected: 12, name: 'team' });
sc.listen(transfer.host, ['aui-change'], 'team');
// Location: lazy cascader.
const location = section(sc, 'Work location', ['cascader']);
const CITIES: Record<string, string[]> = {
'de/by': ['Munich', 'Nuremberg', 'Augsburg'],
'de/be': ['Berlin'],
'in/ka': ['Bengaluru', 'Mysuru'],
'in/mh': ['Mumbai', 'Pune'],
'us/ca': ['San Francisco', 'Los Angeles', 'San Diego'],
'us/ny': ['New York', 'Buffalo'],
};
const places: CascaderOption[] = [
{ value: 'de', label: 'Germany', children: [{ value: 'by', label: 'Bavaria' }, { value: 'be', label: 'Berlin' }] },
{ value: 'in', label: 'India', children: [{ value: 'ka', label: 'Karnataka' }, { value: 'mh', label: 'Maharashtra' }] },
{ value: 'us', label: 'United States', children: [{ value: 'ca', label: 'California' }, { value: 'ny', label: 'New York' }] },
];
const cascader = Cascader.create(hostIn(location), {
label: 'Office',
options: places,
value: ['de', 'by', 'munich'],
levelLabels: ['Country', 'State', 'City'],
name: 'office',
loadChildren: async (_option, { signal, path }) => {
await wait(500, signal);
sc.log('server answered', { path });
return (CITIES[path.join('/')] ?? []).map((city) => ({ value: city.toLowerCase().replace(/\s+/g, '-'), label: city, isLeaf: true }));
},
});
sc.listen(cascader.host, ['aui-change'], 'cascader');
// Comment: mentions from a simulated directory.
const comment = section(sc, 'Comment', ['mention-input']);
const TAGS = ['onboarding', 'payroll', 'benefits', 'equipment', 'training'];
const findPeople = async (query: string, signal: AbortSignal): Promise<MentionSuggestion[]> => {
await wait(250, signal);
const q = query.toLowerCase();
return people.filter((p) => p.label.toLowerCase().includes(q)).slice(0, 8).map((p) => ({ id: p.value, label: p.label, description: p.description ?? '' }));
};
const mention = MentionInput.create(hostIn(comment), {
label: 'Note for your manager',
description: 'Type @ to mention a colleague or # to add a topic.',
maxLength: 500,
showCounter: true,
name: 'note',
triggers: [
{ char: '@', label: '@ for people', provider: (query, { signal }) => findPeople(query, signal) },
{ char: '#', label: '# for topics', provider: async (query, { signal }) => {
await wait(150, signal);
return TAGS.filter((t) => t.startsWith(query.toLowerCase())).map((t) => ({ id: t, label: t }));
} },
],
});
sc.listen(mention.host, ['aui-change', 'aui-mention'], 'mention');
// Contact: masked phone number.
const contact = section(sc, 'Contact', ['masked-input']);
const phone = MaskedInput.create(hostIn(contact), { label: 'Mobile phone', name: 'phone', ...MASK_PRESETS.phoneUs });
sc.listen(phone.host, ['aui-change'], 'phone');
// Acknowledgement: signature.
const sign = section(sc, 'Acknowledgement', ['signature-pad']);
const signature = SignaturePad.create(hostIn(sign), { label: 'Signature', description: 'Draw your signature, or choose Type to enter your full name.', required: true, name: 'signature' });
sc.listen(signature.host, ['aui-change'], 'signature');
const summary = status(sign);
const summarize = (): void => {
const v = signature.value;
summary.textContent = v === null ? 'Not signed yet.' : v.mode === 'type' ? `Signed as ${v.text}.` : `Signed with ${String(v.strokes.length)} strokes.`;
};
signature.host.addEventListener('aui-change', summarize);
summarize();
// Options.
const controls = [color, rating, transfer, cascader, mention, phone, signature];
toggle(sc, 'Disabled', false, (disabled) => {
for (const c of controls) c.update({ disabled });
});
toggle(sc, 'Read-only', false, (readOnly) => {
for (const c of controls) c.update({ readOnly });
});
choice(
sc,
'Color picker',
[
{ value: 'popup', label: 'Popup' },
{ value: 'inline', label: 'Inline' },
],
'popup',
(mode) => {
color.update({ mode });
},
['color-picker'],
);
toggle(sc, 'Half stars', true, (allowHalf) => {
rating.update({ allowHalf });
}, ['rating']);
/** A single path (strings), as opposed to a list of paths. */
const isPath = (v: CascaderValue): v is readonly string[] => v?.every((part) => typeof part === 'string') === true;
toggle(sc, 'Several offices', false, (multiple) => {
const current = cascader.value;
cascader.update({ multiple, value: multiple ? (isPath(current) ? [current] : []) : null });
}, ['cascader']);
action(sc, 'Validate', () => {
const invalid = controls.filter((c) => !c.reportValidity());
sc.log('validate', { invalid: invalid.map((c) => c.label) });
});
action(sc, 'Reset', () => {
for (const c of controls) c.reset();
summarize();
sc.log('reset');
});
import { SignaturePad } from '@absoluteui/components/signature-pad';
const host = document.createElement('div');
const preview = document.createElement('img');
preview.alt = 'Exported signature';
document.body.append(host, preview);
const pad = SignaturePad.create(host, { label: 'Signature', description: 'Draw your signature or type your full name.', required: true, name: 'signature' });
host.addEventListener('aui-change', () => {
preview.src = pad.isEmpty ? '' : pad.toDataURL('svg');
});
import { SignaturePad } from '@absoluteui/components/signature-pad';
const host = document.createElement('div');
document.body.append(host);
SignaturePad.create(host, { label: 'Acknowledgement', mode: 'type', value: { mode: 'type', text: 'Ana Ruiz' }, height: '6rem' });
import { SignaturePad } from '@absoluteui/components/signature-pad';
const host = document.createElement('div');
document.body.append(host);
SignaturePad.create(host, { label: 'Delivery receipt', penColor: '#1d3a8a', penWidth: 3, submit: 'svg', name: 'receipt' });
Terminal window
npm install @absoluteui/components @absoluteui/core @absoluteui/theme

Registry setup, the theme stylesheet, and the Content Security Policy are covered in Installation.

import { SignaturePad } from '@absoluteui/components/signature-pad';
import '@absoluteui/components/signature-pad/style.css';
import { SignaturePad } from '@absoluteui/components/signature-pad';
import '@absoluteui/components/signature-pad/style.css';
const host = document.querySelector<HTMLElement>('#receipt');
if (host) SignaturePad.create(host, { label: 'Recipient signature', name: 'signature', required: true });
More usage
import { SignaturePad, type SignaturePadValueDetail } from '@absoluteui/components/signature-pad';
const host = document.querySelector<HTMLElement>('#sign');
if (host) {
const pad = SignaturePad.create(host, { label: 'Signature', required: true });
host.addEventListener('aui-change', (event) => {
const { value } = (event as CustomEvent<SignaturePadValueDetail>).detail;
if (value !== null) console.log(pad.toDataURL('png').length);
});
}

Using Angular? See Signature Pad for Angular.

SignaturePad.create(host: HTMLElement, options: SignaturePadOptions): SignaturePad

Global configuration key: signaturePad (see Configuration).

Option Type Default Description
label string Visible label (required accessible name). Required.
hideLabel boolean "false" Visually hide the label.
description string Help text, referenced by the pad group and the typed field.
value SignaturePadValue "null" Drawn strokes or a typed name, or null.
penColor string Pen color (CSS color); default the –aui-signature-pad-ink token.
height string "10rem" Pad height (CSS length).
typedFont string Font family for typed signatures (default a cursive family).
mode 'draw' | 'type' "draw" Initial mode.
submit SignatureFormat "png" Hidden input format: ‘png’ or ‘svg’ data URL.
required boolean "false" A signature must be given.
disabled boolean "false" Disable the control.
readOnly boolean "false" Show the signature without editing controls.
name string Form field name (hidden input with the data URL).
validate (value: SignaturePadValue) => string | null Consumer validation; return a message to mark the value invalid.
icons Partial<SignaturePadIcons> Undo, clear, and validation icons.
penWidth number "2.5" Base stroke width in CSS pixels (0.5 to 20). Globally configurable.
validationTiming ValidationTiming "blur" When validation messages appear. Globally configurable.
locale string "en-US" Locale of the messages. Globally configurable. Inherited from common configuration.
Property Type Description
host HTMLElement The host element.
value SignaturePadValue Drawn strokes or the typed name, or null when empty.
isEmpty boolean True when nothing is drawn or typed in the current mode.
mode 'draw' | 'type' Current mode.
validity FieldValidity Current validity.
options Readonly<SignaturePadOptions> Current options.
Method Description
setValue(value: SignaturePadValue): void Set the value (no event).
undo(): void Remove the last stroke.
clear(): void Remove the signature.
toDataURL(format?: SignatureFormat): string PNG (device pixel ratio, transparent) or SVG data URL.
toSVG(): string SVG markup of the signature.
getFormValue(): string | null The submitted data URL, or null when empty.
setCustomError(message: string | null): void Show or clear an external error.
reportValidity(): boolean Show messages now and return validity.
focus(): void Focus the mode buttons (draw) or the typed field (type).
reset(): void Restore the initial value and clear the validation state.
update(options: Partial<SignaturePadOptions>): void Merge and apply options.
destroy(): void Remove rendering, listeners, and the form registration.
Event Detail Bubbles Cancelable Description
aui-change SignaturePadValueDetail Yes No After a stroke, a typed change, undo, clear, or a mode switch: { value, validity }.

All rules live in the aui.components cascade layer, so application styles override them without specificity battles.

Class Purpose
aui-signature-pad Host (with aui-field).
aui-signature-pad--type | --readonly | --disabled | --invalid State modifiers.
aui-signature-pad__box Group of the toolbar, pad, and typed field.
aui-signature-pad__toolbar Mode buttons and actions.
aui-signature-pad__modes | __mode Draw and Type toggle buttons (aria-pressed).
aui-signature-pad__actions | __action Undo and clear buttons.
aui-signature-pad__pad | __pad--drawable Drawing surface.
aui-signature-pad__canvas Canvas (role=img).
aui-signature-pad__baseline | __placeholder Decorative baseline and ‘Sign here’ hint.
aui-signature-pad__typed | __typed-label | __typed-input Typed-name field.
Slot Default icon
undo undo
clear trash
error alert-circle

Tokens this stylesheet reads (verified in CI). Override them in a theme or with the Theme Designer.

--aui-border-width | --aui-color-border-strong | --aui-color-error-fg | --aui-color-focus-ring | --aui-color-hover | --aui-color-selected | --aui-color-selected-indicator | --aui-color-selected-text | --aui-color-surface | --aui-color-text | --aui-color-text-disabled | --aui-color-text-muted | --aui-control-height-md | --aui-control-height-sm | --aui-control-padding-x | --aui-duration-fast | --aui-easing-standard | --aui-focus-ring-offset | --aui-focus-ring-width | --aui-font-family-sans | --aui-font-size-sm | --aui-font-weight-medium | --aui-icon-size-sm | --aui-line-height-tight | --aui-radius-md | --aui-space-1 | --aui-space-2 | --aui-space-3 | --aui-space-4 | --aui-touch-target-min

TypeScript definitions
type SignatureFormat = 'png' | 'svg';
interface SignaturePoint { readonly x: number; readonly y: number; readonly pressure: number; readonly t: number }
interface SignatureStroke { readonly points: readonly SignaturePoint[]; readonly color?: string }
type SignaturePadValue = { readonly mode: 'draw'; readonly strokes: readonly SignatureStroke[] } | { readonly mode: 'type'; readonly text: string } | null;
interface SignaturePadConfig { validationTiming: ValidationTiming; penWidth: number }
interface SignaturePadIcons { undo: IconRef; clear: IconRef; error: IconRef }
interface SignaturePadOptions extends Partial<SignaturePadConfig> {
label: string;
hideLabel?: boolean;
description?: string;
value?: SignaturePadValue;
penColor?: string;
height?: string;
typedFont?: string;
mode?: 'draw' | 'type';
submit?: SignatureFormat;
required?: boolean;
disabled?: boolean;
readOnly?: boolean;
name?: string;
validate?: (value: SignaturePadValue) => string | null;
locale?: string;
icons?: Partial<SignaturePadIcons>;
}
interface SignaturePadValueDetail { value: SignaturePadValue; validity: FieldValidity }

Pattern: A labelled group with a Draw/Type pair of toggle buttons (aria-pressed), the canvas as role=img whose name describes its content, a native text field for the typed-name alternative, and undo and clear buttons. Drawing is pointer-only, so the typed mode provides the keyboard and screen-reader path (WCAG 2.1.1, 2.5.7).

Checked on every docs build: the showcase passes axe (WCAG 2.2 A and AA rules) in the default, dark, and high-contrast themes and right to left; the playground loads without errors and passes axe before and after every on/off option is switched, with no Content Security Policy violations.

Key Context Action
Tab / Shift+Tab Control Moves through Draw, Type, the typed field, Undo, and Clear.
Enter / Space Mode button Switch to drawing or typing; Type focuses the name field.
Enter / Space Undo, Clear Remove the last stroke or the whole signature.
Typing Typed field The name is drawn on the pad as the signature.
Element Role
box group (named by the label)
mode buttons button with aria-pressed
canvas img
typed field textbox (native input)
undo, clear button
Attribute Element Value
aria-labelledby box the visible label
aria-label mode group ‘Signature method’
aria-pressed Draw / Type true for the current mode
aria-label canvas ‘Signature pad, empty’, ‘… drawn with 3 strokes’, or ‘… typed signature: Ana Ruiz’
aria-label undo, clear ‘Undo last stroke’, ‘Clear signature’
aria-describedby box and typed field help text and error
aria-invalid typed field true when invalid in type mode

Focus never moves into the canvas; Type moves focus to the name field.

Criterion Level Note
1.1.1 Non-text Content A
1.3.1 Info and Relationships A
1.4.11 Non-text Contrast AA
2.1.1 Keyboard A
2.5.7 Dragging Movements AA
3.3.2 Labels or Instructions A
4.1.2 Name, Role, Value A

Automated test results: Accessibility and compliance.

  • The typed alternative is always offered, not hidden behind a setting.
  • Undo and clear are announced through the polite live region.
  • Manual screen-reader verification (NVDA, JAWS, VoiceOver) is pending.
Import cost Minified gzip brotli CSS brotli
@absoluteui/components/signature-pad 49.9 kB 17.1 kB 15.2 kB 1.1 kB

Measured at build time, including every AbsoluteUI module the component pulls in. No third-party runtime dependencies.

Budget (enforced in CI) Limit
SignaturePad.create, per instance < 3 ms average in headless Chromium
Redraw of a 2,000-point signature < 8 ms

Tested scale: Up to 20,000 points per signature (excess points are dropped).

Each pointer move redraws the canvas from the stored strokes (coalesced events are used for smooth fast strokes). A 2,000-point signature redraws in a few milliseconds.

Measured run times: Performance.

States

Empty; drawing; drawn; typed; draw mode; type mode; read-only; disabled; required; invalid.

State transitions
From Trigger To
draw mode pointer down, move, up a new stroke; aui-change
drawing pointer cancel the stroke is discarded
drawn Undo the last stroke removed; announced; aui-change
any Clear empty; announced; aui-change
draw mode Type type mode; focus moves to the name field
type mode typing, then leaving the field typed signature; aui-change
Accessibility notes
  • Drawing cannot be done with a keyboard, so the typed mode is always offered (WCAG 2.1.1, 2.5.7).
  • Undo and Clear are announced through the polite live region.
  • Manual screen-reader verification is pending.
Responsive behavior

The pad fills the container width at a fixed height. Points are stored relative to the pad, so the signature rescales when the width changes.

Right-to-left

The toolbar mirrors and the placeholder starts at the right; strokes are geometry and are not mirrored.

Theming

The default ink is read from --aui-signature-pad-ink when the pad draws. Forced colors draw the boundary and default ink in CanvasText and the pressed mode in Highlight.

Global configuration
configureAbsoluteUI({ components: { signaturePad: { penWidth: 3 } } });
Component configuration

Instance penWidth, validationTiming, and locale override configuration; configuration changes re-render existing pads.

Timezones

Not applicable. Point times are milliseconds relative to the start of a stroke.

Icons

icons.undo (default undo), icons.clear (default trash), and icons.error (default alert-circle).

Security

No HTML is rendered. The typed name is drawn on the canvas and escaped in SVG export. penColor and height are checked with CSS.supports, typedFont rejects markup characters, and strokes passed as value are validated (finite numbers, at most 20,000 points). Positions use the CSSOM (CSP-safe).

Data handling

No persistence, network access, or telemetry. A signature is personal data: send it only over HTTPS and store it as your privacy policy states.

Supported data scale

Up to 20,000 points per signature; points beyond that are dropped.

Edge cases
  • A tap without movement draws a dot.
  • Switching mode keeps the other mode’s content; the value follows the current mode.
  • A pointer cancel (for example a scroll gesture taking over) discards the stroke in progress.
  • penColor applies to new strokes; strokes without a color use the current theme ink.
Errors
Code Category Cause
SIGNATURE_PAD_OPTIONS configuration Blank label, unknown mode or submit, an invalid penColor, height, or typedFont, malformed value, or a non-function validate.
CFG_INVALID_VALUE / CFG_UNKNOWN_OPTION configuration Invalid configuration (for example penWidth outside 0.5 to 20).

Invalid options throw before the host is modified; an invalid update() leaves the previous state intact.

Known limitations
  • After a theme change, the default ink updates on the next redraw (resize, stroke, or update()).
  • Exported PNGs have a transparent background.
  • Manual screen-reader verification is pending.
Unsupported scenarios
  • Erasing parts of a stroke.
  • Biometric signature verification.