Navigates the user to another page in the dashboard.
You can identify the page to navigate to using its page ID. If an invalid page ID is passed to this function, a "Page Not Found" page is displayed in the dashboard.
Note: Currently, you can't use navigate()
to navigate to dashboard pages created with Wix Blocks or to dashboard pages created with the Wix Editor.
You can specify how to display the page you're navigating to using the displayMode
option.
There are two display modes available:
Name | Type | Description |
---|---|---|
destination | Destination | Destination page to navigate to. |
options | NavigationOptions | Optional. Options for the navigation. |
Name | Type | Description |
---|---|---|
pageId | string | ID of the page to navigate to. See Page IDs to find the appropriate ID. |
relativeUrl | string | Optional. URL segment to append to the base URL of the selected page. Can include path segments, a query string, and a fragment identifier. |
Name | Type | Description |
---|---|---|
displayMode | "main" | "overlay" | "auto" | When using main , the browser replaces the current main page content with the new page. When using overlay , the new page is displayed in a modal overlaid on top of the main page."auto" (default) causes the page to be loaded in the current context. This means if navigate() is called from the main page, the main page changes. If it's called from an overlay page, the overlay content changes to the new page. |
history | "push" | "replace" | Optional. Determines whether the URL of the page being navigated to is added to the browser's session history, or replaces the URL in the current entry. |
Note: To use this method in self-hosted apps, you need to create a client. See the setup guide for more details.