Sign to accept the agreement
Sign above the line
Installation
$ pnpm dlx shadcn@latest add @synccn/signature-padFirst time in this project? Connect synccn with one command.
Usage
import { SignaturePad } from "@/components/ui/signature-pad";<SignaturePad onChange={setPng} />API reference
Generated from the component's TypeScript types, so it always matches the code.
SignaturePad
Draw with mouse, pen or finger. onChange receives a PNG data URL (or null when cleared).
PropTypeDescription
- height
numberDefault
180Canvas height in pixels.
- stroke
numberDefault
2.2Base line width in pixels.
- onChange
(dataUrl: string | null) => voidPNG data URL after each stroke, or null when cleared.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
- lib/utilscn (merges class names)
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for Eraser, Undo2
Accessibility
- Drawing needs a pointer. If a signature is required, offer a typed alternative for keyboard users.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA attributes: aria-label
More inputs
ButtonSeven variants, four sizes and a built-in loading state.InputText field with optional leading icon and invalid state.TextareaMulti-line field that grows with its content and counts characters.CheckboxChecked, unchecked and indeterminate, with label and description.SwitchToggle with a springy thumb in three sizes.Radio GroupPick one option, shown as dots or as selectable cards.