# MultiNavigation
**MultiNavigation** is a component designed for multi-column display and routing navigation on large-screen devices.
> **NOTE**
>
> This component is supported since API version 14. Updates will be marked with a superscript to indicate their earliest API version.
>
> Due to the nested stack structure of **MultiNavigation**, calling APIs explicitly stated as unsupported in this document or APIs not listed in the supported API list (such as **getParent**, **setInterception**, and **pushDestination**) may lead to unpredictable issues.
## Modules to Import
```
import { MultiNavigation, MultiNavPathStack, SplitPolicy } from '@kit.ArkUI';
```
## Child Components
Not supported
## MultiNavigation
MultiNavigation(navDestination: navDestination, multiStack: MultiNavPathStack, onNavigationModeChange?: OnNavigationModeChangeCallback, onHomeShowOnTop?: OnHomeShowOnTopCallback)
Creates and initializes a **MultiNavigation** component.
The **MultiNavigation** component follows the default left-to-right stack clearing rule. This means that a click from the home page on the left triggers the loading of the detail page and simultaneously clears all other detail pages on the right, ensuring that only the most recently loaded detail page is displayed on the right. However, if a detail page loading operation is performed again on the right detail page, the system will not perform the stack clearing action.
**Decorator**: @Component
**Atomic service API**: This API can be used in atomic services since API version 14.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name | Type | Mandatory | Decorator| Description|
|:---------:|:----------------------:|-----| ------ |-----------|
| multiStack | [MultiNavPathStack](#multinavpathstack) | Yes | @State | Navigation stack.|
| navDestination | [NavDestinationBuildFunction](#navdestinationbuildfunction) | Yes| @BuilderParam | Routing rules for loading the target page.|
| onNavigationModeChange | [OnNavigationModeChangeCallback](#onnavigationmodechangecallback) | No| - | Callback invoked when the mode of the **MultiNavigation** component changes.|
| onHomeShowOnTop | [OnHomeShowOnTopCallback](#onhomeshowontopcallback) | No| - | Callback invoked when the home page is on the top of the navigation stack.|
## MultiNavPathStack
Implements a navigation stack of the **MultiNavigation** component. Currently, this stack can be created only by the user and cannot be obtained through callbacks. Do not use events or APIs such as **onReady** of **NavDestination** to obtain the navigation stack and perform stack operations, as this may lead to unpredictable issues.
**Atomic service API**: This API can be used in atomic services since API version 14.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
### pushPath
pushPath(info: NavPathInfo, animated?: boolean, policy?: SplitPolicy): void
Pushes the specified navigation destination page to the navigation stack.
**Parameters**
| Name | Type | Mandatory| Description |
| :------: | :----------------------------------------------------------: | :--: | ----------------------------------------- |
| info | [NavPathInfo](./ts-basic-components-navigation.md#navpathinfo10) | Yes | Information about the navigation destination page. |
| animated | boolean | No | Whether to support transition animations. Default value: **true** |
| policy | [SplitPolicy](#splitpolicy) | No | Policy for the current page being pushed. Default value: **DETAIL_PAGE**|
### pushPath
pushPath(info: NavPathInfo, options?: NavigationOptions, policy?: SplitPolicy): void
Pushes the specified navigation destination page to the navigation stack, with stack operation settings through **NavigationOptions**.
**Parameters**
| Name | Type | Mandatory| Description |
| :-----: | :----------------------------------------------------------: | :--: | ------------------------------------------ |
| info | [NavPathInfo](./ts-basic-components-navigation.md#navpathinfo10) | Yes | Information about the navigation destination page. |
| options | [NavigationOptions](./ts-basic-components-navigation.md#navigationoptions12) | No | Stack operation settings. Only the **animated** field is supported.|
| policy | [SplitPolicy](#splitpolicy) | No | Policy for the current page being pushed. Default value: **DETAIL_PAGE** |
### pushPathByName
pushPathByName(name: string, param: Object, animated?: boolean, policy?: SplitPolicy): void
Pushes the navigation destination page specified by **name** to the navigation stack, passing the data specified by **param**.
**Parameters**
| Name | Type | Mandatory | Description |
|:---------------------:|:------------:|:------:| --------------------- |
| name | string | Yes | Name of the navigation destination page. |
| param | Object | Yes | Detailed parameters of the navigation destination page.|
| animated | boolean | No | Whether to support transition animations. Default value: **true**|
| policy | [SplitPolicy](#splitpolicy) | No | Policy for the current page being pushed. Default value: **DETAIL_PAGE** |
### pushPathByName
pushPathByName(name: string, param: Object, onPop: Callback\, animated?: boolean, policy?: SplitPolicy): void
Pushes the navigation destination page specified by **name** to the navigation stack, passing the data specified by **param**. This API uses the **onPop** callback to handle the result returned when the page is popped out of the stack.
**Parameters**
| Name | Type | Mandatory | Description|
|:---------:|:-------------------------------------------------------------:|:------:|------|
| name | string | Yes | Name of the navigation destination page. |
| param | Object | Yes | Detailed parameters of the navigation destination page.|
| onPop | Callback\<[PopInfo](ts-basic-components-navigation.md#popinfo11)> | Yes | Callback used to handle the return result.|
| animated | boolean | No | Whether to support transition animations. Default value: **true**|
| policy | [SplitPolicy](#splitpolicy) | No | Policy for the current page being pushed. Default value: **DETAIL_PAGE** |
### replacePath
replacePath(info: NavPathInfo, animated?: boolean): void
Replaces the current top page on the stack with the specified navigation destination page. The new page inherits the split policy of the original top page.
**Parameters**
| Name | Type | Mandatory| Description |
| :------: | :----------------------------------------------------------: | :--: | -------------------------------- |
| info | [NavPathInfo](./ts-basic-components-navigation.md#navpathinfo10) | Yes | Information about the navigation destination page. |
| animated | boolean | No | Whether to support transition animations. Default value: **true**|
### replacePath
replacePath(info: NavPathInfo, options?: NavigationOptions): void
Replaces the current top page on the stack with the specified navigation destination page, with stack operation settings through **NavigationOptions**. The new page inherits the split policy of the original top page.
**Parameters**
| Name | Type | Mandatory| Description |
| :-----: | :----------------------------------------------------------: | :--: | ------------------------------------------ |
| info | [NavPathInfo](./ts-basic-components-navigation.md#navpathinfo10) | Yes | Information about the navigation destination page. |
| options | [NavigationOptions](./ts-basic-components-navigation.md#navigationoptions12) | No | Navigation options. Only the **animated** field is supported.|
### replacePathByName
replacePathByName(name: string, param: Object, animated?: boolean): void
Replaces the current top page on the stack with the navigation destination page specified by **name**. The new page inherits the split policy of the original top page.
**Parameters**
| Name | Type | Mandatory | Description |
|:--------:|:---------:|:------:|----------------------|
| name | string | Yes | Name of the navigation destination page. |
| param | Object | Yes | Detailed parameters of the navigation destination page.|
| animated | boolean | No | Whether to support transition animations. Default value: **true** |
### removeByIndexes
removeByIndexes(indexes: Array): number
Removes the navigation destination pages specified by **indexes** from the navigation stack.
**Parameters**
| Name | Type | Mandatory | Description |
|:--------:|:---------------:|:------:| --------------------- |
| indexes | Array | Yes | Array of indexes of the navigation destination pages to remove. |
**Return value**
| Type | Description |
|:-------------:| ------------------------ |
| number | Number of the navigation destination pages removed.|
### removeByName
removeByName(name: string): number
Removes the navigation destination page specified by **name** from the navigation stack.
**Parameters**
| Name | Type | Mandatory | Description |
|:-------:| ------- | ---- | --------------------- |
| name | string | Yes | Name of the navigation destination page to be removed.|
**Return value**
| Type | Description |
|:-------------:| ------------------------ |
| number | Number of the navigation destination pages removed.|
### pop
pop(animated?: boolean): NavPathInfo | undefined
Pops the top element out of the navigation stack.
> **NOTE**
>
> If [keepBottomPage](#keepbottompage) is called with **true**, the bottom page of the navigation stack is retained.
**Parameters**
| Name | Type | Mandatory | Description |
|:-----------:|:--------:|:------:| -------------------- |
| animated | boolean | No | Whether to support transition animations. Default value: **true**|
**Return value**
| Type | Description |
| ----------- | ------------------------ |
| [NavPathInfo](./ts-basic-components-navigation.md#navpathinfo10) \| undefined | Information about the navigation destination page at the top of the stack.|
### pop
pop(result: Object, animated?: boolean): NavPathInfo | undefined
Pops the top element out of the navigation stack and invokes the **onPop** callback to pass the page processing result.
> **NOTE**
>
> If [keepBottomPage](#keepbottompage) is called with **true**, the bottom page of the navigation stack is retained.
**Parameters**
| Name | Type | Mandatory | Description |
|:---------:|:-------------------------------:|:------:| -------------------- |
| result | Object | Yes | Custom processing result on the page.|
| animated | boolean | No | Whether to support transition animations. Default value: **true**|
**Return value**
| Type | Description |
| ----------- | ------------------------ |
| [NavPathInfo](./ts-basic-components-navigation.md#navpathinfo10) \| undefined | Information about the navigation destination page at the top of the stack.|
### popToName
popToName(name: string, animated?: boolean): number
Pops pages until the first navigation destination page that matches **name** from the bottom of the navigation stack is at the top of the stack.
**Parameters**
| Name | Type | Mandatory | Description |
|:----------:|:--------:|:------:| ------------------- |
| name | string | Yes | Name of the navigation destination page.|
| animated | boolean | No | Whether to support transition animations. Default value: **true**|
**Return value**
| Type | Description |
| ------ | ---------------------------------------- |
| number | Returns the index of the first navigation destination page that matches **name** from the bottom of the navigation stack; returns **-1** if no such a page is found.|
### popToName
popToName(name: string, result: Object, animated?: boolean): number
Pops pages until the first navigation destination page that matches **name** from the bottom of the navigation stack is at the top of the stack. This API uses the **onPop** callback to pass in the page processing result.
**Parameters**
| Name | Type | Mandatory | Description |
|:---------:|:--------:|:------:| ------------------- |
| name | string | Yes | Name of the navigation destination page.|
| result | Object | Yes | Custom processing result on the page.|
| animated | boolean | No | Whether to support transition animations. Default value: **true**|
**Return value**
| Type | Description |
| ------ | ---------------------------------------- |
| number | Returns the index of the first navigation destination page that matches **name** from the bottom of the navigation stack; returns **-1** if no such a page is found.|
### popToIndex
popToIndex(index: number, animated?: boolean): void
Returns the navigation stack to the page specified by **index**.
**Parameters**
| Name | Type | Mandatory | Description |
|:------------:|:--------:|:------:| ---------------------- |
| index | number | Yes | Index of the navigation destination page.|
| animated | boolean | No | Whether to support transition animations. Default value: **true**|
### popToIndex
popToIndex(index: number, result: Object, animated?: boolean): void
Returns the navigation stack to the page specified by **index** and invokes the **onPop** callback to pass the page processing result.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ---------------------- |
| index | number | Yes | Index of the navigation destination page.|
| result | Object | Yes| Custom processing result on the page.|
| animated | boolean | No | Whether to support transition animations. Default value: **true**|
### moveToTop
moveToTop(name: string, animated?: boolean): number
Moves the first navigation destination page that matches **name** from the bottom of the navigation stack to the top of the stack.
> **NOTE**
>
> Depending on the type of page found, **MultiNavigation** performs different actions:
>
> 1. If the found page is the topmost home page or a full-screen page, no action is taken.
>
> 2. If the found page is a detail page corresponding to the topmost home page, it is moved to the top.
>
> 3. If the found page is a non-topmost home page, the home page and all corresponding detail pages are moved to the top, maintaining their relative stack order.
>
> 4. If the found page is a non-topmost detail page, the home page and all corresponding detail pages are moved to the top, and the target detail page is moved to the top of the corresponding detail pages.
>
> 5. If the found page is a non-topmost full-screen page, it is moved to the top.
| Name | Type | Mandatory | Description |
|:---------:|:--------:|:------:| ------------------- |
| name | string | Yes | Name of the navigation destination page.|
| animated | boolean | No | Whether to support transition animations. Default value: **true**|
**Return value**
| Type | Description |
|:--------:|:----------------------------------------------------------------------------:|
| number | Returns the index of the first navigation destination page that matches **name** from the bottom of the navigation stack; returns **-1** if no such a page is found. |
### moveIndexToTop
moveIndexToTop(index: number, animated?: boolean): void
Moves the navigation destination page specified by **index** to the top of the navigation stack.
> **NOTE**
>
> Depending on the type of page found, **MultiNavigation** performs different actions:
>
> 1. If the found page is the topmost home page or a full-screen page, no action is taken.
>
> 2. If the found page is a detail page corresponding to the topmost home page, it is moved to the top.
>
> 3. If the found page is a non-topmost home page, the home page and all corresponding detail pages are moved to the top, maintaining their relative stack order.
>
> 4. If the found page is a non-topmost detail page, the home page and all corresponding detail pages are moved to the top, and the target detail page is moved to the top of the corresponding detail pages.
>
> 5. If the found page is a non-topmost full-screen page, it is moved to the top.
| Name | Type | Mandatory | Description |
|:---------:|:-------:|:------:| ------------------- |
| index | number | Yes | Index of the navigation destination page.|
| animated | boolean | No | Whether to support transition animations. Default value: **true**|
### clear
clear(animated?: boolean): void
Clears the navigation stack.
> **NOTE**
>
> If [keepBottomPage](#keepbottompage) is called with **true**, the bottom page of the navigation stack is retained.
**Parameters**
| Name | Type | Mandatory | Description |
|:---------:|:--------:|:------:| ---------------------- |
| animated | boolean | No | Whether to support transition animations. Default value: **true**|
### getAllPathName
getAllPathName(): Array
Obtains the names of all navigation destination pages in the navigation stack.
**Return value**
| Type | Description |
|:----------------:| -------------------------- |
| Array | Names of all navigation destination pages in the navigation stack.|
### getParamByIndex
getParamByIndex(index: number): Object | undefined
Obtains the parameter information of the navigation destination page specified by **index**.
**Parameters**
| Name | Type | Mandatory | Description |
|:-------:|:--------:|:------:| ---------------------- |
| index | number | Yes | Index of the navigation destination page.|
**Return value**
| Type | Description |
| --------- | -------------------------- |
| Object | Parameter information of the matching navigation destination page.|
| undefined | Returned if the provided index is invalid.|
### getParamByName
getParamByName(name: string): Array