Question

In Magento 2 backend for a single page form, we can create form with simple HTML tag and we can also create form with UI components.

So what will be benefits to create a form with UI XML?

Was it helpful?

Solution

Using uiComponents allows you to leverage various tools/widgets. A good example is the datepicker widget. A very powerful feature, that can be used with a few lines of XML.

You also don't have to worry about styling, as all of that is abstracted away from you.

Dealing with data using data providers (although difficult to get the hang of at first) is extremely robust. Once you figure out how data providers and modifiers work, there's little that you can't do to extend Magentos core functionality.


Now, to be fair, it's not always a walk in the park. The XML is fairly verbose and the documentation is a bit obscure.

But if you want to stay in-line with Magento's framework and you want to be able to extend your functionality as the codebase changes, then you want to follow best practices and use the tools Magento gave us.

It may seem esoteric now, but as time goes by and the community grows, it will be easier and easier to leverage.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top