function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rohini Krishnan 10Rohini Krishnan 10 

lightning tree need image in child

Hello Team,


We are currently using <lightning:tree  to display Account Hierarchy Data. Customer has a requirement where they want to show icons beside type of record in the tree and also highlight with different color based on the account record type. Is there a way to accomplish this using <lightning:tree itself and not redoing with Trees?



        <lightning:tree items="{!v.items}" />


Try using like below
<lightning:tree items="{! v.items }"  onselect="{!c.handleSelect}" >

       <img src="{!$Resource.generic_profile_svg}"/>


Rohini Krishnan 10Rohini Krishnan 10
Hi Tripathi thanks. The images are dynamic. Based on record type we need to give different image. Is it possible. 
you can try using <aura:if> and display the images based on the Account record, or create a wrapper which and use the list of wrapper in the <lightning:tree and then show images and account record in you lightinng:tree

The wrapper will have Account and image link, if you don't have image link and create a formula field on Account which will have image link in it.
And then use the value of the formula field in the lighting:tree.

Please let me know if you have any queries.