A signature field: sign with a finger, a pen or the mouse (pointer events), or type a name that is set in a handwriting font. The signature leaves as SVG text.
<.signature_pad field={@form[:signature]} label="Signature" />
<.signature_pad name="receipt" mode="type" text="Marcos Oliveira" locale="pt_BR" />
<.signature_pad name="sign" modes={["draw"]} height={220} />The form gets the SVG (<svg xmlns=... viewBox="0 0 W H"><path .../></svg>, "" while the pad
is empty) through a hidden input named like the field, and every stroke, typed letter or Clear
fires a bubbling input event from it. The drawing surface is client-owned
(phx-update="ignore" role="img" aria-label={@l.signature_area}); the hook LedgerUI.SignaturePad
(priv/static/ledger_ui/hooks/signature_pad.js) redraws it when the server sends another
value. Show a saved signature elsewhere as an image, never as raw markup:
<img src={"data:image/svg+xml;base64," <> Base.encode64(@signature)} alt="Signature" />confirm (a label) and on_confirm add a "confirm" button to the footer, as in the design.
Summary
Functions
Renders the signature pad.
Functions
Renders the signature pad.
Attributes
id(:string) - Defaults tonil.name(:string) - Defaults tonil.value(:string)field(Phoenix.HTML.FormField) - Defaults tonil.label(:string) - Defaults tonil.label_class(:any) - Defaults tonil.help(:string) - Defaults tonil.errors(:list) - Defaults to[].mode(:string) - Defaults to"draw". Must be one of"draw", or"type".modes(:list) - Defaults to["draw", "type"].text(:string) - Defaults to"".ink(:string) - Defaults to"#0F172A".height(:integer) - Defaults to170.locale(:string) - Defaults to"en". Must be one of"en", or"pt_BR".labels(:map) - Defaults to%{}.disabled(:boolean) - Defaults tofalse.variant(:string) - Defaults to"canvas". Must be one of"canvas", or"classic".footer(:boolean) - Defaults totrue.confirm(:string) - Label of a confirm button in the footer. Defaults tonil.on_confirm(:string) - Defaults tonil.on_change(:string) - Defaults tonil.target(:any) - Defaults tonil.wrapper_class(:any) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.