Button (Deprecated)

ui:button

Deprecated as of API version 47.0. We recommend migrating to Lightning Web Components and using the lightning-button component.

For Use In

Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App

We recommend using Lightning Web Components whenever possible. When migrating to Lightning Web Components, use lightning-button, lightning-button-icon, or lightning-button-icon-stateful. For button groups, use lightning-button-group.

For more information, see Aura Components in the ui Namespace Are Deprecated.

A ui:button component represents a button element that executes an action defined by a controller. To apply Lightning Design System styling, we recommend that you use lightning:button instead of ui:button.

Clicking the button triggers the client-side controller method set for the press event. The button can be created in several ways.

A text-only button has only the label attribute set on it.

An image-only button uses both the label and labelClass attributes with CSS.

The assistiveText class hides the label from view but makes it available to assistive technologies. To create a button with both image and text, use the label attribute and add styles for the button.

The previous markup for a button with text and image results in the following HTML.