Skip to content

Signature pad

Draws a handwritten signature with a mouse, finger, or pen.

Draw your signature above the line.

signature-pad-demo.tsx

Installation

The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.

Usage

contract-signature.tsx

Composition

  • SignaturePad

    Owns the drawing and the captured data URL. Set children to replace the default field layout, or use SignaturePadRoot.

    • SignaturePadLabel
    • SignaturePadControl
      • SignaturePadGuideOptional
      • SignaturePadSegment
        • SignaturePadPathRepeats
      • SignaturePadClearTriggerOptional

        The machine hides it while the pad is empty or drawing.

    • SignaturePadDescriptionOptional
    • SignaturePadErrorOptional
    • SignaturePadHiddenInputOptional

      Render it to submit the data URL with a form.

SignaturePadContext Renders a function with the signature pad api. useSignaturePad also returns the data URL, invalid state, capture, and clear.

Captured image

onValueChange receives a PNG data URL after each stroke ends.

Draw your signature above the line.

Captured imageNo signature yet
signature-pad-image-demo.tsx

Read only

defaultPaths takes the paths from onDrawEnd. Show them in a pad of the same size.

Signed on October 18, 2026.

signature-pad-read-only-demo.tsx

Invalid

Draw your signature above the line.

signature-pad-invalid-demo.tsx

Composition

Also install Button link.

No strokes

Draw with a mouse, finger, or pen.

Download PNG
signature-pad-composition-demo.tsx

API reference

SignaturePad

label: stringRequired
Visible label above the drawing area.
description: string
Help text below the drawing area.
error: string
Message below the drawing area while `isInvalid` is true.
placeholder: string = "Sign here"
Text in the empty drawing area.
size: "sm" | "md" | "lg" = "md"
Height of the drawing area.
name: string
Submits the PNG data URL in a hidden input. The value updates when a stroke ends. Validate the pad with `isInvalid`.
form: string
Associates the hidden input with a form by id.
paths: string[]
The committed strokes, controlled.
defaultPaths: string[]
The strokes to draw first, uncontrolled.
drawing: DrawingOptions
The stroke options. The defaults use `currentColor` and size 3.
isDisabled: boolean
Disables drawing and the clear button.
isReadOnly: boolean
Shows the strokes but stops changes.
isRequired: boolean
Marks the pad as required. Validate it with `isInvalid`.
isInvalid: boolean
Marks the pad as invalid and shows the error.
dataUrlType: "image/png" | "image/jpeg" | "image/svg+xml" = "image/png"
The image type of the captured value.
quality: number
The quality of a lossy capture, from 0 to 1.
onDraw: (details: { paths: string[]; currentPath: string | null }) => void
Called with the committed strokes while drawing.
onDrawEnd: (details: { paths: string[]; getDataUrl: Function }) => void
Called when a stroke ends.
onValueChange: (value: string) => void
Called with the data URL after a stroke ends or the pad is cleared.
translations: IntlTranslations
Overrides the accessible labels of the pad and clear button.
dir: "ltr" | "rtl"
Sets the writing direction of the pad.
ids: ElementIds
Sets the ids of the pad parts.
getRootNode: () => Node
Resolves the document in custom environments such as iframes.

SignaturePadRoot

Owns the machine and renders the root. It takes the SignaturePad props without the default field content, plus `children`.

children: ReactNodeRequired
The composed parts.

SignaturePadLabel

SignaturePadControl

The drawing surface. It takes focus and receives pointer input.

SignaturePadSegment

Renders the strokes. Without children, it maps the committed and current paths.

children: ReactNode
Replaces the default paths with custom SVG content.

SignaturePadPath

path: stringRequired
The SVG path data of one stroke.

SignaturePadGuide

Draws the baseline guide. It takes no pointer events.

SignaturePadClearTrigger

Clears the pad. The machine hides it while the pad is empty or a stroke is in progress.

children: ReactNode
Replaces the default "Clear" label.

SignaturePadHiddenInput

value: string
Overrides the captured data URL.
form: string
Associates the input with a form by id.

SignaturePadDescription

SignaturePadError