---
title: "Signature Pad"
description: "A pad to sign on: draw with a pen, a mouse, or a finger, type the name in a script, or upload a photo. Undo, replay, export, and form use."
url: https://gelatinui.com/components/signature-pad
markdown_url: https://gelatinui.com/components/signature-pad.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/signature-pad"
version: "2026-11-09"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Signature Pad

> A pad to sign on: draw with a pen, a mouse, or a finger, type the name in a script, or upload a photo. Undo, replay, export, and form use.

Page: https://gelatinui.com/components/signature-pad

## When to use it

Best for: Collecting a signature in a form: drawn, typed, or uploaded, sent as JSON.

- Use it when a person must sign: a contract, a consent form, a delivery.
- Set `name` and `required` to send the signature with a native form; a Field shows the error.
- List the script fonts that your app loads in `fonts`, for the Type mode.

## When not to use it

- To upload any other file, use a [Dropzone](https://gelatinui.com/components/dropzone.md).
- To only collect a typed name, use an [Input](https://gelatinui.com/components/input.md).

## Notes for agents

- The value is plain JSON (`SignatureData`): strokes, the typed text, or the image. `EMPTY_SIGNATURE` is the empty value.
- Compose `SignaturePadCanvas` with `SignaturePadPlaceholder` and `SignaturePadBaseline`; add `SignaturePadModes` for Draw, Type, and Upload.
- Strokes come from perfect-freehand and render as SVG, so a resize never clears the pad.
- `SignaturePadDownload` saves PNG or SVG.

## Anatomy

```text
SignaturePad
├─ SignaturePadModes (0..n)
├─ SignaturePadMode (0..n)
├─ SignaturePadCanvas (0..n)
├─ SignaturePadPlaceholder (0..n)
├─ SignaturePadBaseline (0..n)
├─ SignaturePadLabel (0..n)
├─ SignaturePadTypedInput (0..n)
├─ SignaturePadUpload (0..n)
├─ SignaturePadUploadTrigger (0..n)
├─ SignaturePadToolbar (0..n)
├─ SignaturePadColors (0..n)
├─ SignaturePadColor (0..n)
├─ SignaturePadSizes (0..n)
├─ SignaturePadSize (0..n)
├─ SignaturePadFonts (0..n)
├─ SignaturePadUndo (0..n)
├─ SignaturePadRedo (0..n)
├─ SignaturePadReplay (0..n)
├─ SignaturePadClear (0..n)
├─ SignaturePadReplace (0..n)
├─ SignaturePadSeparator (0..n)
├─ SignaturePadActions (0..n)
└─ SignaturePadDownload (0..n)
```

## API reference

### SignaturePad

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  |  |
| `aria-label` | `string` |  | Defines a string value that labels the current element. The accessible name of the pad. Default "Signature". |
| `value` | `SignatureData \| null` |  | The signature. Controlled. `null` is an empty pad. |
| `defaultValue` | `SignatureData \| null` | null | The first signature when uncontrolled (a saved one to show or to edit). |
| `onValueChange` | `function` |  | Runs after each finished stroke, undo, redo, clear, mode change, typed key, and upload. |
| `onStrokeEnd` | `function` |  | Runs when the pointer lifts at the end of a stroke, with that stroke. |
| `penColor` | `string` |  | The ink of the next stroke, and of the typed name and the image (any CSS color). Controlled. |
| `defaultPenColor` | `string` | "var(--signature-pad-ink-black)" |  |
| `onPenColorChange` | `function` |  |  |
| `penSize` | `number` |  | The base width of the next stroke, in px. Controlled. |
| `defaultPenSize` | `number` | 3 |  |
| `onPenSizeChange` | `function` |  |  |
| `fonts` | `readonly SignatureFontOption[]` | NO_FONTS | The fonts of the typed name, for `SignaturePadFonts`. The first is the default. The pad ships no font: list fonts that the app loads. Empty: the `--signature-pad-font` token (`cursive`). |
| `accept` | `readonly string[]` | SIGNATURE_UPLOAD_ACCEPT | The image types that Upload takes. Default PNG, JPEG, and WebP. |
| `maxFileSize` | `number` | SIGNATURE_UPLOAD_MAX_SIZE | The largest image that Upload takes, in bytes. Default 10 MB. |
| `name` | `string` |  | The form field name. The form sends the value as JSON, or nothing when empty. |
| `required` | `boolean` | false | The form blocks the submit while the pad is empty (a Field shows the error). |
| `disabled` | `boolean` | false |  |
| `readOnly` | `boolean` | false | Shows the signature; no drawing, typing, upload, modes, or tools. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| SignaturePad | `signature-pad` |  | `--foreground`, `--signature-pad-font`, `--signature-pad-ink-black`, `--signature-pad-ink-blue`, `--signature-pad-ink-purple` |  |
| SignaturePadModes | `signature-pad-modes` |  |  |  |
| SignaturePadMode | `signature-pad-mode` |  |  |  |
| SignaturePadCanvas | `signature-pad-canvas` | `data-disabled`, `data-dragging`, `data-invalid`, `data-readonly`, `data-stage-focused` |  |  |
| SignaturePadPlaceholder | `signature-pad-placeholder` | `data-drawing` |  | `motion-timing` |
| SignaturePadBaseline | `signature-pad-baseline` |  |  |  |
| SignaturePadLabel | `signature-pad-label` |  |  |  |
| SignaturePadTypedInput | `signature-pad-typed-input` |  | `--ease-fade`, `--motion-fade`, `--signature-pad-chars`, `--signature-pad-font`, `--signature-pad-ink`, `--signature-pad-typed-font` | `motion-timing` |
| SignaturePadUpload | `signature-pad-upload` |  |  |  |
| SignaturePadUploadTrigger | `signature-pad-upload-trigger` |  |  |  |
| SignaturePadToolbar | `signature-pad-toolbar` | `data-readonly` |  | `motion-timing` |
| SignaturePadColors | `signature-pad-colors` |  |  |  |
| SignaturePadColor | `signature-pad-color` | `data-pressed` | `--signature-pad-swatch` |  |
| SignaturePadSizes | `signature-pad-sizes` |  |  |  |
| SignaturePadSize | `signature-pad-size` | `data-pressed` | `--signature-pad-dot` |  |
| SignaturePadFonts | `signature-pad-fonts` | `aria-invalid`, `data-popup-open` |  |  |
| SignaturePadUndo | `signature-pad-undo` |  |  |  |
| SignaturePadRedo | `signature-pad-redo` |  |  |  |
| SignaturePadReplay | `signature-pad-replay` |  |  |  |
| SignaturePadClear | `signature-pad-clear` |  |  |  |
| SignaturePadReplace | `signature-pad-replace` |  |  |  |
| SignaturePadSeparator | `signature-pad-separator` |  |  |  |
| SignaturePadActions | `signature-pad-actions` |  |  |  |
| SignaturePadDownload | `signature-pad-download` |  |  |  |

## Usage

Put the toolbar, the placeholder, and the baseline with the name of the signer in the canvas.

```tsx title="lease-signature.tsx"
import {
  SignaturePad,
  SignaturePadActions,
  SignaturePadBaseline,
  SignaturePadCanvas,
  SignaturePadClear,
  SignaturePadLabel,
  SignaturePadPlaceholder,
  SignaturePadRedo,
  SignaturePadToolbar,
  SignaturePadUndo,
} from "@/components/ui/pro/signature-pad";

export function LeaseSignature() {
  return (
    <SignaturePad aria-label="Signature">
      <SignaturePadCanvas>
        <SignaturePadToolbar>
          <SignaturePadActions>
            <SignaturePadUndo />
            <SignaturePadRedo />
            <SignaturePadClear />
          </SignaturePadActions>
        </SignaturePadToolbar>
        <SignaturePadPlaceholder />
        <SignaturePadBaseline>
          <SignaturePadLabel>Emma Collins</SignaturePadLabel>
        </SignaturePadBaseline>
      </SignaturePadCanvas>
    </SignaturePad>
  );
}
```

## Compose

Rules:

- Touch targets (`touch-targets`): Give every control a hit area of at least 44 px on touch screens, even when it looks smaller.
- Group with a Frame (`group-in-frames`): Put related panels in one `Frame` with its header and footer outside the panels, and keep a plain `Card` for one block of content.
- Name every control (`label-every-control`): Give every field a visible `Label` (or a `Field`), and every icon button a `Tooltip` or an `aria-label`.
- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/signature-pad
```

It adds 57 registry items: 54 files, 9737 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@phosphor-icons/react`, `@xstate/react`, `clsx`, `motion`, `perfect-freehand`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## Built on

- [Button](https://gelatinui.com/components/button.md)
- [Select](https://gelatinui.com/components/select.md)
- [Spinner](https://gelatinui.com/components/spinner.md)
- [Tabs](https://gelatinui.com/components/tabs.md)
- [Toggle Group](https://gelatinui.com/components/toggle-group.md)
- [Toolbar](https://gelatinui.com/components/toolbar.md)
- [Tooltip](https://gelatinui.com/components/tooltip.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Field](https://gelatinui.com/components/field.md)
- [Button](https://gelatinui.com/components/button.md)
- [Questionnaire](https://gelatinui.com/components/questionnaire.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Mod+Z | Undoes the last stroke. |
| Mod+Shift+Z, Ctrl+Y | Redoes the stroke. |
| Tab | Moves between the modes, the tools, and the pad. |

## Motion

| Part | Motion |
| --- | --- |
| Placeholder | fade · the hint fades out when the first stroke starts |
