Skip to main content
Navigate to different home pages within Salesforce, including the standard home page, Chatter home, Files home, and custom navigation tabs.

Source

  • force-app/main/default/lwc/navToHome/navToHome.js
  • force-app/main/default/lwc/navToChatterHome/navToChatterHome.js
  • force-app/main/default/lwc/navToFilesHome/navToFilesHome.js
  • force-app/main/default/lwc/navToHelloTab/navToHelloTab.js

Standard Home Page

import { LightningElement } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';

export default class NavToHome extends NavigationMixin(LightningElement) {
    navigateToHome() {
        this[NavigationMixin.Navigate]({
            type: 'standard__namedPage',
            attributes: {
                pageName: 'home'
            }
        });
    }
}

Chatter Home

import { LightningElement } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';

export default class NavToChatterHome extends NavigationMixin(
    LightningElement
) {
    navigateToChatter() {
        this[NavigationMixin.Navigate]({
            type: 'standard__namedPage',
            attributes: {
                pageName: 'chatter'
            }
        });
    }
}

Files Home

import { LightningElement } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';

export default class NavToFilesHome extends NavigationMixin(LightningElement) {
    navigateToFilesHome() {
        this[NavigationMixin.Navigate]({
            type: 'standard__objectPage',
            attributes: {
                objectApiName: 'ContentDocument',
                actionName: 'home'
            }
        });
    }
}

Custom Navigation Tab

import { LightningElement } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';

export default class NavToHelloTab extends NavigationMixin(LightningElement) {
    navigateToHelloTab() {
        this[NavigationMixin.Navigate]({
            type: 'standard__navItemPage',
            attributes: {
                apiName: 'Hello'
            }
        });
    }
}
Extend your component with NavigationMixin to access navigation capabilities:
export default class NavToHome extends NavigationMixin(LightningElement) {
    // component code
}

PageReference Types

Named Pages

type
string
required
Set to standard__namedPage for standard Salesforce pages
attributes.pageName
string
required
The name of the page. Options include:
  • home - Standard home page
  • chatter - Chatter home page

Object Home Pages

type
string
required
Set to standard__objectPage for object home pages
attributes.objectApiName
string
required
The API name of the object (e.g., ‘ContentDocument’ for Files)
attributes.actionName
string
required
Set to home to navigate to the object’s home page
type
string
required
Set to standard__navItemPage for custom navigation tabs
attributes.apiName
string
required
The API name of the custom tab or navigation item
DestinationTypeAttributes
Standard Homestandard__namedPagepageName: 'home'
Chatter Homestandard__namedPagepageName: 'chatter'
Files Homestandard__objectPageobjectApiName: 'ContentDocument', actionName: 'home'
Custom Tabstandard__navItemPageapiName: '<TabApiName>'

Key Features

  • Navigate to standard home page
  • Navigate to Chatter feed
  • Navigate to Files home
  • Navigate to custom navigation tabs
  • Type-safe navigation with PageReference

Build docs developers (and LLMs) love