Having an afterRender in a Lightning Component makes the Icon not show in Lightning Base Component <lightning:button />

Here is a quick Test App:


<aura:application extends="force:slds" >
    <c:TestComponent />


<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId" access="global">
    <aura:attribute name="recordId" type="string" />

    <lightning:button type="button" variant="neutral" label="Download" title="Download" iconName="utility:download" iconPosition="left" onclick="{!c.clickMe}" />



    afterRender: function(component, helper) {


If we remove the afterRender function, the button icon only displays if I remove the afterRender function completely from renderer.js file.

| improve this question | | | | |

I belive that is happening because you are overriding the afterRender method and you are not calling the superAfterRender method.

The following code will work fine.


afterRender: function (component, helper) {
    // interact with the DOM here

This way you will be extending the default rendering functionality. Link

| improve this answer | | | | |

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.