Hello Magento Friends,

Today’s guide is about making the UI-component form field read-only in Magento 2.

UI component grid and form are very important in Magento 2. You can set write protection in the UI_component form field. Let’s see How to Add Readonly Field in the ui_component Form in Magento 2.

Steps to Add Readonly Field in ui_component Form in Magento 2:

Step 1: First create a ui_component file

For that use this guide – How to Create UI Component Grid and Form in Magento 2

Step 2: Now move to the below path

app/code/Vendor/Extension/view/adminhtml/ui_component/uiexample_form.xml

Edit the code snippet as follows

You have to add “<settings>” and “<disabled>1</disabled>” to make any field read-only. As you can see in the screenshot below, the country field is read only.

Readonly Field ui_component Form

Conclusion:

This way you can make any field read-only in the ui_component form in Magento 2. If you face any difficulty, freely connect with me through the comment section. Share the article further and stay updated with us.

Happy Coding!

Click to rate this post!
[Total: 3 Average: 3.7]