Skip to main content

Navigation API

The Navigation API provides web-standard navigation functionality for POS UI extensions, allowing you to navigate between URLs, manage navigation history, and handle navigation events within modal interfaces. The API is available globally as the navigation object and follows web platform standards.

Each screen runs in its own isolated sandbox, so module-level variables and closures aren't shared across navigations. To pass data between screens, use the state option in navigation.navigate() or the Storage API.

  • Multi-screen workflows: Implement workflows with URL-based navigation and browser history support.
  • Wizard interfaces: Build wizard-style interfaces allowing forward and backward navigation.
  • Deep linking: Create deep-linkable modal states that can be bookmarked or shared.
  • Navigation events: Handle navigation events to save progress or trigger cleanup.

The navigation object provides navigation controls for extension modals. Access the following properties on navigation to navigate between screens, manage navigation history, and handle navigation events.

(type: "currententrychange", cb: (event: ) => void) => void
required

Registers an event listener for navigation events. The currententrychange event fires when the currentEntry property changes, such as when the user navigates to a different screen within the extension modal. Use to track navigation changes, update UI state based on the current location, or implement analytics for navigation patterns.

() => void
required

Navigates to the previous entry in the history list. Use for implementing back buttons, breadcrumb navigation, or allowing users to return to previous screens in multi-step workflows.

required

Returns a NavigationHistoryEntry object representing the location the user is currently navigated to. Use to access current URL, navigation state, or implement navigation-aware functionality based on the current location.

(url: string, options?: ) => Promise<void>
required

Navigates to a specific URL, updating any provided state in the history entries list. Returns a promise that resolves when navigation is complete. Use for programmatic navigation between screens, implementing custom navigation controls, or deep-linking to specific modal states.

(type: "currententrychange", cb: (event: ) => void) => void
required

Removes a previously registered event listener. The callback reference must match the one passed to addEventListener. Use to clean up event listeners when they are no longer needed, such as when a component unmounts or navigation tracking should be disabled.

The global window object provides control over the extension modal lifecycle. Access these properties and methods directly through the global window object to manage the modal interface programmatically.

Anchor to close
close
{ (): void; (): void; }
required

Closes the extension screen and dismisses the modal interface. Use to programmatically close the modal after completing a workflow, canceling an operation, or when user action is no longer required. This provides the same behavior as the user dismissing the modal through the UI.


  • Use URL-based navigation: Implement URL-based navigation patterns that allow for deep-linking, bookmarking, and intuitive browser-like navigation within your modal workflows.
  • Manage navigation state effectively: Use the state parameter in navigation options to pass data between screens, maintaining workflow context and user progress across navigation changes.

  • The Navigation API is only available in action (modal) targets and can't be used in action (menu item), block, or tile targets that don't support multi-screen navigation.
  • Navigation state is limited to serializable data and can't contain functions, complex objects, or circular references.

Was this page helpful?