Activity › Forums › Salesforce® Discussions › Difference between and ?
-
Difference between and ?
Posted by saloni gupta on July 12, 2017 at 5:17 AMIn Lightning, we use <ui:button> and <Lightning: button/>. So what is the difference between these tags & when should we use them??
shariq replied 7 years, 9 months ago 4 Members · 3 Replies -
3 Replies
-
Hi Saloni
Lightning button
A lightning:button component represents a button element that executes an action in a controller. Clicking the button triggers the client-side controller method set for on click. Buttons can be either a label only, label and icon, body only, or body and icon. Use lightning:button Icon if you need an icon-only button.
UI button
A ui:button component represents a button element that executes an action defined by a controller. Clicking the button triggers the client-side controller method set for the press event
- [adinserter block='9']
-
Adding some points:
If you go thru the Lightning base components release notes, you will notice that the Base components are more of an extended implementation of the existing UI components.
here’s an extract of the related section
You can find base Lightning components in the lightning namespace to complement the existing ui namespace components. In instances where there are matching ui and lightning namespace components, we recommend that you use the lightning namespace component. The lightning namespace components are optimized for common use cases. Beyond being equipped with the Lightning Design System styling, they handle accessibility, real-time interaction, and enhanced error messages.
Thanks
-
Hi,
Note – <ui:button> is going to be deprecated by salesforce soon, so change ui tag to lightning one.
Hope this helps.
Log In to reply.