Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Forms Form-associated

Signature <pm-signature>

Signature pad: sign with a finger, pen or mouse. Form-associated; submits a PNG data URL.

Full screen

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/signature'; </script> <pm-signature label="Signature" name="signature" hint="Use your finger, a pen or the mouse." style="inline-size: min(100%, 26rem)"></pm-signature>

States

Each state is one attribute.

Disabled
Read-only
Required
Error

Overview

The ink follows the theme's text colour on screen and is exported dark on a transparent background. Keyboard users cannot draw, so offer a typed-name alternative next to it when a signature is required.

Attributes

AttributeTypeDefaultDescription
labelstringSignatureVisible label (use hide-label to hide it visually).
namestring—Form field name: the PNG data URL is submitted under it.
hintstring—Help text under the pad.
errorstring—Custom error message. Setting it marks the field invalid.
requiredbooleanfalseThe form cannot be submitted until something is drawn.
disabledbooleanfalseNot interactive and not submitted.
heightstring—Height of the drawing area: any CSS length (default 10rem).
line-width
prop: lineWidth
number2Stroke thickness in pixels (default 2).
clear-label
prop: clearLabel
stringClearText of the clear button.
hide-label
prop: hideLabel
booleanfalseHide the label visually; it stays the accessible name.
readonlybooleanfalseFocusable and submitted, but the user cannot change the value.

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Events

EventReact / Svelte propDescription
pm-changeonPmChangeA stroke was finished or the pad was cleared.

Methods

clear(), toDataURL(), checkValidity(), reportValidity(), validate()