5

When extending an app using force:slds

<aura:application extends="force:slds">
    <!--component reference>
</aura:application>

This should give me the logo instead of the alt text, is this a right assumption?

<aura:component>
    <div class="slds-global-header__logo">
        <img src="/assets/images/logo-noname.svg" alt="test" />
    </div>
</aura:component>

1 Answer 1

9

$Asset is the merge variable to use images or SVG from the design systems .Try below code

<img src="{!URLFOR($Asset.SLDS, 'assets/images/logo-noname.svg.jpg')}" alt="test" />

Update

For lightning components use the lightning:avatar

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

<aura:component>
   <lightning:avatar src="/images/logo-noname.svg" alternativeText="Codey Bear"/>
</aura:component>
8
  • 2
    That's new, isn't it? A very nice addition to the platform.
    – sfdcfox
    Commented Mar 6, 2017 at 20:57
  • Yes thats new addition Commented Mar 6, 2017 at 21:21
  • @MohithShrivastava Sorry for unmarking this answer from solved. The URLFOR Is not supported in lightning components :(, I get an error "No function found for key: URLFOR: Source" success.salesforce.com/ideaView?id=08730000000Lh2GAAS
    – Rao
    Commented Mar 6, 2017 at 21:43
  • 1
    lightning:icon and Avatar should cover most of the cases Commented Mar 6, 2017 at 22:53
  • 2
    Lightning:Avatar worked :). Thanks again for the help Mohith
    – Rao
    Commented Mar 6, 2017 at 23:35

You must log in to answer this question.

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