0

I am trying to use USE tag as its is given in many slds docs,

Here is how it is given in SLDS doc

 <svg class="slds-button__icon" aria-hidden="true">
        <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#success"></use>
      </svg>

Here is how I tried using

  1. Tried using svgIcon component, but no success.
  2. Tried HTML but no success

    <c:svgIcon svgPath="/assets/icons/utility-sprite/svg/symbols.svg#success"><c/:svgIcon>
    

    enter image description here

Please let me know what should be used other then "use" tag as salesforce doesn't support that I guess.

2 Answers 2

4

Lightning doesn't currently support svg directly, but you can use lightning:icon or lightning:buttonIcon for SLDS icons and button icons, as appropriate. If SLDS wants a button, use a lightning:buttonIcon, and if you just need the image, you can use lightning:icon.

<lightning:icon iconName="utility:success" />

<lightning:buttonIcon iconName="utility:success" />
0

As answered by sfdcfox, use lightning:icon tag. Or else refer the link below to create a svg component: http://hellosnl.blogspot.in/2017/07/including-svg-in-lightning-component.html

You must log in to answer this question.

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