How to create popup in magento 2?

In Magento 2 We can simply call modal popup using default modal.js library.
Create phtml(template) file,

In above Template file we can show popup based on click on chart link. When click on chart link defined in our DOM element popup modal will be displayed.

CallĀ Magento_Ui/js/modal/modal object in your require dependency.

There are many default options are available for modal.js file.
Different types of optios you can pass as per your requirement in above options object.
List of default options for modal popup, if you want to override default value set options value in your custom template in options object.

 

Leave a Reply

Your email address will not be published. Required fields are marked *