0

I need to display a button which will display a text along with icon. I tried similar to below code

<lightning-button label="Delete">
    <lightning:icon icon-name="action:delete" size="small" class="icon">
    </lightning:icon>
</lightning-button>

But its displaying button with only text inside it. Is there any way to add both text and icon inside the button?

3

You just need to specify the label as well as the icon-name in the button.

<lightning-button
    variant="success"
    label="Approve"
    title="Approve"
    onclick={handleApprove}
    icon-name="utility:approval"
    class="slds-p-around_xxx-small">
</lightning-button>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.