0

I currently had a button

<lightning:button variant="brand" label="Sign to Facebook" onclick="{!c. handleLogin}"/>

You might be knowing the output of the above button that is displayed in blue color which is because of the variant = brand

But I am trying to place a custom image( downloaded from Google and stored in static resource) to that lightning:button. Any idea on how to place the image

1 Answer 1

1

You cannot do it with a Base Component. You will have to use SLDS and HTML to accomplish the same.

  <button class="slds-button slds-button_neutral">
    <img src="https://cdn3.iconfinder.com/data/icons/strokeline/128/revisi_01-16.png" />
    <span class="slds-p-left_xx-small">
      Login
    </span>
  </button>

Demo: https://codepen.io/sfdc2022/pen/WNdLNoW

1
  • You can use lightning-icon with added behaviour in order to have a button that uses an icon from a static resource via the src attribute. This is the LWC version, sorry, but Aura version available too I think.
    – Phil W
    Apr 17, 2022 at 17:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .