PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, August 23, 2022

[FIXED] How to use Magento 2 UI components in a custom module?

 August 23, 2022     magento2     No comments   

Issue

I'm trying to use Magento 2.4 UI components on a custom module. As per the documentation, I should add a dependency for the Magento_UI module:

To use UI components in your custom module, you need to add a dependency for the Magento_UI module in your component’s composer.json file.

https://devdocs.magento.com/guides/v2.4/ui_comp_guide/bk-ui_comps.html

How can I do that? I've tried to add the following line in my composer.json but this is obviously not the right syntax:

    "require": {
        "Magento_UI": "*"
    },

Solution

To require a Magento module in your composer.json, you just need to add the required line in the "require" section of your composer.json:

{
    ...
    "require": {
        "magento/module-ui": "*"
    },
    ...
}

You can find the list of Magento modules here: https://devdocs.magento.com/guides/v2.4/architecture/archi_perspectives/components/modules/mod_depend.html#hard-dependencies

  ...
  "require": {
    "magento/module-catalog": "103.0.*",
    "magento/module-email": "101.0.*",
    "magento/module-media-storage": "100.3.*",
    "magento/module-store": "101.0.*",
    "magento/module-theme": "101.0.*",
    "magento/module-ui": "101.1.*",
    "magento/module-variable": "100.3.*",
    "magento/module-widget": "101.1.*",
    "magento/module-authorization": "100.3.*"
   }
   ...


Answered By - Puka
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

1,204,519

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © 2025 PHPFixing