Skip to main content
SignatureField ← Back to Table of Contents

Summary

Canvas signature pad storing normalized SVG markup. Supports undo, fullscreen, optional download (SVG/WebP), and stroke validation.

Mobile, touch & stylus (enterprise)

SignatureField uses the Pointer Events API — one code path for mouse, finger, and active stylus: Toolbar icon buttons expose Filament tooltips (same copy as aria-label) and use larger hit targets on coarse pointers (@media (pointer: coarse)). Note: passive capacitive styluses (no pressure, reported as touch) behave like finger input. Palm rejection is handled by single-pointer capture — only one active stroke at a time.

Basic usage

Read-only preview of an existing signature:

State format

State is a compact SVG string produced by SignatureSvg::normalize(). null or empty string means no signature. Use normalizeState(mixed $state): ?string to sanitize external SVG before setting state. Enterprise e-sign metadata via Media Ingress:
On save, legalMetadataIn receives: legalPack() requires visible ink (SignatureLegalPack::requiresInk()).

Validation

Configuration API

penColor(string|Closure $color)

Hex pen color. Default: #18181b. Must match #RGB or #RRGGBB.

penWidth(float|Closure $width)

Stroke width in SVG units. Clamped to 0.5–12. Default: 2.5.

backgroundColor(string|Closure|null $color)

Canvas background hex, or null / 'transparent' for transparent. Default: #ffffff. When left at the default, the pad follows Filament dark mode in the UI (dark zinc pad, light ink) while exported SVG/WebP still uses a white background for document output. Set an explicit hex to lock both display and export.

fullscreen(bool|Closure $condition = true)

Enable fullscreen drawing mode. Default: true.

undoable(bool|Closure $condition = true)

Show undo control. Default: true.

maxSizeKb(int|Closure $kilobytes)

Maximum stored SVG size in kilobytes. Default: 48.

minStrokes(int|Closure $strokes)

Minimum number of SVG paths required. Default: 1.

viewBox(int|Closure $width, int|Closure $height)

SVG viewBox dimensions. Defaults from SignatureSvg::VIEWBOX_WIDTH / VIEWBOX_HEIGHT.

smoothing(bool|Closure $condition = true)

Bezier smoothing on strokes. Default: true.

trackpadGlide(bool|Closure $condition = true)

Hold modifier key to draw with trackpad without clicking. Default: false.

trackpadGlideKey(string|Closure $key)

Single letter a–z for glide modifier. Default: d.

guidelines(bool|Closure $condition = true)

Show baseline guidelines on canvas. Default: false.

downloadable(string|Closure|null $format = 'svg')

Enable client-side download. Formats: SignatureField::DOWNLOAD_SVG or SignatureField::DOWNLOAD_WEBP. Pass null to disable.

downloadFilename(string|Closure $filename)

Download file base name without extension. Default: signature.

webpQuality(float|Closure $quality)

WebP export quality 0.1–1. Default: 0.9.

undoIcon() / clearIcon() / downloadIcon() / fullscreenIcon() / closeIcon()

Override toolbar icons (string|BackedEnum|Htmlable|Closure|null).

readOnly(bool|Closure $condition = true)

Disable drawing; display existing SVG only.

Public helper methods

FlexField schema config

CSS classes

Implementation notes

  • Store SVG in text or longText columns; consider maxSizeKb() for DB limits.
  • WebP download is generated client-side from the canvas — not stored in form state.

Playground

Slug: signature-field /admin/flex-fields-playground/signature-field — see Playground.