2

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?

1 Answer 1

7

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>

You must log in to answer this question.

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