Add Readonly field to ui component form Magento 2.

Using ui_component form.xml type, You can set a field with only Read-only or disabled access.

Field with read-only, Admin cants able to the editable field in UI form.

The field will be displayed for only read-only purposes.

To Set field readonly, You need to use <disabled> tag into field’s <settings> node.

You can add a read-only field to ui_component form using below way,

<field name="nickname" formElement="input">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="source" xsi:type="string">customer</item>

Here nickname field with text input type and only readOnly field. you can’t edit this field in Form.

<disabled>1</disabled> used to create field non editable.