API reference: @salmonui/inputs/signature-pad
SignaturePadApiinterface
import type { SignaturePadApi } from '@salmonui/inputs/signature-pad';interface SignaturePadApi {
readonly element: HTMLDivElement | null;
undo(): void;
redo(): void;
canUndo(): boolean;
canRedo(): boolean;
clear(): void;
isEmpty(): boolean;
drawText(text: string, options?: {
readonly fontFamily?: string | undefined;
readonly fontSize?: number | undefined;
}): void;
load(source: string): Promise<void>;
toDataURL(type?: 'image/png' | 'image/jpeg', options?: SignatureImageOptions): string;
toBlob(type?: 'image/png' | 'image/jpeg', options?: SignatureImageOptions): Promise<Blob | null>;
toSVG(options?: SignatureImageOptions): string;
focus(): void;
}
ref of SignaturePad.
| Name | Signature | Description |
|---|---|---|
element | readonly element: HTMLDivElement | null; | The root element. |
undo | undo(): void; | |
redo | redo(): void; | |
canUndo | canUndo(): boolean; | |
canRedo | canRedo(): boolean; | |
clear | clear(): void; | |
isEmpty | isEmpty(): boolean; | |
drawText | drawText(text: string, options?: {
readonly fontFamily?: string | undefined;
readonly fontSize?: number | undefined;
}): void; | Replaces the signature with centered text. |
load | load(source: string): Promise<void>; | Loads an image (data URL or URL) as the signature; resolves when drawn. |
toDataURL | toDataURL(type?: 'image/png' | 'image/jpeg', options?: SignatureImageOptions): string; | PNG (default) or JPEG at the canvas resolution. |
toBlob | toBlob(type?: 'image/png' | 'image/jpeg', options?: SignatureImageOptions): Promise<Blob | null>; | |
toSVG | toSVG(options?: SignatureImageOptions): string; | Vector markup from the stroke model, in CSS pixels. |
focus | focus(): void; |