For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /examples/stack-navigation.md.

Stack Navigation

Screens that slide in and out as iOS and Android apps do, with a swipe back: a settings app three screens deep, in a <lynx-stack-outlet>. Tap a row to open it, and drag a screen to the right to go back.

What it shows

  • <lynx-stack-outlet> — src/app/app.ts puts it where <router-outlet> would go. A screen you open slides in over the last one, and Back (Location.back()), Android's back button or a drag to the right slides it away. See Slide screens in and out.
  • A stack that follows the URL — /settings, /settings/general and /settings/general/about are each under the last, so each pushes. Back to Settings is a routerLink to a screen in the stack, so it pops back to it, sliding the top screen away over the one between.
  • The navigation's info — Next is at the same depth as the screen it's on, which would swap screens at once, as a tab bar does. [info]="{ stack: 'push' }" on its routerLink makes it push instead.
  • Screens that stay alive — the count on the first screen, and a section's switch, keep their state while other screens cover them.
  • LynxStackPage — a section's clock reads active() and stops while another screen covers it.
  • The motion — the first screen switches the outlet's animation between the platform's own, iOS's, Material's and none, so you can compare them on any device.

With a tab bar or a dock

Put a stack in each tab, and a screen pushed over a tab's first screen takes the app's Tab Bar or Dock away, as iOS and Material do: on iOS the screen underneath carries it, and the pushed screen slides over both, and on Android it slides down off the screen. It comes back with Back, Android's back button or a swipe, following the finger. The examples on those pages each have a tab with a stack. See The tab bar or dock goes away on a pushed screen.