# ion-nav

URL: https://ionicframework.com/docs/api/nav

**Encapsulation**: [shadow](/docs/reference/glossary.md#shadow)

Nav is a standalone component for loading arbitrary components and pushing new components on to the stack.

Unlike Router Outlet, Nav is not tied to a particular router. This means that if we load a Nav component, and push other components to the stack, they will not affect the app's overall router. For example, you should not push a new component to `ion-nav` and expect the URL to update. This fits use cases where you could have a modal, which needs its own sub-navigation, without making it tied to the apps URL.

**Note**

`ion-nav` is not meant to be used for routing. Instead, refer to the routing guides for [Angular](/docs/angular/navigation.md), [React](/docs/react/navigation.md), and [Vue](/docs/vue/navigation.md), or [`ion-router`](/docs/api/router.md) for vanilla JavaScript projects.

## Using NavLink

NavLink is a simplified API when interacting with Nav. Developers can customize the component, pass along component properties, modify the direction of the route animation or define a custom animation when navigating.

**JavaScript**

```html
<ion-app>
  <ion-nav root="page-one"></ion-nav>
</ion-app>

<script>
  class PageOne extends HTMLElement {
    connectedCallback() {
      this.innerHTML = `
        <ion-header>
          <ion-toolbar>
            <ion-title>Page One</ion-title>
          </ion-toolbar>
        </ion-header>
        <ion-content class="ion-padding">
          <h1>Page One</h1>
          <ion-nav-link router-direction="forward" component="page-two">
            <ion-button>Go to Page Two</ion-button>
          </ion-nav-link>
        </ion-content>
      `;
    }
  }
  class PageTwo extends HTMLElement {
    connectedCallback() {
      this.innerHTML = `
        <ion-header>
          <ion-toolbar>
            <ion-buttons slot="start">
              <ion-back-button></ion-back-button>
            </ion-buttons>
            <ion-title>Page Two</ion-title>
          </ion-toolbar>
        </ion-header>
        <ion-content class="ion-padding">
          <h1>Page Two</h1>
          <div>
            <ion-nav-link router-direction="forward" component="page-three">
              <ion-button>Go to Page Three</ion-button>
            </ion-nav-link>
          </div>
        </ion-content>
      `;
    }
  }
  class PageThree extends HTMLElement {
    connectedCallback() {
      this.innerHTML = `
        <ion-header>
          <ion-toolbar>
            <ion-buttons slot="start">
              <ion-back-button></ion-back-button>
            </ion-buttons>
            <ion-title>Page Three</ion-title>
          </ion-toolbar>
        </ion-header>
        <ion-content class="ion-padding">
          <h1>Page Three</h1>
        </ion-content>
      `;
    }
  }
  customElements.define('page-one', PageOne);
  customElements.define('page-two', PageTwo);
  customElements.define('page-three', PageThree);
</script>
```

**Angular**

`src/app/example.component.html`

```html
<ion-nav [root]="component"></ion-nav>
```

`src/app/example.component.ts`

```ts
import { Component } from '@angular/core';
import { IonNav } from '@ionic/angular';

import { PageOneComponent } from './page-one.component';

@Component({
  selector: 'app-example',
  templateUrl: 'example.component.html',
  styleUrls: ['example.component.css'],
  imports: [IonNav],
})
export class ExampleComponent {
  component = PageOneComponent;
}
```

`src/app/page-one.component.ts`

```ts
import { Component } from '@angular/core';
import { IonButton, IonContent, IonHeader, IonNavLink, IonTitle, IonToolbar } from '@ionic/angular';

import { PageTwoComponent } from './page-two.component';

@Component({
  selector: 'app-page-one',
  template: `
    <ion-header>
      <ion-toolbar>
        <ion-title>Page One</ion-title>
      </ion-toolbar>
    </ion-header>
    <ion-content class="ion-padding">
      <h1>Page One</h1>
      <ion-nav-link router-direction="forward" [component]="component">
        <ion-button>Go to Page Two</ion-button>
      </ion-nav-link>
    </ion-content>
  `,
  imports: [IonButton, IonContent, IonHeader, IonNavLink, IonTitle, IonToolbar],
})
export class PageOneComponent {
  component = PageTwoComponent;
}
```

`src/app/page-two.component.ts`

```ts
import { Component } from '@angular/core';
import {
  IonBackButton,
  IonButton,
  IonButtons,
  IonContent,
  IonHeader,
  IonNavLink,
  IonTitle,
  IonToolbar,
} from '@ionic/angular';

import { PageThreeComponent } from './page-three.component';

@Component({
  selector: 'app-page-two',
  template: `
    <ion-header>
      <ion-toolbar>
        <ion-buttons slot="start">
          <ion-back-button></ion-back-button>
        </ion-buttons>
        <ion-title>Page Two</ion-title>
      </ion-toolbar>
    </ion-header>
    <ion-content class="ion-padding">
      <h1>Page Two</h1>
      <div>
        <ion-nav-link router-direction="forward" [component]="component">
          <ion-button>Go to Page Three</ion-button>
        </ion-nav-link>
      </div>
    </ion-content>
  `,
  imports: [IonBackButton, IonButton, IonButtons, IonContent, IonHeader, IonNavLink, IonTitle, IonToolbar],
})
export class PageTwoComponent {
  component = PageThreeComponent;
}
```

`src/app/page-three.component.ts`

```ts
import { Component } from '@angular/core';
import { IonBackButton, IonButtons, IonContent, IonHeader, IonTitle, IonToolbar } from '@ionic/angular';

@Component({
  selector: 'app-page-one',
  template: `
    <ion-header>
      <ion-toolbar>
        <ion-buttons slot="start">
          <ion-back-button></ion-back-button>
        </ion-buttons>
        <ion-title>Page Three</ion-title>
      </ion-toolbar>
    </ion-header>
    <ion-content class="ion-padding">
      <h1>Page Three</h1>
    </ion-content>
  `,
  imports: [IonBackButton, IonButtons, IonContent, IonHeader, IonTitle, IonToolbar],
})
export class PageThreeComponent {}
```

**React**

`src/main.tsx`

```tsx
import React from 'react';
import { IonNav } from '@ionic/react';

import PageOne from './page-one';

function Example() {
  return <IonNav root={() => <PageOne />}></IonNav>;
}
export default Example;
```

`src/page-one.tsx`

```tsx
import React from 'react';
import { IonButton, IonHeader, IonContent, IonNavLink, IonToolbar, IonTitle } from '@ionic/react';

import PageTwo from './page-two';

function PageOne() {
  return (
    <>
      <IonHeader>
        <IonToolbar>
          <IonTitle>Page One</IonTitle>
        </IonToolbar>
      </IonHeader>
      <IonContent className="ion-padding">
        <h1>Page One</h1>
        <IonNavLink routerDirection="forward" component={() => <PageTwo />}>
          <IonButton>Go to Page Two</IonButton>
        </IonNavLink>
      </IonContent>
    </>
  );
}

export default PageOne;
```

`src/page-two.tsx`

```tsx
import React from 'react';
import {
  IonBackButton,
  IonButtons,
  IonButton,
  IonHeader,
  IonContent,
  IonNavLink,
  IonToolbar,
  IonTitle,
} from '@ionic/react';

import PageThree from './page-three';

function PageTwo() {
  return (
    <>
      <IonHeader>
        <IonToolbar>
          <IonButtons slot="start">
            <IonBackButton></IonBackButton>
          </IonButtons>
          <IonTitle>Page Two</IonTitle>
        </IonToolbar>
      </IonHeader>
      <IonContent className="ion-padding">
        <h1>Page Two</h1>
        <IonNavLink routerDirection="forward" component={() => <PageThree />}>
          <IonButton>Go to Page Three</IonButton>
        </IonNavLink>
      </IonContent>
    </>
  );
}

export default PageTwo;
```

`src/page-three.tsx`

```tsx
import React from 'react';
import { IonBackButton, IonButtons, IonHeader, IonContent, IonToolbar, IonTitle } from '@ionic/react';

function PageThree() {
  return (
    <>
      <IonHeader>
        <IonToolbar>
          <IonButtons slot="start">
            <IonBackButton></IonBackButton>
          </IonButtons>
          <IonTitle>Page Three</IonTitle>
        </IonToolbar>
      </IonHeader>
      <IonContent className="ion-padding">
        <h1>Page Three</h1>
      </IonContent>
    </>
  );
}

export default PageThree;
```

**Vue**

`src/components/Example.vue`

```vue
<template>
  <ion-nav :root="component"></ion-nav>
</template>

<script setup lang="ts">
import { markRaw } from 'vue';
import { IonNav } from '@ionic/vue';
import PageOne from './PageOne.vue';

const component = markRaw(PageOne);
</script>
```

`src/components/PageOne.vue`

```vue
<template>
  <ion-header>
    <ion-toolbar>
      <ion-title>Page One</ion-title>
    </ion-toolbar>
  </ion-header>
  <ion-content class="ion-padding">
    <h1>Page One</h1>
    <ion-nav-link router-direction="forward" :component="component">
      <ion-button>Go to Page Two</ion-button>
    </ion-nav-link>
  </ion-content>
</template>

<script setup lang="ts">
import { markRaw } from 'vue';
import { IonHeader, IonTitle, IonToolbar, IonContent, IonNavLink, IonButton } from '@ionic/vue';
import PageTwo from './PageTwo.vue';

const component = markRaw(PageTwo);
</script>
```

`src/components/PageTwo.vue`

```vue
<template>
  <ion-header>
    <ion-toolbar>
      <ion-buttons slot="start">
        <ion-back-button></ion-back-button>
      </ion-buttons>
      <ion-title>Page Two</ion-title>
    </ion-toolbar>
  </ion-header>
  <ion-content class="ion-padding">
    <h1>Page Two</h1>
    <ion-nav-link router-direction="forward" :component="component">
      <ion-button>Go to Page Three</ion-button>
    </ion-nav-link>
  </ion-content>
</template>

<script setup lang="ts">
import { markRaw } from 'vue';
import {
  IonHeader,
  IonTitle,
  IonToolbar,
  IonContent,
  IonNavLink,
  IonButton,
  IonButtons,
  IonBackButton,
} from '@ionic/vue';
import PageThree from './PageThree.vue';

const component = markRaw(PageThree);
</script>
```

`src/components/PageThree.vue`

```vue
<template>
  <ion-header>
    <ion-toolbar>
      <ion-buttons slot="start">
        <ion-back-button></ion-back-button>
      </ion-buttons>
      <ion-title>Page Three</ion-title>
    </ion-toolbar>
  </ion-header>
  <ion-content class="ion-padding">
    <h1>Page Three</h1>
  </ion-content>
</template>

<script setup lang="ts">
import { IonHeader, IonTitle, IonToolbar, IonContent, IonButtons, IonBackButton } from '@ionic/vue';
</script>
```

## Navigation within a Modal

Modal can use Nav to offer a linear navigation that is independent of the URL.

**Note**

The example below uses a reference to Nav and the public method APIs to push and pop views. It is recommended to use NavLink in implementations that do not require this level of granular access and control.

**JavaScript**

```html
<ion-app>
  <ion-header>
    <ion-toolbar>
      <ion-title>Modal Navigation</ion-title>
    </ion-toolbar>
  </ion-header>
  <ion-content class="ion-padding">
    <ion-button id="openModal">Open Modal</ion-button>
    <ion-modal trigger="openModal">
      <ion-header>
        <ion-toolbar>
          <ion-title>Modal</ion-title>
          <ion-buttons slot="end">
            <ion-button onclick="dismiss()"> Close </ion-button>
          </ion-buttons>
        </ion-toolbar>
      </ion-header>
      <ion-content>
        <ion-nav></ion-nav>
      </ion-content>
    </ion-modal>
  </ion-content>
</ion-app>

<script>
  const modal = document.querySelector('ion-modal');
  const nav = document.querySelector('ion-nav');

  modal.addEventListener('willPresent', () => {
    nav.setRoot('page-one');
  });

  var dismiss = () => modal.dismiss();

  var navigate = (component) => {
    nav.push(component);
  };

  var navigateBack = () => {
    nav.pop();
  };

  var navigateToRoot = () => {
    nav.popToRoot();
  };

  class PageOne extends HTMLElement {
    connectedCallback() {
      this.innerHTML = `
        <ion-content class="ion-padding">
          <h1>Page One</h1>
          <ion-button onclick="navigate('page-two')">Go to Page Two</ion-button>
        </ion-content>
      `;
    }
  }

  class PageTwo extends HTMLElement {
    connectedCallback() {
      this.innerHTML = `
        <ion-content class="ion-padding">
          <h1>Page Two</h1>
          <ion-button onclick="navigate('page-three')">Go to Page Three</ion-button>
        </ion-content>
      `;
    }
  }

  class PageThree extends HTMLElement {
    connectedCallback() {
      this.innerHTML = `
        <ion-content class="ion-padding">
          <h1>Page Three</h1>
          <ion-button onclick="navigateBack()">Go Back</ion-button>
          <ion-button onclick="navigateToRoot()">Go to Root</ion-button>
        </ion-content>
      `;
    }
  }

  customElements.define('page-one', PageOne);
  customElements.define('page-two', PageTwo);
  customElements.define('page-three', PageThree);
</script>
```

**Angular**

`src/app/example.component.html`

```html
<ion-header>
  <ion-toolbar>
    <ion-title>Modal Navigation</ion-title>
  </ion-toolbar>
</ion-header>
<ion-content class="ion-padding">
  <ion-button id="openModal">Open Modal</ion-button>
  <ion-modal #modal trigger="openModal" (willPresent)="onWillPresent()">
    <ng-template>
      <ion-header>
        <ion-toolbar>
          <ion-title>Modal</ion-title>
          <ion-buttons slot="end">
            <ion-button (click)="modal.dismiss()"> Close </ion-button>
          </ion-buttons>
        </ion-toolbar>
      </ion-header>
      <ion-content>
        <ion-nav #nav></ion-nav>
      </ion-content>
    </ng-template>
  </ion-modal>
</ion-content>
```

`src/app/example.component.ts`

```ts
import { Component, ViewChild } from '@angular/core';
import { IonButton, IonButtons, IonContent, IonHeader, IonModal, IonNav, IonTitle, IonToolbar } from '@ionic/angular';

import { PageOneComponent } from './page-one.component';

@Component({
  selector: 'app-example',
  templateUrl: 'example.component.html',
  styleUrls: ['example.component.css'],
  imports: [IonButton, IonButtons, IonContent, IonHeader, IonModal, IonNav, IonTitle, IonToolbar],
})
export class ExampleComponent {
  @ViewChild('nav') private nav!: IonNav;

  onWillPresent() {
    this.nav.setRoot(PageOneComponent);
  }
}
```

`src/app/page-one.component.ts`

```ts
import { Component } from '@angular/core';
import { IonButton, IonContent, IonNav } from '@ionic/angular';

import { PageTwoComponent } from './page-two.component';

@Component({
  selector: 'app-page-one',
  template: `
    <ion-content class="ion-padding">
      <h1>Page One</h1>
      <ion-button (click)="navigateToPageTwo()">Go to Page Two</ion-button>
    </ion-content>
  `,
  imports: [IonButton, IonContent],
})
export class PageOneComponent {
  constructor(private nav: IonNav) {}

  navigateToPageTwo() {
    this.nav.push(PageTwoComponent);
  }
}
```

`src/app/page-two.component.ts`

```ts
import { Component } from '@angular/core';
import { IonButton, IonContent, IonNav } from '@ionic/angular';

import { PageThreeComponent } from './page-three.component';

@Component({
  selector: 'app-page-two',
  template: `
    <ion-content class="ion-padding">
      <h1>Page Two</h1>
      <ion-button (click)="navigateToPageThree()">Go to Page Three</ion-button>
    </ion-content>
  `,
  imports: [IonButton, IonContent],
})
export class PageTwoComponent {
  component = PageThreeComponent;

  constructor(private nav: IonNav) {}

  navigateToPageThree() {
    this.nav.push(PageThreeComponent);
  }
}
```

`src/app/page-three.component.ts`

```ts
import { Component } from '@angular/core';
import { IonButton, IonContent, IonNav } from '@ionic/angular';

@Component({
  selector: 'app-page-one',
  template: `
    <ion-content class="ion-padding">
      <h1>Page Three</h1>
      <ion-button (click)="navigateBack()">Go Back</ion-button>
      <ion-button (click)="navigateToRoot()">Go to Root</ion-button>
    </ion-content>
  `,
  imports: [IonButton, IonContent],
})
export class PageThreeComponent {
  constructor(private nav: IonNav) {}

  navigateBack() {
    this.nav.pop();
  }

  navigateToRoot() {
    this.nav.popToRoot();
  }
}
```

**React**

`src/main.tsx`

```tsx
import React, { useRef } from 'react';
import {
  IonNav,
  IonPage,
  IonHeader,
  IonToolbar,
  IonTitle,
  IonButton,
  IonButtons,
  IonContent,
  IonModal,
} from '@ionic/react';

import PageOne from './page-one';

function Example() {
  const nav = useRef<HTMLIonNavElement>(null);
  const modal = useRef<HTMLIonModalElement>(null);

  const didPresent = () => {
    if (nav.current) {
      nav.current.setRoot(PageOne, { nav: nav.current });
    }
  };

  const dismiss = () => {
    if (modal.current) {
      modal.current.dismiss();
    }
  };

  return (
    <IonPage>
      <IonHeader>
        <IonToolbar>
          <IonTitle>Modal Navigation</IonTitle>
        </IonToolbar>
      </IonHeader>
      <IonContent className="ion-padding">
        <IonButton id="openModal">Open Modal</IonButton>
        <IonModal ref={modal} trigger="openModal" onDidPresent={didPresent}>
          <IonHeader>
            <IonToolbar>
              <IonTitle>Modal</IonTitle>
              <IonButtons slot="end">
                <IonButton onClick={dismiss}>Close</IonButton>
              </IonButtons>
            </IonToolbar>
          </IonHeader>
          <IonContent>
            <IonNav ref={nav}></IonNav>
          </IonContent>
        </IonModal>
      </IonContent>
    </IonPage>
  );
}
export default Example;
```

`src/page-one.tsx`

```tsx
import React from 'react';
import { IonButton, IonContent } from '@ionic/react';

import PageTwo from './page-two';

function PageOne({ nav }: { nav: HTMLIonNavElement }) {
  const navigateToPageTwo = () => nav.push(PageTwo, { nav });
  return (
    <IonContent className="ion-padding">
      <h1>Page One</h1>
      <IonButton onClick={navigateToPageTwo}>Go to Page Two</IonButton>
    </IonContent>
  );
}

export default PageOne;
```

`src/page-two.tsx`

```tsx
import React from 'react';
import { IonButton, IonContent } from '@ionic/react';

import PageThree from './page-three';

function PageTwo({ nav }: { nav: HTMLIonNavElement }) {
  const navigateToPageThree = () => nav.push(PageThree, { nav });

  return (
    <IonContent className="ion-padding">
      <h1>Page Two</h1>
      <IonButton onClick={navigateToPageThree}>Go to Page Three</IonButton>
    </IonContent>
  );
}

export default PageTwo;
```

`src/page-three.tsx`

```tsx
import React from 'react';
import { IonButton, IonContent } from '@ionic/react';

function PageThree({ nav }: { nav: HTMLIonNavElement }) {
  const navigateBack = () => nav.pop();
  const navigateToRoot = () => nav.popToRoot();

  return (
    <IonContent className="ion-padding">
      <h1>Page Three</h1>
      <IonButton onClick={navigateBack}>Go Back</IonButton>
      <IonButton onClick={navigateToRoot}>Go to Root</IonButton>
    </IonContent>
  );
}

export default PageThree;
```

**Vue**

`src/components/Example.vue`

```vue
<template>
  <ion-page>
    <ion-header>
      <ion-toolbar>
        <ion-title>Modal Navigation</ion-title>
      </ion-toolbar>
    </ion-header>
    <ion-content class="ion-padding">
      <ion-button id="openModal">Open Modal</ion-button>
      <ion-modal ref="modal" trigger="openModal" @will-present="onWillPresent">
        <ion-header>
          <ion-toolbar>
            <ion-title>Modal</ion-title>
            <ion-buttons slot="end">
              <ion-button @click="dismiss"> Close </ion-button>
            </ion-buttons>
          </ion-toolbar>
        </ion-header>
        <ion-content>
          <ion-nav ref="nav"></ion-nav>
        </ion-content>
      </ion-modal>
    </ion-content>
  </ion-page>
</template>

<script setup lang="ts">
import { nextTick, ref } from 'vue';
import {
  IonNav,
  IonPage,
  IonHeader,
  IonToolbar,
  IonTitle,
  IonContent,
  IonButton,
  IonModal,
  IonButtons,
} from '@ionic/vue';
import PageOne from './PageOne.vue';

const modal = ref();
const nav = ref();

const dismiss = () => {
  modal.value.$el.dismiss();
};

const onWillPresent = async () => {
  // Need to wait two ticks before the ref is set
  await nextTick();
  await nextTick();

  const navEl = nav.value.$el;
  navEl.setRoot(PageOne, { nav: navEl });
};
</script>
```

`src/components/PageOne.vue`

```vue
<template>
  <ion-content class="ion-padding">
    <h1>Page One</h1>
    <ion-button @click="navigateToPageTwo">Go to Page Two</ion-button>
  </ion-content>
</template>

<script setup lang="ts">
import { IonContent, IonButton } from '@ionic/vue';
import PageTwo from './PageTwo.vue';

interface Props {
  nav: any;
}

const props = defineProps<Props>();

const navigateToPageTwo = () => {
  const { nav } = props;
  nav.push(PageTwo, { nav });
};
</script>
```

`src/components/PageTwo.vue`

```vue
<template>
  <ion-content class="ion-padding">
    <h1>Page Two</h1>
    <ion-button @click="navigateToPageThree">Go to Page Three</ion-button>
  </ion-content>
</template>

<script setup lang="ts">
import { IonContent, IonButton } from '@ionic/vue';
import PageThree from './PageThree.vue';

interface Props {
  nav: any;
}

const props = defineProps<Props>();

const navigateToPageThree = () => {
  const { nav } = props;
  nav.push(PageThree, { nav });
};
</script>
```

`src/components/PageThree.vue`

```vue
<template>
  <ion-content class="ion-padding">
    <h1>Page Three</h1>
    <ion-button @click="navigateBack">Go Back</ion-button>
    <ion-button @click="navigateToRoot">Go to Root</ion-button>
  </ion-content>
</template>

<script setup lang="ts">
import { IonContent, IonButton } from '@ionic/vue';

interface Props {
  nav: any;
}

const props = defineProps<Props>();

const navigateBack = () => {
  const { nav } = props;
  nav.pop();
};

const navigateToRoot = () => {
  const { nav } = props;
  nav.popToRoot();
};
</script>
```

## Interfaces

### NavCustomEvent

While not required, this interface can be used in place of the `CustomEvent` interface for stronger typing with Ionic events emitted from this component.

```typescript
interface NavCustomEvent extends CustomEvent {
  target: HTMLIonNavElement;
}
```

## Properties

### animated

**Description**: If `true`, the nav should animate the transition of components.

**Attribute**: `animated`

**Type**: `boolean`

**Default**: `true`

### animation

**Description**: By default `ion-nav` animates transition between pages based in the mode (ios or material design). However, this property allows to create custom transition using `AnimationBuilder` functions.

**Attribute**: `undefined`

**Type**: `((baseEl: any, opts?: any) => Animation) | undefined`

**Default**: `undefined`

### root

**Description**: Root NavComponent to load

**Attribute**: `root`

**Type**: `Function | HTMLElement | ViewController | null | string | undefined`

**Default**: `undefined`

### rootParams

**Description**: Any parameters for the root component

**Attribute**: `undefined`

**Type**: `T | undefined`

**Default**: `undefined`

### swipeGesture

**Description**: If the nav component should allow for swipe-to-go-back.

**Attribute**: `swipe-gesture`

**Type**: `boolean | undefined`

**Default**: `undefined`

## Events

| Name | Description | Bubbles |
| --- | --- | --- |
| `ionNavDidChange` | Event fired when the nav has changed components | `false` |
| `ionNavWillChange` | Event fired when the nav will change components | `false` |

## Methods

### canGoBack

**Description**: Returns `true` if the current view can go back.

**Signature**: `canGoBack(view?: ViewController) => Promise<boolean>`

**Parameters**: **view**: The view to check.

### getActive

**Description**: Get the active view.

**Signature**: `getActive() => Promise<ViewController | undefined>`

### getByIndex

**Description**: Get the view at the specified index.

**Signature**: `getByIndex(index: number) => Promise<ViewController | undefined>`

**Parameters**: **index**: The index of the view.

### getLength

**Description**: Returns the number of views in the stack.

**Signature**: `getLength() => Promise<number>`

### getPrevious

**Description**: Get the previous view.

**Signature**: `getPrevious(view?: ViewController) => Promise<ViewController | undefined>`

**Parameters**: **view**: The view to get.

### insert

**Description**: Inserts a component into the navigation stack at the specified index. This is useful to add a component at any point in the navigation stack.

**Signature**: `insert<T extends NavComponent>(insertIndex: number, component: T, componentProps?: ComponentProps<T> | null, opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>`

**Parameters**: **insertIndex**: The index to insert the component at in the stack. **component**: The component to insert into the navigation stack. **componentProps**: Any properties of the component. **opts**: The navigation options. **done**: The transition complete function.

### insertPages

**Description**: Inserts an array of components into the navigation stack at the specified index. The last component in the array will become instantiated as a view, and animate in to become the active view.

**Signature**: `insertPages(insertIndex: number, insertComponents: NavComponent[] | NavComponentWithProps[], opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>`

**Parameters**: **insertIndex**: The index to insert the components at in the stack. **insertComponents**: The components to insert into the navigation stack. **opts**: The navigation options. **done**: The transition complete function.

### pop

**Description**: Pop a component off of the navigation stack. Navigates back from the current component.

**Signature**: `pop(opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>`

**Parameters**: **opts**: The navigation options. **done**: The transition complete function.

### popTo

**Description**: Pop to a specific index in the navigation stack.

**Signature**: `popTo(indexOrViewCtrl: number | ViewController, opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>`

**Parameters**: **indexOrViewCtrl**: The index or view controller to pop to. **opts**: The navigation options. **done**: The transition complete function.

### popToRoot

**Description**: Navigate back to the root of the stack, no matter how far back that is.

**Signature**: `popToRoot(opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>`

**Parameters**: **opts**: The navigation options. **done**: The transition complete function.

### push

**Description**: Push a new component onto the current navigation stack. Pass any additional information along as an object. This additional information is accessible through NavParams.

**Signature**: `push<T extends NavComponent>(component: T, componentProps?: ComponentProps<T> | null, opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>`

**Parameters**: **component**: The component to push onto the navigation stack. **componentProps**: Any properties of the component. **opts**: The navigation options. **done**: The transition complete function.

### removeIndex

**Description**: Removes a component from the navigation stack at the specified index.

**Signature**: `removeIndex(startIndex: number, removeCount?: number, opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>`

**Parameters**: **startIndex**: The number to begin removal at. **removeCount**: The number of components to remove. **opts**: The navigation options. **done**: The transition complete function.

### setPages

**Description**: Set the views of the current navigation stack and navigate to the last view. By default animations are disabled, but they can be enabled by passing options to the navigation controller. Navigation parameters can also be passed to the individual pages in the array.

**Signature**: `setPages(views: NavComponent[] | NavComponentWithProps[], opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>`

**Parameters**: **views**: The list of views to set as the navigation stack. **opts**: The navigation options. **done**: The transition complete function.

### setRoot

**Description**: Set the root for the current navigation stack to a component.

**Signature**: `setRoot<T extends NavComponent>(component: T, componentProps?: ComponentProps<T> | null, opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>`

**Parameters**: **component**: The component to set as the root of the navigation stack. **componentProps**: Any properties of the component. **opts**: The navigation options. **done**: The transition complete function.

## CSS Shadow Parts

No CSS shadow parts available for this component.

## CSS Custom Properties

No CSS custom properties available for this component.

## Slots

| Name | Description |
| --- | --- |
|  | The default slot |
