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 /guide/routing/stack.md.

Slide screens in and out

Move between screens as iOS and Android apps do. A screen you open slides in over the last one, Back slides it away, and a finger can drag it back.

Put <lynx-stack-outlet> where <router-outlet> was:

src/app/app.ts
import { Component } from '@angular/core';
import { LYNX_ELEMENTS, LynxStackOutlet } from '@blotch/angular-lynx'; 

@Component({
  selector: 'app-root',
  imports: [LYNX_ELEMENTS, LynxStackOutlet],
  template: `
    <view class="flex h-full flex-col bg-background">
      <lynx-stack-outlet />
    </view>
  `,
})
export class App {}

<router-outlet> swaps screens at once. <lynx-stack-outlet> keeps a stack of screens and slides between them.

  • It's a router outlet. It takes <router-outlet>'s inputs and outputs: name, routerOutletData, (activate) and (deactivate).
  • It works with the rest of the router: child routes, guards, resolvers, lazy routes, withComponentInputBinding(), route resources and route error boundaries.
  • It goes back through the router, so canDeactivate runs on a swipe too.
  • Screens under the top one stay alive, as a navigation controller's do. Back finds a screen as you left it, scrolled where you left it, with its state.

How screens move

On iOS, it moves as UIKit's navigation controller does on iOS 26 and later:

  • The new screen slides in from the right, over the last one, with the display's rounded corners.
  • The last one slides a third of the way left and dims.
  • The timing is fitted to iOS 27's own.

On Android, it moves as Android's activities do:

  • The new screen slides in a little way and fades in.
  • A drag shrinks the screen with rounded corners, as Android's predictive back does.
  • Android's own back gesture, from either edge of the screen, does the same. The screen follows the finger, goes back as you let go, and comes back if you cancel.

The screens keep moving while your app works. They move by CSS transitions that Core Animation runs on iOS, as UIKit's do. So a screen that's still building its content as it slides in doesn't stop the slide.

Corners and backgrounds

  • Only the corners in the screen's corners round. A screen rounds its corners as it moves, to look like the screen it fills.
  • So an outlet under an app bar or over a tab bar moves its screens with square corners where the bar meets them, as iOS and Android do.
  • The outlet's box is measured against the LynxView, which an app fills the screen with.
  • Each screen is drawn on the theme's background (var(--background), white without the @blotch/ui theme), so the one under it doesn't show through.
  • For another background, give pageClass a class: <lynx-stack-outlet pageClass="bg-card" />.

Swipe back

Swipe back from the left edge, or from anywhere on the screen, as on iOS 26. A screen goes back if you let go past the middle or flick it.

  • Inside something that scrolls sideways itself, only the edge swipes, so the scroller keeps its own swipes. That's a horizontal <scroll-view>, a <list> or a <viewpager>.
  • Turn the swipe off with [swipeBack]="false". That only turns off the swipe inside the app: Android's system back gesture still follows the finger.

Which way a screen moves

The stack follows the URL, as a navigation controller follows the screens of an app:

You go toThe stack
A deeper URL, /notes/3 from /notesPushes it: it slides in from the right
A URL in the stack, by Back, a swipe or a routerLink to itPops back to it: the screens above slide off
A URL the top one's is under, /notes from /notes/3Slides it in from behind, as a pop
A URL at the same depth, /settings from /homeSwaps to it at once, as a tab bar does
Any URL with replaceUrl: trueSwaps the top screen at once
  • A back button made of a routerLink to the screen it came from slides back.
  • A tab bar beside the outlet switches tabs without a slide.
  • A link that pops back takes the history back too, as Back does. So Back, Android's back button or a swipe then goes to the screen under it, not to the one the link popped.

Say which way

When a screen should move otherwise, say so in the navigation's info. Angular keeps it for that navigation alone:

<!-- A same-depth link that should still slide in -->
<view routerLink="/post/5" [info]="{ stack: 'push' }"><text>Post</text></view>
router.navigate(['/home'], { info: { stack: 'root' } }); // a new stack, no slide
stackWhat it does
'push'Slides the screen in
'pop'Slides back to it
'root'Starts a new stack, without a slide

The type is StackNavigationInfo.

Choose the motion

animation picks it:

ValueMotion
'ios'iOS's slide. The default everywhere but Android
'material'Android's. The default on Android
'none'Swaps screens at once and turns the swipe off
  • The iOS default covers the web preview too.
  • To turn only the swipe off, use [swipeBack]="false".
  • While Reduce Motion is on, a push or a pop cross-fades instead of sliding, as iOS's does. A drag still moves the screen with the finger.

