How to customize Button UI component in Magento 2

  • Post author:
  • Post category:Magento 2

To add custom CSS style to button UI component you need to add buttonClasses configuration option to the component. additionalClasses option does not work for buttons. 

To add custom CSS to Magento 2 you need to create YourModule/view/area/web/css/source/_extend.less or YourModule/view/area/web/css/source/_module.less file with you CSS. For example

To be able to display button as link on frontend you need to add following CSS to you _module.less or _extend.less file

And you need to set your displayAsLink button configuration option as true in your ui component.xml file