Wednesday, August 21, 2019

How to add Lightning Web Components as Custom Tabs in Salesforce

Form Winter '20 onwards you can add the Lightning Web Component as Custom Tab in Salesforce.

The <component>.js-meta.xml configuration file defines the metadata values for the component.
Add the lightning__Tab target to the component’s configuration file.

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

Path:
From Setup, enter Tabs in the Quick Find box, and then click on New button in Lightning Components Tabs

 Then Select your LWC component.

Result

1 comment: