I'd like to display a "header" for those instances where my Lightning component is not displayed in a tab, but directly on the page. Is there a way to determine if a Lightning component is being displayed in a tab?

enter image description here

  • What is the difference here between a tab and a page? Is your tab a custom tab that you have created and is the page a record page?
    – Jayant Das
    Commented May 14, 2019 at 13:51
  • @JayantDas the tab would be the Standard Lightning component you add to a Lightning page. Its called "Tabs". Commented May 14, 2019 at 14:13
  • @JayantDas I added a picture to show what I'm referring to. Commented May 14, 2019 at 14:18

2 Answers 2


Let me offer you another approach.

Instead of trying to figure out where a component is dropped, think about exposing a design attribute on your component that will allow users to show or hide the header manually when they manipulate it in the App Builder.


<aura:component implements="flexipage:availableForAllPageTypes" access="global" >

    <aura:attribute name="showHeader" type="boolean" />

    <aura:if isTrue="{!v.showHeader}">
        <h1>This is a header</h1>

    <div>Something else</div>



    <design:attribute name="showHeader" label="Show Header?" default="false"/>

The above code will result in Show Header? property being available to a user in the Lightning App Builder:

enter image description here

  • 1
    I like this approach. I hadn't used design attributes much, but this makes a lot of sense in this context. Thanks! Commented Jun 5, 2019 at 20:29

So in layman's term, you want to determine what is the parent of your child component.

No, This is not possible and this should never be possible as this contains a great security risk. Imagine any rogue app exchange application reading the parent's component data(in your case tabs) and doing the malicious operation.

The aura framework will never have a way for you to get the parent component. That breaks encapsulation.

That being said, why should a component behave differently based on where its dropped? The component should expose a few properties which parent can fill in and change behavior if needed.

  • I'm not sure what you are saying makes sense. Using the workspaceAPI from within an Aura Lightning component, I can get tabs in the current console. Would that not be a security risk, as you put it? Commented Jun 5, 2019 at 20:11
  • Workspace API allows you to open, close tabs but does not allow you read content. On little subset of funtions which wont posses security risk are allowed Commented Jun 5, 2019 at 20:21

You must log in to answer this question.

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