Skip to content

How to limit text parameter in the custom widget with 20 characters

i created the custom widgets for M2.
Now i want to limit the text parameter to 20 characters in length, with a validation error if this value is exceeded.

Here is the part of my widget.xml

<parameter name="short_title" xsi:type="text" visible="true" required="false" sort_order="1">
                <label translate="true">Short title</label>
                <description>Set Short Title for Google Analytics, max 20 Characters</description>
</parameter>

How can I do this?