Signature Element

A form example demonstrating how to use the SignatureElement field in VueForm Laravel to allow users to draw and submit their digital signature in a Laravel form. Documentation


🧱 Import Class

use VueFormLaravel\Abstracts\VueFormBuilder;
use VueFormLaravel\Elements\Fields\SignatureElement;
use VueFormLaravel\Elements\Vueform;

🧩 Example

class SignatureElementForm extends VueFormBuilder
{
    protected function buildForm()
    {
        return Vueform::build()
            ->schema([
                SignatureElement::name('signature')
                    ->label('Signature')
                    ->placeholder('Please sign here...')
                    ->description('Use the field above to draw your signature. This will be submitted as part of the form data.')
            ]);
    }
}

⚙️ Allowed Attributes

Name Data Type Default Example
accept array ["jpg","png","svg"] SignatureElement::name("name")->accept()
addClass array|object|string|function null SignatureElement::name("name")->addClass()
addClasses object|function {} SignatureElement::name("name")->addClasses()
after object|string|number null SignatureElement::name("name")->after()
autoload boolean true SignatureElement::name("name")->autoload()
before object|string|number null SignatureElement::name("name")->before()
between object|string|number null SignatureElement::name("name")->between()
canClear boolean true SignatureElement::name("name")->canClear()
canDrop boolean true SignatureElement::name("name")->canDrop()
canUndo boolean true SignatureElement::name("name")->canUndo()
colors array ["#000000","#2558b2","#f22f30"] SignatureElement::name("name")->colors()
columns object|string|number null SignatureElement::name("name")->columns()
conditions array [] SignatureElement::name("name")->conditions()
debounce number null SignatureElement::name("name")->debounce()
default string|number|object null SignatureElement::name("name")->default()
description string|object null SignatureElement::name("name")->description()
disabled boolean|function|array|object false SignatureElement::name("name")->disabled()
displayErrors boolean true SignatureElement::name("name")->displayErrors()
fieldName string|object name label
fonts array ["Caveat@400","Sacramento@400","Dancing Script@400"] SignatureElement::name("name")->fonts()
formatData function null SignatureElement::name("name")->formatData()
formatLoad function null SignatureElement::name("name")->formatLoad()
height number 160 SignatureElement::name("name")->height()
id string null SignatureElement::name("name")->id()
info string|object null SignatureElement::name("name")->info()
infoPosition string right SignatureElement::name("name")->infoPosition()
inline boolean false SignatureElement::name("name")->inline()
invertColors array ["#000000"] SignatureElement::name("name")->invertColors()
label string|object|function null SignatureElement::name("name")->label()
line boolean true SignatureElement::name("name")->line()
maxFontSize number 60 SignatureElement::name("name")->maxFontSize()
maxSize number 2048 SignatureElement::name("name")->maxSize()
maxWidth number|string auto SignatureElement::name("name")->maxWidth()
messages object {} SignatureElement::name("name")->messages()
minFontSize number 10 SignatureElement::name("name")->minFontSize()
modes array ["draw","type","upload"] SignatureElement::name("name")->modes()
name string|number undefined SignatureElement::name("name")->name()
overrideClass array|object|string|function null SignatureElement::name("name")->overrideClass()
overrideClasses object|function {} SignatureElement::name("name")->overrideClasses()
placeholder string|object|boolean null SignatureElement::name("name")->placeholder()
presets array [] SignatureElement::name("name")->presets()
readonly boolean|function|array|object false SignatureElement::name("name")->readonly()
removeClass array|object|function null SignatureElement::name("name")->removeClass()
removeClasses object|function {} SignatureElement::name("name")->removeClasses()
replaceClass object|function null SignatureElement::name("name")->replaceClass()
replaceClasses object|function {} SignatureElement::name("name")->replaceClasses()
rules array|string|object null SignatureElement::name("name")->rules()
size string undefined SignatureElement::name("name")->size()
slots object {} SignatureElement::name("name")->slots()
submit boolean true SignatureElement::name("name")->submit()
templates object {} SignatureElement::name("name")->templates()
uploadHeight number 160 SignatureElement::name("name")->uploadHeight()
uploadWidth number 480 SignatureElement::name("name")->uploadWidth()
view string undefined SignatureElement::name("name")->view()
views object {} SignatureElement::name("name")->views()

⚡ Events

You can define custom signature element events Documentation directly in PHP using the ->events() method.

Each event value refers to a JavaScript function name.

These functions must be defined inside:

public/vueform-laravel/vueform-custom.js

This allows you to extend or override default behaviors for your generated VueForm components

Name Parameters Description
reset - {component} el$ - the element's component Triggered when the input is resetted.
clear - {component} el$ - the element's component Triggered when the input is cleared.
change - {string} newValue - the new value
- {string} oldValue - the old value
- {component} el$ - the element's component
Triggered when the element's value is changed.
beforeCreate - {component} el$ - the element's component Triggered in beforeCreate hook.
created - {component} el$ - the element's component Triggered in created hook.
beforeMount - {component} el$ - the element's component Triggered in beforeMount hook.
mounted - {component} el$ - the element's component Triggered in mounted hook.
beforeUpdate - {component} el$ - the element's component Triggered in beforeUpdate hook.
updated - {component} el$ - the element's component Triggered in updated hook.
beforeUnmount - {component} el$ - the element's component Triggered in beforeUnmount (or beforeDestroy in Vue 2) hook.
unmounted - {component} el$ - the element's component Triggered in unmounted (or destroyed in Vue 2) hook.

🔔 Example Usage of event (PHP)

SignatureElement::name('example')
    ->events([
        'reset' => 'handleReset',
        'clear' => 'handleClear',
        'change' => 'handleChange',
        'beforeCreate' => 'handleBeforeCreate',
        'created' => 'handleCreated',
        'beforeMount' => 'handleBeforeMount',
        'mounted' => 'handleMounted',
        'beforeUpdate' => 'handleBeforeUpdate',
        'updated' => 'handleUpdated',
        'beforeUnmount' => 'handleBeforeUnmount',
        'unmounted' => 'handleUnmounted',
    ])

🔔 Example Usage of event(JavaScript)

function handleReset(el$) {
    // Your code here
}
function handleClear(el$) {
    // Your code here
}
function handleChange(newValue, oldValue, el$) {
    // Your code here
}
function handleBeforeCreate(el$) {
    // Your code here
}
function handleCreated(el$) {
    // Your code here
}
function handleBeforeMount(el$) {
    // Your code here
}
function handleMounted(el$) {
    // Your code here
}
function handleBeforeUpdate(el$) {
    // Your code here
}
function handleUpdated(el$) {
    // Your code here
}
function handleBeforeUnmount(el$) {
    // Your code here
}
function handleUnmounted(el$) {
    // Your code here
}

⚡ Slots

The following slots Documentation are available for this element:

Name Scope Description
label - {component} el$ - the element's component Renders a label for the element in ElementLabel component.
info - {component} el$ - the element's component Renders an info icon in ElementInfo component next the the element label. When the icon is hovered it shows the content of this slot. The element needs to have a label to render this.
required -
description - {component} el$ - the element's component Renders description for the element in ElementDescription component.
before - {component} el$ - the element's component Renders an ElementText component before the input field.
between - {component} el$ - the element's component Renders an ElementText component after the input field and before description.
after - {component} el$ - the element's component Renders an ElementText component after the description and error.
addon-before - {component} el$ - the element's component Prepends an addon to the input field.
addon-after - {component} el$ - the element's component Appends an addon to the input field.