Skip to main content
1 of 2
Pranay Jaiswal
  • 36.4k
  • 17
  • 79
  • 138

I have a way to do that, not sure if its the best.

Whenever you open the component in appbuilder, the window.location.href contains flexipageEditor/surface.app? . You can use that to your advantage.

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
        
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="isAppBuilder" type="String" default="false"></aura:attribute>
    
    
    <aura:if isTrue="{!v.isAppBuilder}">
        My Component in App Builder
    </aura:if>

</aura:component>

JS:

({
    
    doInit : function(component, event, helper){
        if(window.location.href.includes('flexipageEditor/surface.app?') ){
            console.log('In App Builder');
            component.set("v.isAppBuilder" , true);
        }else{
             console.log('Not App Builder');   
        } 
    }
})

So here your isTrue block will only show if your app is viewed in app builder.

Pranay Jaiswal
  • 36.4k
  • 17
  • 79
  • 138