Skip to content

Signature Pad ​

A canvas-based signature capture component with mouse and touch support. Works on desktop and mobile devices without any external libraries.

Type: Component

Available in: App Page · Home Page · Record Page · Flow Screen

Attributes ​

NameTypeDefaultDescription
pen-colorstring'#000000'The initial pen color.
stroke-widthnumber2The initial stroke width in pixels.
heightstring''The height of the signature area, for example '400px'. By default it depends on the screen size.
requiredbooleanfalseIf present, a signature is required by the validate method.
record-idstringThe record to save the signature to. Set automatically on record pages.
save-to-recordbooleanfalseIf present, a button saves the signature as a file on the record given by record-id.
signature-data-urlstringRead-only. The signature as a PNG data URL, empty while the pad is empty. Also available as a Flow output.
content-document-idstringRead-only. The id of the saved file. Empties when the signature changes. Also available as a Flow output.
validatemethodChecks the required attribute for Flow screens. Returns isValid and errorMessage.

Usage ​

html
<c-signature-pad record-id={recordId} save-to-record onsignaturesave={handleSignatureSave}></c-signature-pad>

Saving creates the file directly through Lightning Data Service, so no Apex is involved and the permissions of the user apply. Users need access to the record and permission to create files.

Events ​

NameDetailDescription
signaturechange{ dataUrl, isEmpty }Fired after every stroke and when the pad is cleared. dataUrl contains the signature as a PNG data URL and is an empty string while the pad is empty.
signaturesave{ contentDocumentId }Fired after the signature was saved as a file on the record.

Custom Labels ​

The texts users see are Custom Labels, so they can be translated in Setup with the Translation Workbench. Copy them together with the component.

NameValue
ErrorUtils_UnknownErrorUnknown error
SignaturePad_ClearClear
SignaturePad_DownloadDownload
SignaturePad_ErrorSavingError saving the signature
SignaturePad_FileTitleSignature
SignaturePad_PenColorPen Color
SignaturePad_PlaceholderDraw your signature here
SignaturePad_ProvideSignaturePlease provide a signature.
SignaturePad_SaveSave
SignaturePad_SavedThe signature has been saved.
SignaturePad_SaveSignaturePlease save your signature.
SignaturePad_SavingSaving
SignaturePad_StrokeWidthStroke Width ({0}px)
SignaturePad_SuccessSuccess
SignaturePad_TitleSignature Pad
SignaturePad_UndoUndo

Component Dependencies ​

NameTypeDescription
errorUtilsLWCShared functions to read error messages and show error toasts.
labelUtilsLWCShared function to fill the placeholders of Custom Labels.

Released under the MIT License. · llms.txt for AI agents