Add HTML note in UI component form field in Magento 2
Hello Guys!!!
In this blog, we are going to learn how we can display HTML content notice under a form field in the UI component form in Magento 2.
To display your required/desired content or notice, you can add the HTML code in the additional Info item in the form field as in the following code:
<field name="store_url">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">text</item>
<item name="label" xsi:type="string" translate="true">Store URL</item>
<item name="formElement" xsi:type="string">input</item>
<item name="dataScope" xsi:type="string">store_url</item>
<item name="required" xsi:type="boolean">true</item>
<item name="notice" xsi:type="string" translate="true">
Enter store URL name. For example: xyzshop
</item>
<strong><item name="additionalInfo" xsi:type="string"></strong>
<em><![CDATA[<span style="color:green">Your store URL will be like:</span> <a href="https://xyzshop.domain.com">https://xyzshop.domain.com</a>]]></em>
<strong></item></strong>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>
When you will add the HTML code in your form field, the result will be displayed in the following image:
Hope this UI component note add blog will be helpful.
Thanks 🙂
Categories:
Magento 2
Tags:
Add custom note in form field add custom notice in form field add custom notice in form field in ui component form add html notice in form field custom notice in ui component form
View Comments
Comment or Ask a Question
Quick Links