1

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.

  • 1
    You can if you have a Lighting Page Tab created. – Jayant Das Mar 14 '19 at 15:27
  • @JayantDas how about lightning component tab? – Pranay Jaiswal Mar 14 '19 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 '19 at 15:42
1

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>
2

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>
  • 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 '19 at 8:42
  • It's available in Summer'20 Pre-Release Org. You can cross-verify there. – Hemant Keni Aug 17 '19 at 10:36
  • 2
    Your answer is only partially correct. The full solution is on this link : salesforcecodecrack.com/2019/08/… – compski Oct 10 '19 at 9:19
1

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
  • Funny, this isn't the correct answer to your own question. – compski Oct 10 '19 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. – Michele Kleinhomer Oct 11 '19 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 '19 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.

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.