Navigation Bar
The bar at the top of a screen: its title, a Back button that goes back through the router, and the screen's actions. On iOS 26 its controls float in Liquid Glass, and content fades as it scrolls beneath them.
Installation
Usage
Put the bar after the screen's <scroll-view>, and ui-bar-scroll on the scroll view. A long feed's <list> takes it too:
- The bar floats over the content at the top of the screen, below the status bar. Content scrolls beneath it.
ui-bar-scrollmakes room for it: the content starts below the bar and the status bar, so you don't pad for either.- Items go at the trailing end. Add
leadingto put one after the Back button. Group related ones. - The title is the screen's heading for screen readers. Keep it short: Apple suggests under 15 characters.
What each platform draws
The Back button
The bar shows a Back button while the router has a screen to go back to, and a tap calls Location.back(). The router then goes back as for the browser's back button, so guards such as canDeactivate still run. On the app's first screen there's no Back button.
backLabelis the previous screen's title. iOS 15 to 25 show it beside the chevron, and screen readers say it everywhere. It'sBackby default.backRouteis where Back goes when there's no history, such as a note the app opened on from a link. The Back button then shows anyway, and replaces the screen with that route.backButtonHiddenhides it, for a screen that starts a flow though there's history behind it, such as a tab's first screen in a Dock.
It needs provideRouter() from @blotch/angular-lynx, whose in-memory history knows whether there's a screen to go back to. For a Back button that does something else, set backButtonHidden and add your own as a leading item: back draws the platform's Back button.
Large title
With largeTitle, the title starts large at the top of the content and scrolls away with it. Once it has gone under the bar, the bar shows the title instead:
ui-bar-scroll draws the large title, so it needs a scroll view or a list with it. It's one line: a title too long for it ends with "…". On Android it's Material 3 Expressive's medium flexible app bar, which collapses into the small one the same way.
Beside the large title
An element marked largeTitleAccessory in the scroll view sits at the end of the large title's line, such as an account's picture or how something is doing:
- It's centered on the title's line, whatever its own height, and keeps its width: a long title ends with "…" before it.
- It scrolls away with the large title. The bar shows only the title once that has gone under it, so keep what must stay in reach in the bar itself.
- It's drawn only with a large title. Without one there is no line to put it on.
Title menu
With titleMenu, the title is a button with a chevron after it. Use it when the title picks what the screen shows, such as an account, a workspace or a calendar's month:
titlePressedemits on a tap on the title, in the bar or as the large title.- The menu is yours. The bar draws none: open a Menu, an Action Sheet or a Bottom Sheet.
- A long title still ends with "…", and the chevron stays after it.
- It's iOS's title menu, and the title with a dropdown arrow of a Material top app bar. In Android's small bar, the chevron follows the title at the start.
The scroll edge effect
On iOS 26 and later, content fades out as it passes under the glass bar, so the bar's controls stay legible over whatever is beneath them, as iOS's scroll edge effect does. It's a mask on the scroll view, so content fades to whatever is behind it: the screen's background, or an image. Android's scroll view takes no mask, so with the glass opt-in the bar fades content to the theme's background color instead.
The other designs mark the edge with the bar's own background instead: the frosted material before iOS 26, and Material's container color on Android.
Two bars at once
ui-bar-scroll and the bars find each other through UiBarState, a root service, which fits one screen at a time. Each screen of a <lynx-stack-outlet>, which keeps the screens under the top one alive, gets its own already. When two screens with bars show at once otherwise, such as a sheet with its own navigation bar over a screen, give the sheet's component its own:
A bar of your own takes the state with injectBarState(), as these do, rather than inject(UiBarState): it's the component's own when one provides it, the stack screen's on one, and otherwise the root's.
Dark mode
The icons draw with the light theme's colors until you say otherwise, and the glass follows the same setting. If your app switches to dark mode, set the color scheme with provideIconTheme().
API
UiNavigationBar
ui-bar-scroll and the items are on the Toolbar page.
Accessibility
- The title is a heading. With a large title, the bar's copy is hidden from screen readers until the large one has scrolled under it.
- With
titleMenu, the title is one button named by its text. It's still a heading on iOS; Android reads one trait, so there it's a button. - The Back button is a button named by
backLabel. Each item is a button named by itslabel, which icon-only items need too. - Reduce Motion: the title appears at once instead of fading in, and Material's bar changes color at once. A pressed title menu comes back at once instead of fading back.
- Reduce Transparency and Increase Contrast are handled by the glass.
Related
- Toolbar: the items and groups, and a bar of actions along the bottom
- Routing and navigation: going back through the router
- Dock: a floating glass tab bar for the app's top-level screens
- Glass: the glass the bar's controls are drawn with
- Safe area: the inset the bar clears
