21

I am trying to figure out how to add a Lightning Web Component to a Lightning tab. I have it on the Home Page, but I would like it to be on its own tab. I feel like there should be an option to expose it to the Lightning tabs. When I am in the Tabs section, I don't see my LWC listed.

3
  • 1
    You can if you have a Lighting Page Tab created.
    – Jayant Das
    Mar 14, 2019 at 15:27
  • @JayantDas how about lightning component tab? Mar 14, 2019 at 15:39
  • 1
    @PranayJaiswal as long as your LWC is wrapped within an Aura component, then Yes. Because you cannot really edit a Lighting (Aura) Component tab but only associate it with an aura component.
    – Jayant Das
    Mar 14, 2019 at 15:42

5 Answers 5

33

From Winter 20 release you are able to set it as Tab. All you need to do is:

  1. Open -meta.xml file from your LWC component
  2. Change is exposed to True: <isExposed>true</isExposed>
  3. Add <target>lightning__Tab</target>
  4. Open Tab from setup and under Lightning Component Tabs press New and select your LWC component.

Your file at the end should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>47.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__Tab</target>
    </targets>
</LightningComponentBundle>

As stated in comments, My Domain is a prerequisite to Lightning Component Tabs

1
  • 2
    fyi, My Domain is a prerequisite to Lightning Component Tabs
    – geeljire
    Feb 14, 2020 at 19:50
6

With Winter 20 release, we can create the Lightning Tab using LWC component. You will just have to add the below tag in the -meta.xml file of LWC component.

<target>lightning__Tab</target>
3
  • Although this will be good IF Salesforce does release this and their safe harbour statements mean you cannot rely on this info.
    – Tim
    Aug 16, 2019 at 8:42
  • It's available in Summer'20 Pre-Release Org. You can cross-verify there. Aug 17, 2019 at 10:36
  • 2
    Your answer is only partially correct. The full solution is on this link : salesforcecodecrack.com/2019/08/…
    – compski
    Oct 10, 2019 at 9:19
4

I was able to do this by:

  • Setup
  • Lightning App Builder
  • List item
  • Create a new App Page
  • Add the LWC to the page
  • Associate the page with an App
3
  • 2
    Funny, this isn't the correct answer to your own question.
    – compski
    Oct 10, 2019 at 9:19
  • @compski I don't understand your comment. The solution I listed was a way to accomplish what I needed. I put the LWC on a page, added the page to an app, and then assigned the app to a tab. Oct 11, 2019 at 10:59
  • Why do you need to put LWC on a page to then assign it to a tab? Your question after all was "When I am in the Tabs section, I don't see my LWC listed." This article shows you how to have it on Tab section and have ur LWC listed salesforcecodecrack.com/2019/08/…
    – compski
    Oct 13, 2019 at 6:07
1

So far (Spring '19), using a Lightning web component inside a tab isn't supported, as listed here.

What you can do is wrap it inside an aura component, and create a tab for it.

0

I was facing the same problem, after tried various solutions, I noticed in Setup -> Tabs is a link for help: https://help.salesforce.com/articleView?id=dev_tabdef.htm&type=5, there say for see Lightning Component Tabs you need a deployed my domain:

NOTE To expose Lightning components via Lightning component tabs, you must enable and deploy My Domain.

I deployed My Domain in Setup-> My Domain and then in tabs appears the option Lightning Component Tabs

You must log in to answer this question.

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