{"id":1690,"date":"2026-09-25T09:00:00","date_gmt":"2026-09-25T03:30:00","guid":{"rendered":"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/"},"modified":"2026-11-15T11:32:42","modified_gmt":"2026-11-15T06:02:42","slug":"lwc-navigation-toasts-modals","status":"publish","type":"post","link":"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/","title":{"rendered":"LWC Navigation, Toasts and Modals Explained with Examples"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">LWC Navigation, toasts and modals are the three tools that make a component feel like part of Salesforce. First, navigation moves the user to a record, list or tab. Toasts show a short message, such as &#8220;Enrolment saved&#8221;. Modals open a focused dialog, such as a confirmation, on top of the page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this post, you will learn NavigationMixin and page references, the lightning\/toast module, and the LightningModal base class. It builds on <a href=\"https:\/\/swapnilzambare.com\/blog\/lwc-lifecycle-hooks\/\">LWC lifecycle hooks<\/a>, <a href=\"https:\/\/swapnilzambare.com\/blog\/call-apex-from-lwc-wire-imperative\/\">calling Apex from LWC<\/a> and <a href=\"https:\/\/swapnilzambare.com\/blog\/lwc-custom-events-child-to-parent\/\">LWC custom events<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is LWC Navigation?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">LWC Navigation is the way a component sends users to another page in Lightning Experience, the Salesforce mobile app or an Experience Cloud site. You describe the destination as a page reference object, such as a record page with a recordId, and call NavigationMixin.Navigate. Salesforce then opens the right page in the right app.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Think of a taxi app. You do not give the driver a route, only the destination. Instead, the app knows the roads, traffic and city. A page reference is the destination, and NavigationMixin is the driver who knows the roads in every Salesforce app.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why LWC Navigation, Toasts and Modals Matter<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In practice, users need to move, get feedback and confirm actions. Here is why LWC Navigation, toasts and modals matter at Bright Path Tutors.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, after enrolling, the tutor should jump to the new enrolment record.<\/li>\n\n<li>Also, a success toast should confirm the save without blocking the screen.<\/li>\n\n<li>Next, cancelling a paid enrolment needs a confirmation dialog first.<\/li>\n\n<li>Also, hard-coded URLs break in the mobile app and Experience Cloud.<\/li>\n\n<li>Finally, standard toasts and modals look and behave like the rest of Salesforce.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">So LWC Navigation, toasts and modals give components a native, polished feel.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How LWC Navigation Works<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">LWC Navigation follows a few steps. First, you extend your class with NavigationMixin(LightningElement). Next, you build a page reference with a type, such as standard__recordPage, and attributes, such as recordId and actionName. Then you call this<a href=\"pageRef\" target=\"_blank\" rel=\"noopener noreferrer\">NavigationMixin.Navigate<\/a>. After that, Salesforce works out the right URL for the current app. Finally, it opens the page, either in the same tab or a console subtab.<\/p>\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-diagram-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-diagram-1-1024x640.png\" alt=\"LWC Navigation diagram showing mixin, page reference, call, resolve and open\" class=\"wp-image-1688\" srcset=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-diagram-1-1024x640.png 1024w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-diagram-1-300x188.png 300w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-diagram-1-768x480.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">How a page reference becomes an open page.<\/figcaption><\/figure>\n\n\n<h3 class=\"wp-block-heading\">Page References<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Every page reference has a type and attributes. For example, common types are standard__recordPage, standard__objectPage, standard__navItemPage and standard__webPage.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">GenerateUrl<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">this<a href=\"pageRef\" target=\"_blank\" rel=\"noopener noreferrer\">NavigationMixin.GenerateUrl<\/a> returns a promise with a URL. Use it for links, such as an anchor tag or a link inside a toast.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Toasts with lightning\/toast<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">LightningToast.show({ label, message, variant }, this) shows a toast. Also, the variant can be info, success, warning or error. Salesforce now prefers lightning\/toast, because it also works where the older ShowToastEvent does not, such as LWR sites.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Modals with LightningModal<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A modal is its own component that extends LightningModal. So its template uses lightning-modal-header, lightning-modal-body and lightning-modal-footer. Then the caller opens it with MyModal.open({&#8230;}), which returns a promise with the result.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Closing a Modal<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Inside the modal, call this.close(result). As a result, the value you pass becomes what the caller receives.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common Page Reference Types<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The table below lists page references you will use most.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Type<\/th><th>Key attributes<\/th><th>Opens<\/th><\/tr><\/thead><tbody><tr><td>standard__recordPage<\/td><td>recordId, actionName<\/td><td>A record view or edit page<\/td><\/tr><tr><td>standard__objectPage<\/td><td>objectApiName, actionName<\/td><td>An object list or New page<\/td><\/tr><tr><td>standard__navItemPage<\/td><td>apiName<\/td><td>A custom tab<\/td><\/tr><tr><td>standard__webPage<\/td><td>url<\/td><td>An external web page<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Toast vs Modal<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Next, the table below compares toasts and modals.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Feature<\/th><th>Toast<\/th><th>Modal<\/th><\/tr><\/thead><tbody><tr><td>Blocks the page<\/td><td>No<\/td><td>Yes<\/td><\/tr><tr><td>User input<\/td><td>None<\/td><td>Buttons and fields<\/td><\/tr><tr><td>Disappears<\/td><td>Automatically, by default<\/td><td>When closed<\/td><\/tr><tr><td>Typical use<\/td><td>Success or error messages<\/td><td>Confirmations and small forms<\/td><\/tr><tr><td>API<\/td><td>lightning\/toast<\/td><td>lightning\/modal<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">When to use which is simple. So use a toast to tell users what happened. Use a modal when users must decide or enter something before you continue.<\/p>\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-diagram-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-diagram-2-1024x640.png\" alt=\"LWC Navigation diagram comparing toasts and modals\" class=\"wp-image-1689\" srcset=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-diagram-2-1024x640.png 1024w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-diagram-2-300x188.png 300w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-diagram-2-768x480.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Toast vs modal.<\/figcaption><\/figure>\n\n\n<h2 class=\"wp-block-heading\">A Real LWC Navigation Example<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s combine LWC Navigation, a toast and a modal at Bright Path Tutors. A tutor clicks Cancel enrolment, confirms in a modal, sees a toast, and lands on the course record.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: The Modal Component<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ confirmCancelModal.js\nimport { api } from 'lwc';\nimport LightningModal from 'lightning\/modal';\n\nexport default class ConfirmCancelModal extends LightningModal {\n    @api studentName;\n\n    handleYes() { this.close('yes'); }\n    handleNo() { this.close('no'); }\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!-- confirmCancelModal.html --&gt;\n&lt;template&gt;\n    &lt;lightning-modal-header label=\"Cancel enrolment?\"&gt;&lt;\/lightning-modal-header&gt;\n    &lt;lightning-modal-body&gt;\n        Cancel the enrolment for {studentName}? This cannot be undone.\n    &lt;\/lightning-modal-body&gt;\n    &lt;lightning-modal-footer&gt;\n        &lt;lightning-button label=\"No\" onclick={handleNo}&gt;&lt;\/lightning-button&gt;\n        &lt;lightning-button label=\"Yes, cancel\" variant=\"destructive\"\n            onclick={handleYes} class=\"slds-m-left_x-small\"&gt;&lt;\/lightning-button&gt;\n    &lt;\/lightning-modal-footer&gt;\n&lt;\/template&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The modal extends LightningModal and receives studentName as an @api property. Then each button closes the modal and returns &#8220;yes&#8221; or &#8220;no&#8221;.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: The Calling Component<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import { LightningElement, api } from 'lwc';\nimport { NavigationMixin } from 'lightning\/navigation';\nimport LightningToast from 'lightning\/toast';\nimport ConfirmCancelModal from 'c\/confirmCancelModal';\nimport cancelEnrolment from '@salesforce\/apex\/EnrolmentController.cancelEnrolment';\n\nexport default class EnrolmentActions extends NavigationMixin(LightningElement) {\n    @api recordId;        \/\/ the enrolment Id\n    @api courseId;\n    @api studentName;\n\n    async handleCancel() {\n        const answer = await ConfirmCancelModal.open({\n            size: 'small',\n            description: 'Confirm enrolment cancellation',\n            studentName: this.studentName\n        });\n        if (answer !== 'yes') { return; }\n\n        await cancelEnrolment({ enrolmentId: this.recordId });\n        await LightningToast.show({ label: 'Enrolment cancelled', variant: 'success' }, this);\n\n        this[NavigationMixin.Navigate]({\n            type: 'standard__recordPage',\n            attributes: { recordId: this.courseId, objectApiName: 'Course__c', actionName: 'view' }\n        });\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The component opens the modal and waits for the answer. If the tutor confirms, it calls Apex, shows a success toast and then opens the course record.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: See the Flow<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here is what the tutor sees, step by step.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>1. Modal: \"Cancel enrolment?\" [No] [Yes, cancel]\n2. Toast: \"Enrolment cancelled\" (green, success)\n3. Page: Course record \"Apex Basics\" opens<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In short, each tool did one job, and the whole flow feels native to Salesforce.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">LWC Navigation in Experience Cloud<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In Experience Cloud sites, use comm__namedPage with a page name to reach site pages. The same NavigationMixin code then works in both Lightning Experience and the site, which hard-coded URLs cannot do.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common Mistakes with LWC Navigation<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Hard-coding URLs such as \/lightning\/r\/&#8230; in components.<\/li>\n\n<li>Forgetting to wrap the class with NavigationMixin.<\/li>\n\n<li>Using a modal for simple messages that a toast would handle.<\/li>\n\n<li>Not awaiting Modal.open, so code runs before the user answers.<\/li>\n\n<li>Using ShowToastEvent in LWR sites, where it is not supported.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices for LWC Navigation<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Always move users with page references, never with raw URLs.<\/li>\n\n<li>Use GenerateUrl when you need a real link.<\/li>\n\n<li>Prefer lightning\/toast for new toasts.<\/li>\n\n<li>Keep modals small, with one clear decision.<\/li>\n\n<li>Return clear values from modals, such as &#8220;yes&#8221; or a saved Id.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Practice Task<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Add a &#8220;New course&#8221; button that opens the standard New Course page. Hint: use type standard__objectPage with objectApiName Course__c and actionName new.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Most Asked Interview Questions on LWC Navigation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Also, navigation, toasts and modals come up in most practical LWC interviews. Here are the 21 questions asked most about LWC Navigation, toasts and modals.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Basic Questions on LWC Navigation<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q1: Which module handles navigation in LWC?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is lightning\/navigation, used through NavigationMixin.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q2: How do you open a record page from LWC?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Call NavigationMixin.Navigate with type standard__recordPage, the recordId and actionName view.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q3: What is a page reference?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is an object, so it describes the destination with a type and attributes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q4: How do you get a URL for a link?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use NavigationMixin.GenerateUrl, which returns a promise with the URL.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q5: Which module shows toasts now?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Today it is lightning\/toast, because Salesforce prefers it over ShowToastEvent.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q6: Which toast variants exist?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are four: info, success, warning and error.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q7: How do you build a modal?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First create a component that extends LightningModal, then open it with open().<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Code and Scenario Questions on LWC Navigation<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q8: How do you pass data into a modal?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Pass it in the open() options, because each option maps to the modal&#8217;s @api properties.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q9: How do you get a result back from a modal?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Await open(), then read the value the modal passed to this.close().<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q10: Which sizes can a LightningModal use?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It can use small, medium, large and full.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q11: How do you open a New record page?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First use standard__objectPage, then set actionName to new.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q12: How do you open a custom tab?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For a tab, use standard__navItemPage with the tab&#8217;s apiName.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q13: Why avoid hard-coded URLs?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because they break in the mobile app, consoles and Experience Cloud.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q14: How do you make a toast stay until closed?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Simply set mode to sticky in the toast options.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Advanced Questions on LWC Navigation<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q15: Where does ShowToastEvent not work?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is not supported in LWR Experience Cloud sites, so use lightning\/toast there.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q16: How do you move between pages in an Experience Cloud site?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In sites, use comm__namedPage with the site page&#8217;s name.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q17: Can a modal contain other components?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, so a modal can hold forms or lists like any template.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q18: How do you handle a user closing a modal with the X button?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The promise resolves with undefined, so treat that as a cancel.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q19: How do you add a link inside a toast?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For links, use labelLinks or messageLinks in lightning\/toast.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q20: Why does navigation need the mixin?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because the mixin gives the component access to the platform&#8217;s navigation service.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q21: How do you test navigation in Jest?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First use the navigation mock from sfdx-lwc-jest, then assert the page reference that was passed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Official Resources<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/developer.salesforce.com\/docs\/platform\/lwc\/guide\/use-navigate-basic.html\" target=\"_blank\" rel=\"noopener noreferrer\">Page Navigation Guide (LWC Developer Guide)<\/a><\/li>\n\n<li><a href=\"https:\/\/developer.salesforce.com\/docs\/platform\/lwc\/guide\/use-toast.html\" target=\"_blank\" rel=\"noopener noreferrer\">Toast Notifications (LWC Developer Guide)<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Recap<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>LWC Navigation uses NavigationMixin and page references.<\/li>\n\n<li>GenerateUrl builds real links for anchors and toasts.<\/li>\n\n<li>lightning\/toast is the preferred way to show toasts.<\/li>\n\n<li>LightningModal builds dialogs that return a result.<\/li>\n\n<li>Never hard-code Salesforce URLs in components.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What&#8217;s Next?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Components should also look right. Next, read our guide to <a href=\"https:\/\/swapnilzambare.com\/blog\/slds-styling-hooks-lwc-css\/\">SLDS styling hooks for LWC<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>LWC Navigation, toasts and modals are the three tools that make a component feel like part of Salesforce. First, navigation moves the user to&hellip;<\/p>\n","protected":false},"author":1,"featured_media":1687,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_swapz_level":"","_swapz_series_part":0,"_swapz_hide_toc":false,"_swapz_hide_featured":false,"_swapz_description":"","footnotes":""},"categories":[245,8,96],"tags":[34,26,113],"swapz_series":[],"class_list":["post-1690","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-lightning-web-components","category-salesforce","category-salesforce-developer","tag-certification","tag-intermediate","tag-lwc"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>LWC Navigation, Toasts and Modals Explained<\/title>\n<meta name=\"description\" content=\"LWC Navigation explained simply: NavigationMixin, page references, toasts with lightning\/toast, LightningModal dialogs and 21 interview Q&amp;A.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LWC Navigation, Toasts and Modals Explained\" \/>\n<meta property=\"og:description\" content=\"LWC Navigation explained simply: NavigationMixin, page references, toasts with lightning\/toast, LightningModal dialogs and 21 interview Q&amp;A.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/\" \/>\n<meta property=\"og:site_name\" content=\"Swapnil Zambare - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-25T03:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-15T06:02:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-featured.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Swapnil Zambare\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Swapnil Zambare\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/lwc-navigation-toasts-modals\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/lwc-navigation-toasts-modals\\\/\"},\"author\":{\"name\":\"Swapnil Zambare\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/person\\\/10b09224c8bcc562716e86789427592a\"},\"headline\":\"LWC Navigation, Toasts and Modals Explained with Examples\",\"datePublished\":\"2026-09-25T03:30:00+00:00\",\"dateModified\":\"2026-11-15T06:02:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/lwc-navigation-toasts-modals\\\/\"},\"wordCount\":1462,\"publisher\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/lwc-navigation-toasts-modals\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/lwc-navigation-toasts-modals-featured.png\",\"keywords\":[\"Certification\",\"Intermediate\",\"LWC\"],\"articleSection\":[\"Lightning Web Components\",\"Salesforce\",\"Salesforce Developer\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/lwc-navigation-toasts-modals\\\/\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/lwc-navigation-toasts-modals\\\/\",\"name\":\"LWC Navigation, Toasts and Modals Explained\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/lwc-navigation-toasts-modals\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/lwc-navigation-toasts-modals\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/lwc-navigation-toasts-modals-featured.png\",\"datePublished\":\"2026-09-25T03:30:00+00:00\",\"dateModified\":\"2026-11-15T06:02:42+00:00\",\"description\":\"LWC Navigation explained simply: NavigationMixin, page references, toasts with lightning\\\/toast, LightningModal dialogs and 21 interview Q&A.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/lwc-navigation-toasts-modals\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/lwc-navigation-toasts-modals\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/lwc-navigation-toasts-modals\\\/#primaryimage\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/lwc-navigation-toasts-modals-featured.png\",\"contentUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/lwc-navigation-toasts-modals-featured.png\",\"width\":2400,\"height\":1260,\"caption\":\"LWC Navigation featured image: title card with an LWC code example\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/lwc-navigation-toasts-modals\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"LWC Navigation, Toasts and Modals Explained with Examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\",\"name\":\"Swapnil Zambare - Blog\",\"description\":\"Salesforce &amp; Tech Guides\",\"publisher\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\",\"name\":\"Swapnil Zambare - Blog\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/site-icon-512.png\",\"contentUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/site-icon-512.png\",\"width\":512,\"height\":512,\"caption\":\"Swapnil Zambare - Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/theSwapnilZambare\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/person\\\/10b09224c8bcc562716e86789427592a\",\"name\":\"Swapnil Zambare\",\"sameAs\":[\"https:\\\/\\\/swapnilzambare.com\\\/blog\"],\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/author\\\/swapnil-zambare\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"LWC Navigation, Toasts and Modals Explained","description":"LWC Navigation explained simply: NavigationMixin, page references, toasts with lightning\/toast, LightningModal dialogs and 21 interview Q&A.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/","og_locale":"en_US","og_type":"article","og_title":"LWC Navigation, Toasts and Modals Explained","og_description":"LWC Navigation explained simply: NavigationMixin, page references, toasts with lightning\/toast, LightningModal dialogs and 21 interview Q&A.","og_url":"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/","og_site_name":"Swapnil Zambare - Blog","article_published_time":"2026-09-25T03:30:00+00:00","article_modified_time":"2026-11-15T06:02:42+00:00","og_image":[{"width":2400,"height":1260,"url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-featured.png","type":"image\/png"}],"author":"Swapnil Zambare","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Swapnil Zambare","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/#article","isPartOf":{"@id":"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/"},"author":{"name":"Swapnil Zambare","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/person\/10b09224c8bcc562716e86789427592a"},"headline":"LWC Navigation, Toasts and Modals Explained with Examples","datePublished":"2026-09-25T03:30:00+00:00","dateModified":"2026-11-15T06:02:42+00:00","mainEntityOfPage":{"@id":"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/"},"wordCount":1462,"publisher":{"@id":"https:\/\/swapnilzambare.com\/blog\/#organization"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/#primaryimage"},"thumbnailUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-featured.png","keywords":["Certification","Intermediate","LWC"],"articleSection":["Lightning Web Components","Salesforce","Salesforce Developer"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/","url":"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/","name":"LWC Navigation, Toasts and Modals Explained","isPartOf":{"@id":"https:\/\/swapnilzambare.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/#primaryimage"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/#primaryimage"},"thumbnailUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-featured.png","datePublished":"2026-09-25T03:30:00+00:00","dateModified":"2026-11-15T06:02:42+00:00","description":"LWC Navigation explained simply: NavigationMixin, page references, toasts with lightning\/toast, LightningModal dialogs and 21 interview Q&A.","breadcrumb":{"@id":"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/#primaryimage","url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-featured.png","contentUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/lwc-navigation-toasts-modals-featured.png","width":2400,"height":1260,"caption":"LWC Navigation featured image: title card with an LWC code example"},{"@type":"BreadcrumbList","@id":"https:\/\/swapnilzambare.com\/blog\/lwc-navigation-toasts-modals\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/swapnilzambare.com\/blog\/"},{"@type":"ListItem","position":2,"name":"LWC Navigation, Toasts and Modals Explained with Examples"}]},{"@type":"WebSite","@id":"https:\/\/swapnilzambare.com\/blog\/#website","url":"https:\/\/swapnilzambare.com\/blog\/","name":"Swapnil Zambare - Blog","description":"Salesforce &amp; Tech Guides","publisher":{"@id":"https:\/\/swapnilzambare.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/swapnilzambare.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/swapnilzambare.com\/blog\/#organization","name":"Swapnil Zambare - Blog","url":"https:\/\/swapnilzambare.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/09\/site-icon-512.png","contentUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/09\/site-icon-512.png","width":512,"height":512,"caption":"Swapnil Zambare - Blog"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.linkedin.com\/in\/theSwapnilZambare"]},{"@type":"Person","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/person\/10b09224c8bcc562716e86789427592a","name":"Swapnil Zambare","sameAs":["https:\/\/swapnilzambare.com\/blog"],"url":"https:\/\/swapnilzambare.com\/blog\/author\/swapnil-zambare\/"}]}},"_links":{"self":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/1690","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/comments?post=1690"}],"version-history":[{"count":1,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/1690\/revisions"}],"predecessor-version":[{"id":2324,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/1690\/revisions\/2324"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/media\/1687"}],"wp:attachment":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/media?parent=1690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/categories?post=1690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/tags?post=1690"},{"taxonomy":"swapz_series","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/swapz_series?post=1690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}