13

Followed the Trailhead tutorial and I still get the same error about svg.

The code I am using is taken from the Lightning Design System. I created the supporting files as specified in the tutorial. Here is a snippet of the Component code (just note not all the code is included since it came directly from the LDS. The error is (Failed to save undefined: No COMPONENT named markup://svg found : [markup://michelleemanuel:forecastPlanComponent]: Source). Some of the other responses I saw said to read the tutorial - I have gone down that path and it did not work. I am not invoking this from a Visualforce page but from a Component.

<table class="slds-table slds-table--bordered slds-max-medium-table--stacked-horizontal">

select all Opportunity Name Sort ....

3
  • I think you should check component names, may be there are some mismatch in name . also check the namespace as well. It will solve your problem. Feb 10, 2016 at 17:36
  • were you able to get the SVG tab working? if yes, could you please share the details? Feb 11, 2016 at 6:49
  • Okay, so I guess you have followed this link first and the issue is still persisting. SVG Icon Component Helper Would you please try replacing <svg> with <c:svg> in your component and check? Mar 6, 2017 at 6:56

2 Answers 2

16

Starting Spring '17, the svgIcon component has been deprecated in favor of the lightning:icon component

<aura:component>
    <lightning:icon iconName="action:approval" size="large" alternativeText="Indicates approval"/>
</aura:component>
1
  • This should be the accepted answer from Spring '17
    – markgarg
    Apr 16, 2018 at 14:14
4

You can't use the SVG tag directly with lightning components. You'll need to make a custom component for rendering SVGs. You can copy/paste this code from the Lightning Design System Site to make your own custom SVG component:

You'll need to use that component instead of the SVG tag.

2
  • 1
    Better to use the code from the Salesforce Lightning Design System site rather than Trailhead -- it's synched up with the GitHub repo, where Trailhead may not be: lightningdesignsystem.com/resources/… Feb 10, 2016 at 18:20
  • found the answer in the Lightning design system guide in that svg is not supported as defined as of now. I needed to create the svg component and then do the kludge to use it. It takes some guess work to determine the values for the attributes. I will do some more digging around the documentation to determine what works and what does not.
    – user28677
    Feb 10, 2016 at 18:37

You must log in to answer this question.

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