Button
Represents a button element.
Descriptor
lightning:buttonTargets
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out / Visualforce, Standalone Lightning App
Example Options
Basic ButtonsButton variants displaying different colors Disabled ButtonsButtons that are disabled can't be clicked Buttons with IconsButtons with icons for decorative purposes Inverse VariantButtons on a dark background use the inverse variant Buttons with Accesskey and Tabindex AttributesButtons with access key shortcuts and tabindex
Basic Buttons
Code
<aura:component> <!-- Base variant: Makes a button look like a link --> <lightning:button variant="base" label="Base" title="Base action" onclick="{! c.handleClick }"/> <!-- Neutral variant (default) --> <lightning:button label="Neutral" title="Neutral action" onclick="{! c.handleClick }"/> <!-- Brand variant: Identifies the primary action in a group of buttons --> <lightning:button variant="brand" label="Brand" title="Brand action" onclick="{! c.handleClick }" /> <!-- Brand-outline variant: Identifies the primary action in a group of buttons, but has a lighter look --> <lightning:button variant="brand-outline" label="Brand Outline" title="Brand action" onclick="{! c.handleClick }" /> <!-- Destructive variant: Identifies a potentially negative action --> <lightning:button variant="destructive" label="Destructive" title="Destructive action" onclick="{! c.handleClick }"/> <!-- Destructive-text variant: Identifies a potentially negative action, but has a lighter look --> <lightning:button variant="destructive-text" label="Destructive Text" title="Destructive action" onclick="{! c.handleClick }"/> <!-- Success variant: Identifies a successful action --> <lightning:button variant="success" label="Success" title="Success" onclick="{! c.handleClick }"/> </aura:component>