In this post I am going to explain how to add hidden field in ui_component form in Magento 2.

Check the below example code snippet to add hidden field in ui_component.

<field name="id" formElement="hidden">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="dataType" xsi:type="string">text</item>
        </item>
    </argument>
</field>

Here formElement=”hidden” is used to create a hidden field.

If you want to check the UI component field then you can check it in Browser Console as its not visible in the form.

Thats it. Enjoy Magento 2!!