0

I am trying to display an icon in a lightning component using LDS. I setup the svg helper, component, and renderer as per the LDS docs here. I also have a static resource stored in SalesForce. I am trying to reference it like this:

<c:svgIcon svgPath="/resource/sldsRight.png" category="standard" size="small" />

However, the icon does not appear. Is my path wrong, or do I have the wrong file type?

4

for icons I would recommend using standard salesforce provided components instead:

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

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_lightning_icon.htm

linked to the icons in that doc -

https://lightningdesignsystem.com/icons/

0

The svgIcon component is meant for SVG files, not JPG, PNG, GIF, or BMP resources. In Lightning, you still normally use <img> tags to display images. Please note that the resource name is incorrect; you normally just refer to it by its defined name, such as /resource/sldsRight. If you're using the icon zip file, you'd then refer the full path and extension, such as /resource/sldsicons/utility/right_60.png instead.

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.