# SignaturePadApi (@salmonui/inputs/signature-pad)

> The SignaturePadApi interface of @salmonui/inputs/signature-pad: ref of SignaturePad.

Canonical: https://salmonui.dev/docs/reference/inputs/signature-pad/SignaturePadApi

```ts
import type { SignaturePadApi } from '@salmonui/inputs/signature-pad';
```

Entry index: https://salmonui.dev/docs/reference/inputs/signature-pad (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/inputs/signature-pad.md).

## Reference

Kind: interface

```ts
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`.

Members (13):

| Name | Signature | Flags | 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;` |  |  |
