How to navigate to Lightning Component Tab/Web Tab using LWC?

How to navigate to Lightning Component Tab/Web Tab using LWC?

Sample Code:
import { api, LightningElement } from ‘lwc’;
import { NavigationMixin } from ‘lightning/navigation’;

export default class RecordPage extends NavigationMixin( LightningElement ) {

    @api recordId;

    openLightningTab() {

        console.log( ‘Inside the Open Tab’ );
        this[NavigationMixin.Navigate]({
            type: ‘standard__navItemPage’,
            attributes: {
                apiName: ‘Sample_LWC’
            },
            state: {
                c__strInput: ‘testing’,
                c__recId: this.recordId
            }
        });

    }

}

Leave a Reply