> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# Dock

The floating bar of your app's top-level screens: the Liquid Glass form of the [tab bar](/dolan/tab-bar.md). A glass capsule of icon-and-label items at the bottom of the screen, with a separate button beside it, an accessory above it, a minimized form while content scrolls, and a search field across the bottom.


## Installation

```bash
npx @blotch/dolan add dock
```

```typescript
import {
  UiDock,
  UiDockAccessory,
  UiDockAction,
  UiDockItem,
  UiDockScroll,
} from '../components/ui/dock';
```

:::tip
This also adds [Glass](/dolan/glass.md), which draws the dock, [Icon](/dolan/icon.md), whose icons the items draw, and [Search Field](/dolan/search-field.md), which the dock can [search](#search) with.
:::

## Usage

Give each item a `route`, an `icon` and a `label`, and put the dock after a [`<lynx-tab-outlet>`](/guide/routing.md#keep-each-tab-alive-as-a-tab-bar-does), which keeps each tab as a native tab bar does:

```typescript title="src/app/app.ts"
import { Component } from '@angular/core';
import { LYNX_ELEMENTS, LynxTabOutlet } from '@blotch/angular-lynx';
import { UiDock, UiDockAction, UiDockItem } from '../components/ui/dock';

@Component({
  selector: 'app-root',
  imports: [LYNX_ELEMENTS, LynxTabOutlet, UiDock, UiDockAction, UiDockItem],
  template: `
    <view class="flex h-full flex-col bg-background">
      <lynx-tab-outlet />
      <ui-dock>
        <ui-dock-item route="/home" icon="home" label="Home" />
        <ui-dock-item route="/browse" icon="layout-grid" label="Browse" />
        <ui-dock-item route="/library" icon="music" label="Library" />
        <ui-dock-action route="/search" icon="search" label="Search" />
      </ui-dock>
    </view>
  `,
})
export class App {}
```

- **The dock floats over your screens** at the bottom of its parent, and their content scrolls beneath it. It clears the iPhone's home indicator by the bottom [safe area](/guide/safe-area.md).
- **A tap navigates** to the item's `route` with Angular's own [`RouterLink`](/guide/routing.md#navigate-between-screens). Set up the router with `provideRouter()` from `@blotch/angular-lynx`.
- **A capsule marks the selected item,** and slides to the next one you tap as you tap it, while the screen it shows is still being built. An item stays selected on the routes under it: Library at `/library/42` too. If the navigation ends somewhere else (a guard says no or redirects, or it fails), the item of the route the app is on is selected again.
- **Going back to a tab finds it as you left it,** with `<lynx-tab-outlet>`: its scroll positions, the screens pushed in it, and its native views. A tap on the selected item pops its stack to its first screen. With `<router-outlet>`, each tab is built again every time.
- **The action is a separate button,** for what people reach for from every screen, such as search or compose (below).

Give each screen's host `flex-1`, so its `<scroll-view>` fills the screen, and pad the end of its content so the last row scrolls clear of the dock: `pb-safe-24`, or `pb-safe-40` with an accessory.

```typescript
@Component({
  selector: 'app-home',
  imports: [LYNX_ELEMENTS, UiDockScroll],
  host: { class: 'flex flex-1 flex-col' },
  template: `
    <scroll-view
      ui-dock-scroll
      scroll-orientation="vertical"
      class="h-full w-full"
    >
      <view class="flex-col gap-4 px-5 pb-safe-24 pt-safe-6">…</view>
    </scroll-view>
  `,
})
export class Home {}
```

### What each platform draws

| Platform                                                                   | What you get                                                                                                                                                                                   |
| -------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| iOS 26 and later                                                           | A floating Liquid Glass capsule, with a sliding selection capsule. It minimizes as content scrolls down.                                                                                       |
| iOS 15 to 25                                                               | The tab bar of that time: edge to edge on the bars' chrome material, the selected item in `primary` and the others gray.                                                                       |
| Android                                                                    | A Material 3 Expressive floating toolbar with the same sliding capsule behind the selected item, in a tint of `primary`, and a floating action button. It slides away as content scrolls down. |
| Android, with [`provideGlass()`](/dolan/glass.md#what-each-platform-draws) | The glass dock, drawn with Android's blur.                                                                                                                                                     |
| [Web preview](/guide/glossary.md#web-preview)                              | The glass dock, drawn with WebGL.                                                                                                                                                              |

### Minimize on scroll

Put `ui-dock-scroll` on a screen's `<scroll-view>` (or `<list>`), and the dock minimizes as it scrolls down and comes back as it scrolls up, as iOS 26's tab bar does:

- **On glass,** the bar shrinks to the selected item's icon on the left, the action to a circle on the right, and the accessory moves down between them. A tap on the minimized bar brings the dock back.
- **On Material,** the toolbar slides off the screen and the floating action button stays.
- **Before iOS 26,** the tab bar stays where it is: Apple's tab bars didn't minimize.

It comes back at the top of the content, and when the screen goes. To minimize or bring it back yourself, set `UiDockState`:

```typescript
inject(UiDockState).minimized.set(false);
```

`ui-dock-scroll` reads the scroll view's events itself rather than through a template listener, which would run change detection on every event, about every frame while content moves. It updates the dock only when it changes. Your template handlers already run on Lynx's main thread, beside the native scroll, so it needs no [main-thread script](/guide/main-thread/index.md).

### Away on a pushed screen

Give a tab a [`<lynx-stack-outlet>`](/guide/routing.md#the-tab-bar-or-dock-goes-away-on-a-pushed-screen), and a screen it pushes over the tab's first screen takes the dock away, as iOS and Material do with the screens they drill down to. The example's Library is one: open an album.

- **Where screens move as iOS's do,** the screen underneath carries the dock: it moves a little left with that screen, and the pushed screen slides over it, rounded corner and shadow and all.
- **Where they move as Android's do,** it slides down off the screen.
- **Back, Android's back button or a swipe brings it back,** following the finger while it drags. While it's away, screen readers skip it and it takes no taps.
- **`ui-dock-scroll` on a pushed screen leaves the dock alone,** so the screen under it gets the dock back as it left it.
- **A screen that pads its end for the dock** can drop the padding while the dock is away: `inject(LynxStackPage, { optional: true })?.bottomBarHidden()`.

A route keeps the dock with `data: { bottomBar: 'visible' }`. See [`LynxStackChrome`](/api/angular-lynx/routing.md#lynxstackchrome) for what the stack says, and [`LynxStackBottomBar`](/api/angular-lynx/routing.md#lynxstackbottombar) to have a screen carry a bar of your own.

### The action

`<ui-dock-action>` is the button beside the bar. Like an item, it navigates to a `route` and is selected while the route is active. Without a route, handle `(pressed)`:

```angular-html
<ui-dock-action icon="plus" label="New message" (pressed)="compose()" />
```

On glass, it's a circle in the same [glass group](/dolan/glass.md#groups) as the bar, so the two merge as they near each other. The `label` is what a screen reader says, since the button shows only its icon.

### Search

Put a [`<ui-search-field>`](/dolan/search-field.md) in the dock beside a search action, and the action opens a search field at the bottom of the screen, within reach, as iPhone apps search on iOS 26:

```angular-html
<ui-dock>
  <ui-dock-item route="/home" icon="home" label="Home" />
  <ui-dock-item route="/library" icon="music" label="Library" />
  <ui-dock-action route="/search" icon="search" label="Search" />
  <ui-search-field
    placeholder="Artists, songs and more"
    cancelable
    [(value)]="query"
    (submitted)="search($event)"
  />
</ui-dock>
```

- **With a `route`, it's a search tab:** the field is open while its screen shows, which can suggest searches until the field is tapped. Tapping the field brings up the keyboard.
- **Without a route, the action opens the field over the screen you're on** and gives it the keyboard. `UiDockState`'s `searching` says whether it's open, and sets it from code: `inject(UiDockState).searching.set(true)`.
- **The dock rises with the field above the keyboard,** and settles when it closes.

What opens on each platform:

- **On glass,** the action grows into the field across the bottom, and the bar shrinks to one button that goes back to the last item you were on. With `cancelable`, a glass circle with an x grows out of the field's end while it's in use: it clears the field and closes the keyboard, and for an action without a route, closes the search.
- **On Material,** the floating action button grows into Material 3's search bar across the bottom, and the toolbar slides away. The search bar's back arrow goes back.
- **Before iOS 26,** the tab bar stays, and the field opens in a bar above it, on the same material. With the keyboard up, the bar sits on the keyboard, as Safari's did. Cancel closes a search the action opened; on a search tab it clears the field.

The dock doesn't minimize while it searches. `openSearch()` and `closeSearch()` open and close it from code.

### The accessory

Mark content with `ui-dock-accessory` and the dock puts it in a glass bar above itself, for something that stays at hand on every screen, such as what's playing:

```angular-html
<ui-dock #dock>
  @if (player.track(); as track) {
    <view ui-dock-accessory class="flex flex-row items-center gap-3 px-4">
      <text class="text-sm font-semibold text-glass-foreground">{{
        track.title
      }}</text>
      @if (!dock.minimized()) {
        <text class="text-xs text-glass-muted-foreground">{{
          track.artist
        }}</text>
      }
    </view>
  }
  …
</ui-dock>
```

When the glass dock minimizes, the accessory moves into the row beside the bar, at the bar's height. Read the dock's `minimized()` to show less there. Color its text `text-glass-foreground`; `<ui-icon>`s in it get the same color.

### Your own mark

For a mark the icon set doesn't have, such as your app's logo on the Home item, pass its markup to `svg` instead of `icon`. The action takes one too:

```typescript
@Component({
  imports: [UiDock, UiDockAction, UiDockItem],
  template: `
    <ui-dock>
      <ui-dock-item route="/home" [svg]="logo" label="Home" />
      <ui-dock-item route="/library" icon="music" label="Library" />
      <ui-dock-action route="/search" icon="search" label="Search" />
    </ui-dock>
  `,
})
export class App {
  // The app's logo (its path shortened here), filled with currentColor.
  readonly logo = `<svg viewBox="0 0 24 24"><path fill="currentColor" d="…"/></svg>`;
}
```

- **`currentColor` takes the item's color,** as the set's icons do: `primary` while it's selected, and the bar's foreground otherwise (`glass-foreground` on glass, `muted-foreground` on Material and before iOS 26). A one-color mark written in `currentColor` follows the selection and your theme, and the minimized bar draws it in `primary`.
- **Colors written out stay,** so a multi-color mark keeps them.
- **`xmlns` is optional,** and lines must be `<path>`s, as for [an icon's own SVG](/dolan/icon.md#your-own-svg).

### Badges and router options

Items take a `badge` and `RouterLink`'s inputs, as [tab bar items](/dolan/tab-bar.md#badges) do:

```angular-html
<ui-dock-item
  route="/"
  icon="home"
  label="Home"
  [routerLinkActiveOptions]="{ exact: true }"
/>
<ui-dock-item
  route="/inbox"
  icon="inbox"
  label="Inbox"
  [badge]="unreadCount()"
/>
```

`(pressed)` emits on every tap, including one on the selected item.

### 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()`](/dolan/icon.md#dark-mode).

## API

### UiDock

| Input         | Type     | Default          | Description                                                                           |
| ------------- | -------- | ---------------- | ------------------------------------------------------------------------------------- |
| `expandLabel` | `string` | `'Show tab bar'` | What a screen reader says for the minimized dock, before the selected item's label.   |
| `class`       | `string` | `''`             | Extra Tailwind classes for the dock, which places itself at the bottom of its parent. |

| Property        | Type                                         | Description                                                                              |
| --------------- | -------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `minimized`     | `Signal<boolean>`                            | Whether the dock is minimized now. It never is before iOS 26, or while it searches.      |
| `searching`     | `Signal<boolean>`                            | Whether its search field is open (see [Search](#search)).                                |
| `design`        | `Signal<'glass' \| 'frosted' \| 'material'>` | The platform's design (see [Glass](/dolan/glass.md#functions)).                          |
| `selectedItem`  | `Signal<UiDockItem \| undefined>`            | The item whose route is active.                                                          |
| `expand()`      | method                                       | Brings a minimized dock back.                                                            |
| `openSearch()`  | method                                       | Opens the search field and gives it the keyboard.                                        |
| `closeSearch()` | method                                       | Closes it: back to the last item from a search tab, or closes the one the action opened. |

### UiDockItem

| Input                     | Type                                                          | Default     | Description                                                                                                                              |
| ------------------------- | ------------------------------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `route`                   | `string \| any[] \| UrlTree \| null`                          | —           | Where a tap navigates. `RouterLink`'s `routerLink`.                                                                                      |
| `icon`                    | `IconName \| undefined`                                       | `undefined` | The [Icon](/dolan/icon.md) drawn above the label. Give this or `svg`.                                                                    |
| `svg`                     | `string \| undefined`                                         | `undefined` | SVG markup to draw instead, such as your logo, with `currentColor` in the item's color. Give this or `icon`.                             |
| `label`                   | `string`                                                      | —           | Required. The item's name, shown and read by screen readers.                                                                             |
| `badge`                   | `string \| number \| null \| undefined`                       | `undefined` | A count or short text over the icon. Hidden for `0`, `''`, `null` and `undefined`.                                                       |
| `routerLinkActiveOptions` | `{ exact: boolean } \| IsActiveMatchOptions`                  | subset      | How the current route is matched. `RouterLinkActive`'s input.                                                                            |
| `queryParams`, …          | See [`RouterLink`](https://angular.dev/api/router/RouterLink) | —           | `queryParams`, `queryParamsHandling`, `fragment`, `preserveFragment`, `state`, `info`, `relativeTo`, `replaceUrl`, `skipLocationChange`. |
| `class`                   | `string`                                                      | `''`        | Extra Tailwind classes for the item's content.                                                                                           |

| Output    | Type   | Description                                               |
| --------- | ------ | --------------------------------------------------------- |
| `pressed` | `void` | Emits on every tap, including a tap on the selected item. |

### UiDockAction

| Input      | Type                    | Default     | Description                                                                                      |
| ---------- | ----------------------- | ----------- | ------------------------------------------------------------------------------------------------ |
| `icon`     | `IconName \| undefined` | `undefined` | The button's [Icon](/dolan/icon.md). Give this or `svg`.                                         |
| `svg`      | `string \| undefined`   | `undefined` | SVG markup to draw instead, with `currentColor` in the button's icon color. Give this or `icon`. |
| `label`    | `string`                | —           | Required. What the button does, for screen readers.                                              |
| `route`, … | —                       | —           | `RouterLink`'s inputs and `routerLinkActiveOptions`, as on items.                                |

| Output    | Type   | Description         |
| --------- | ------ | ------------------- |
| `pressed` | `void` | Emits on every tap. |

### UiDockAccessory and UiDockScroll

| Directive         | Selector                                              | Description                                                                                      |
| ----------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `UiDockAccessory` | `[ui-dock-accessory]`                                 | Marks the content of the accessory above the dock.                                               |
| `UiDockScroll`    | `scroll-view[ui-dock-scroll]`, `list[ui-dock-scroll]` | Minimizes the dock as the scroll view scrolls down, except on a screen that takes the dock away. |

`UiDockState` is a root service the dock and your screens share, with two signals: `minimized`, which `ui-dock-scroll` sets, and `searching`, whether the search an action without a route opens is open.

## Accessibility

- **Each item is one button,** named by its `label` and then its badge: "Inbox, 3". The selected item has the `selected` trait, so iOS VoiceOver announces it.
- **On iOS, the row of items has the `tabbar` trait,** as a native tab bar does.
- **Away on a pushed screen,** the dock is hidden from screen readers and takes no taps.
- **The minimized dock is one button,** "Show tab bar", with the selected item's label as its value. The hidden items are hidden from screen readers too. While the glass dock searches, the same button goes back, with the last item's label as its value.
- **The search field is a search field** to screen readers, and its Cancel a button (see [Search Field](/dolan/search-field.md#accessibility)). The action it opened from is hidden while it's open.
- **Reduce Motion:** the capsule, the minimizing and the search opening change at once instead of sliding, shrinking, growing or fading.
- **Reduce Transparency and Increase Contrast** are handled by the [glass](/dolan/glass.md#accessibility).

## Related

- [Tab Bar](/dolan/tab-bar.md): the same navigation, as a plain bar along the bottom edge
- [Search Field](/dolan/search-field.md): the field the dock searches with
- [Glass](/dolan/glass.md): the glass the dock is drawn with
- [Routing and navigation](/guide/routing.md): set up the router and its routes
- [Safe area](/guide/safe-area.md): the inset the dock clears
