---
title: "Native Navigation Stack"
description: "A stack of pages in one panel, as on a phone: rows push a page, and the back button or Escape returns."
url: https://gelatinui.com/components/native-navigation-stack
markdown_url: https://gelatinui.com/components/native-navigation-stack.md
access: free
install: "npx shadcn@latest add @gelatin-ui/native-navigation-stack"
registry_item: https://gelatinui.com/r/native-navigation-stack.json
version: "2026-11-21"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Native Navigation Stack

> A stack of pages in one panel, as on a phone: rows push a page, and the back button or Escape returns.

Page: https://gelatinui.com/components/native-navigation-stack

## When to use it

Best for: Move through nested pages in one panel, with a slide forward and back, as on a phone.

- Use it when each choice opens a page of more choices, and people go back the same way.
- Use `defaultPath` to open on a deep page, and `path` with `onPathChange` to keep the path in the URL or your state.
- Use `useNativeNavigation` in a page to push or pop with your own button.

## When not to use it

- To switch between pages at the same level, use the [Tabs](https://gelatinui.com/components/tabs.md).
- To show where a page sits in a site, use the [Breadcrumb](https://gelatinui.com/components/breadcrumb.md).

## Notes for agents

- Each `NativeNavigationPage` has a `page` id; the first page has the id `root` by default. A `NativeNavigationLink` with `to` pushes that page.
- A `path` lists the open pages, the first page first. It throws when it names a page that is not in the stack, or names one page twice.
- Open pages stay mounted under the top page, so they keep their scroll and their form state. They are `inert`.
- `NativeNavigationBack` renders nothing on the first page. Give it an `aria-label` such as `Back to Settings`.
- On a touch screen, a swipe from the start edge (24px) pops the page.

## Anatomy

```text
NativeNavigationStack
├─ NativeNavigationPage (0..n)
│  └─ NativeNavigationTitle (0..n)
├─ NativeNavigationBar (0..n)
└─ NativeNavigationLink (0..n)
```

## API reference

### NativeNavigationStack

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `path` | `NativeNavigationPath` |  | The open pages, the first page first (controlled). The last one shows. |
| `defaultPath` | `NativeNavigationPath` | DEFAULT_PATH | The open pages at the start (uncontrolled). |
| `onPathChange` | `function` |  | Runs when a link, the back button, Escape, or a swipe asks for a new path. |

Also takes every prop of Base UI `UseRender`: https://base-ui.com/react/components/use-render

### NativeNavigationPage

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `page` | `string` | ROOT_PAGE | The id of the page: a link names it with `to`, and `path` lists it. |

### NativeNavigationBar

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### NativeNavigationBack

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### NativeNavigationTitle

Also takes every prop of Base UI `UseRender`: https://base-ui.com/react/components/use-render

### NativeNavigationLink

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `size` | `"default" \| "sm" \| "xs"` |  |  |
| `variant` | `"default" \| "muted" \| "outline"` |  |  |
| `to` | `string` |  | The page that this row opens. |
| `disabled` | `boolean` |  |  |

Also takes every prop of Base UI `UseRender`: https://base-ui.com/react/components/use-render

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| NativeNavigationStack | `native-navigation-stack` | `data-direction`, `data-far` | `--native-navigation-from`, `--native-navigation-leave`, `--native-navigation-side` |  |
| NativeNavigationPage | `native-navigation-page` | `data-moving`, `data-state` | `--native-navigation-from`, `--native-navigation-leave`, `--native-navigation-side` | `motion-timing` |
| NativeNavigationBar | `native-navigation-bar` |  |  |  |
| NativeNavigationTitle | `native-navigation-title` |  |  |  |
| NativeNavigationLink | `native-navigation-link` |  |  |  |

## Usage

Give each page an id. A link pushes its page, and the back button returns.

```tsx title="settings-panel.tsx"
import {
  NativeNavigationBack,
  NativeNavigationBar,
  NativeNavigationLink,
  NativeNavigationPage,
  NativeNavigationStack,
  NativeNavigationTitle,
} from "@/components/navigation/native-navigation-stack";
import { FramePanel } from "@/components/ui/frame";
import { Item, ItemContent, ItemDescription, ItemTitle } from "@/components/ui/item";

export function SettingsPanel() {
  return (
    <NativeNavigationStack aria-label="Settings">
      <NativeNavigationPage>
        <NativeNavigationBar>
          <NativeNavigationTitle>Settings</NativeNavigationTitle>
        </NativeNavigationBar>
        <FramePanel className="p-0">
          <NativeNavigationLink to="account">
            <ItemContent>
              <ItemTitle>Account</ItemTitle>
            </ItemContent>
          </NativeNavigationLink>
        </FramePanel>
      </NativeNavigationPage>
      <NativeNavigationPage page="account">
        <NativeNavigationBar>
          <NativeNavigationBack aria-label="Back to Settings" />
          <NativeNavigationTitle>Account</NativeNavigationTitle>
        </NativeNavigationBar>
        <FramePanel className="p-0">
          <Item>
            <ItemContent>
              <ItemTitle>Email</ItemTitle>
              <ItemDescription>maya@northwind.studio</ItemDescription>
            </ItemContent>
          </Item>
        </FramePanel>
      </NativeNavigationPage>
    </NativeNavigationStack>
  );
}
```

## Compose

Rules:

- Touch targets (`touch-targets`): Give every control a hit area of at least 44 px on touch screens, even when it looks smaller.
- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/native-navigation-stack
```

It adds 37 registry items: 34 files, 5323 lines, and the npm packages `@base-ui/react`, `@phosphor-icons/react`, `@xstate/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## Built on

- [Button](https://gelatinui.com/components/button.md)
- [Frame](https://gelatinui.com/components/frame.md)
- [Item](https://gelatinui.com/components/item.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Tabs](https://gelatinui.com/components/tabs.md)
- [Breadcrumb](https://gelatinui.com/components/breadcrumb.md)
- [Item](https://gelatinui.com/components/item.md)
- [Frame](https://gelatinui.com/components/frame.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Enter, Space | On a row: opens its page. Focus goes to the back button of the new page. |
| Escape | Goes back one page. Focus returns to the row that opened the page. |
| Tab | Moves through the controls of the top page only. |

## Accessibility

Each page is a `section`, named by its title.

The pages under the top page are `inert`, so Tab and a screen reader reach only the top page.

When a page closes, focus returns to the row that opened it.

## Motion

| Part | Motion |
| --- | --- |
| Push | panel · the new page slides in from the end, and the page under it moves 30% to the start |
| Pop | panel · the top page slides out to the end, and the page under it slides back |
| Height | panel · the panel follows the height of the new page |
| Swipe back | instant · the page follows the finger; past 40%, or with a flick, it pops |
