I am new to SForce lightning, i have added svgIcon component as described by the link: https://www.lightningdesignsystem.com/resources/lightning-svg-icon-component-helper/

But when i try:

<c:svgIcon svgPath="/resource/slds214/assets/icons/standard-sprite/svg/symbols.svg#user" category="standard" size="large" name="user" />

It does not display icon??? on developer console it displays as 404 error??

Aren't following icons are available for development? https://www.lightningdesignsystem.com/icons/


The new, preferred method is to use lightning:icon or lightning:buttonIcon. If you insist on using svgIcon, make sure you have the right resource path. Static resources are available in Lightning, but you have to make sure you have the path just right. Most likely, you meant to write: /resource/slds214/icons/standard-sprites/svg/symbols.svg#user instead, but you'll want to check the zip file to confirm this.

| improve this answer | |
  • so does these components are still valid?? lightningdesignsystem.com/components/lookups , all of these are using tag svg – dev.sforce Dec 13 '16 at 6:00
  • @dev.sforce svgIcon still works, I have it scattered through my projects, but I've been converting them to lightning:icon as appropriate, with the hope of one day removing the static resource entirely. – sfdcfox Dec 13 '16 at 6:01
  • what do i need to get svgIcon working with following components? lightningdesignsystem.com/components/lookups – dev.sforce Dec 13 '16 at 6:02
  • @dev.sforce Replace the entire svg structure with the relevant lightning:icon, like this: <lightning:icon iconName="utility:search" />, or use svgIcon where the use xlink:href is moved up to the svgPath attribute of the svgIcon. I strongly recommend the former solution, as svgIcon was only meant to be a crutch until it wasn't needed. – sfdcfox Dec 13 '16 at 6:05

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.