Navigate to Different Page Types
The navigation service supports different kinds of pages in Lightning. Each
PageReference type supports a different set of attributes and state properties. Both APIs support these
Let’s look at an example of how to create a button that navigates to a page.
Our sample has a
welcome component, which is a page in a Salesforce app. At the bottom of the page, there’s a
navtab component with the label Next. The
navtab component can be used at the bottom of each page to let the user navigate through the app.
c-nav-tab component customizes the
lightning-button component to navigate to the next page in the app. The consumer specifies a
tab-name and a
The lwc-recipes repo has lots of navigation examples. Check out the components named
This code shows examples of navigating to different types of pages in Lightning. These examples show how to create page reference objects of different types and navigate to those pages. You can also pass page references to the
[NavigationMixin.GenerateUrl](pageReference) API to retrieve a
promise that resolves to a URL for the page.