Pause a covered screen

A covered screen's components keep running. To pause work while a screen is covered, inject LynxStackPage and read its active() signal.

The tab bar or dock goes away on a pushed screen

Put a <lynx-stack-outlet> in each tab, beside the app's Tab Bar or Dock. A screen pushed over a tab's first screen then takes the bar away, as iOS and Material do with the screens they drill down to. Nothing changes in the templates:

src/app/app.routes.ts
export const routes: Routes = [
  { path: 'home', loadComponent: () => import('./home').then((m) => m.Home) },
  {
    // The tab's own stack: an album pushes over the list.
    path: 'library',
    loadComponent: () => import('./library').then((m) => m.LibraryStack), // template: <lynx-stack-outlet />
    children: [
      {
        path: '',
        loadComponent: () => import('./library').then((m) => m.Library),
      },
      {
        path: ':album',
        loadComponent: () => import('./library').then((m) => m.Album),
      },
    ],
  },
];

Back, Android's back button or a swipe brings the bar back with the screen under it.

  • On iOS, the screen underneath carries the bar. It moves a little left with that screen. The pushed screen slides over it, rounded corner and shadow and all, as UIKit does. A finger dragging the screen back uncovers it.
  • On Android, it slides down off the screen, on the screens' own curve, and back up as the screen goes.
  • While it's away, screen readers skip it and it takes no taps.
  • The Tab Bar lies over the bottom of the screen rather than under the outlet, so the pushed screen runs to the bottom edge.

The examples on the Dock and Tab Bar pages each have a tab with a stack: open an album in the Library, or a message in the Inbox.

Choose which screens hide it

  • data: { bottomBar: 'visible' } on a route keeps the bar on a pushed screen.
  • data: { bottomBar: 'hidden' } takes it away from a first one.
  • <lynx-stack-outlet hideBottomBar="never" /> keeps it on every screen whose route doesn't say, as iOS does by default.
  • A screen that keeps room at its end for the dock can drop it while the dock is away: read inject(LynxStackPage, { optional: true })?.bottomBarHidden().

A bar of your own

  • Put LynxStackBottomBar on its host, as the Tab Bar and the Dock do. The screen underneath then carries it on iOS, and it moves with the directive's signals.
  • Or read LynxStackChrome directly. It says whether the bar should be away and how far it has got, move by move under a finger. The bar then slides away on its own.

When a screen fails

With Angular's route error boundaries, a screen that throws shows its route's error component in its place:

src/app/app.config.ts
provideRouter(
  routes,
  withErrorBoundaries({ defaultErrorComponent: ScreenError }),
);
  • The error component is that screen. It keeps the screen's place in the stack and its history entry, slides in as the screen would have, and Back or a swipe takes it away.
  • Going back to a screen that failed builds it again, as <router-outlet> does when you come back to a route.
  • A covered screen keeps running, so it can fail too. Its error component waits under the top one, and the screen is built again when you go back to it. That error component gets only error, even with withComponentInputBinding(): <router-outlet> binds the route's params and data to its one screen, and the router is on the top one. Make the error component's route inputs optional.

Good to know

  • A screen's own route stays its own. Coming back to a screen, the router activates its route again. The screen's ActivatedRoute follows it, and its observables emit only what changed.
  • A change of params alone doesn't push a screen. Angular reuses the component, as on the web: /notes/1 to /notes/2 updates the note in place. Read params reactively (see Read route parameters).
  • The Navigation Bar and the Toolbar keep their state per screen. So each screen in the stack has its own large title and scroll edge. A bar of your own does the same with injectBarState().

Things that drag sideways

Something that drags sideways itself swipes back only from the edge:

  • a horizontal <scroll-view> or <list>
  • a <viewpager>
  • an element whose consume-slide-event keeps rightward slides (an angle range that holds 0), such as a picture that pans while it's zoomed in

Bind consume-slide-event only while the element drags, and a swipe anywhere goes back the rest of the time:

<view [consume-slide-event]="zoomed() ? [[-180, 180]] : []">…</view>

Lynx Explorer

In Lynx Explorer, the left edge is Explorer's: its own back gesture takes swipes from the edge. Swipe from inside the screen there. Apps built with ng build --platform have no such gesture.