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
Javier CastroJavier Castro 

Is there any way to put an icon inside an accordionSection as label?

Hi, I am new in Salesforce and now I am learning about lightning components.
I have this code:
<aura:component controller="AcordeonControlador"> 
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> 
    <aura:attribute name="lstAcc" type="List"/>
    <lightning:accordion>
        <aura:iteration items="{!v.lstAcc}" var="acc">
            <lightning:accordionSection name="{!acc.Name}" label="{!acc.Name}">
                <lightning:icon iconName="standard:account"/>
                <p>Telefono: {!acc.Phone}</p>
                <p>Dirección: {!acc.ShippingStreet}</p>
                <p>Ciudad: {!acc.ShippingCity}</p>
                <p>Estado: {!acc.ShippingState}</p>
                <p>Codigo postal: {!acc.ShippingPostalCode}</p>
                <p>Pais: {!acc.ShippingCountry}</p>
            </lightning:accordionSection>
        </aura:iteration>
    </lightning:accordion>   
</aura:component>
I would like to set the label of the accordionSection as: icon + text.
Is there any way to do this?
Thanks in advance.
 
Best Answer chosen by Javier Castro
Nayana KNayana K
No, there is no way as of now. I also came across this situation 1month back. You have to copy https://www.lightningdesignsystem.com/components/accordion/#content structure and add the icon instead of lightning base component .

All Answers

Nayana KNayana K
No, there is no way as of now. I also came across this situation 1month back. You have to copy https://www.lightningdesignsystem.com/components/accordion/#content structure and add the icon instead of lightning base component .
This was selected as the best answer
Javier CastroJavier Castro
Aaaah, ok, I will try that, it seems it should works. Thanks for your reply!!