1# NavDestination 2 3**NavDestination** is the root container of a destination page and represents the content area of the [Navigation](ts-basic-components-navigation.md) component. 4 5> **NOTE** 6> 7> - This component is supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version. 8> 9> - Since API version 11, this component supports the safe area attribute by default, with the default attribute value being **expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])**. You can override this attribute to change the default behavior. In earlier versions, you need to use the [expandSafeArea](ts-universal-attributes-expand-safe-area.md) attribute to implement the safe area feature. 10> 11> - The **NavDestination** component must be used in conjunction with the **Navigation** component to act as the root node for the navigation destination page. When used alone, it can only function as a standard container component and does not possess any routing-related attributes or capabilities. 12> 13> - If the lifecycle of a page in the middle of the navigation stack changes, the lifecycle of the destination page at the top of the stack before the transition (**onWillShow**, **onShown**, **onHidden**, **onWillDisappear**) and the lifecycle of the destination page after the transition (**onWillShow**, **onShown**, **onHidden**, **onWillDisappear**) are both triggered at the end. 14> 15> - If no main title or subtitle is set for **NavDestination** and there is no back button, the title bar is not displayed. 16 17## Child Components 18 19Built-in components and custom components are allowed, with support for ([if/else](../../../ui/state-management/arkts-rendering-control-ifelse.md), [ForEach](../../../ui/state-management/arkts-rendering-control-foreach.md), and [LazyForEach](../../../ui/state-management/arkts-rendering-control-lazyforeach.md)) rendering control. 20 21Number of child components: multiple. 22 23 24## APIs 25 26NavDestination() 27 28**Atomic service API**: This API can be used in atomic services since API version 11. 29 30**System capability**: SystemCapability.ArkUI.ArkUI.Full 31 32## Attributes 33 34The [universal attributes](ts-component-general-attributes.md) are supported. 35 36Avoid setting layout-related attributes such as the position and size. They may result in display issues on the page. 37 38### title 39 40title(value: string | CustomBuilder | NavDestinationCommonTitle | NavDestinationCustomTitle | Resource, options?: NavigationTitleOptions) 41 42Sets the page title. When the NavigationCustomTitle type is used to set the height, the [titleMode](ts-basic-components-navigation.md#titlemode) attribute does not take effect. When the title string is too long: (1) If no subtitle is set, the string is scaled down, wrapped in two lines, and then clipped with an ellipsis (...); (2) If a subtitle is set, the subtitle is scaled down and then clipped with an ellipsis (...). 43 44**Atomic service API**: This API can be used in atomic services since API version 11. 45 46**System capability**: SystemCapability.ArkUI.ArkUI.Full 47 48**Parameters** 49 50| Name| Type | Mandatory| Description | 51| ------ | ------------------------------------------------------------ | ---- | ---------- | 52| value | string \| [CustomBuilder](ts-types.md#custombuilder8) \| [NavDestinationCommonTitle](#navdestinationcommontitle) \| [NavDestinationCustomTitle](#navdestinationcustomtitle) \| [Resource<sup>14+</sup>](ts-types.md#resource) | Yes | Page title.| 53| options<sup>12+</sup> | [NavigationTitleOptions](ts-basic-components-navigation.md#navigationtitleoptions11) | No | Title bar options.| 54 55### hideTitleBar 56 57hideTitleBar(value: boolean) 58 59Specifies whether to hide the title bar. 60 61**Atomic service API**: This API can be used in atomic services since API version 11. 62 63**System capability**: SystemCapability.ArkUI.ArkUI.Full 64 65**Parameters** 66 67| Name| Type | Mandatory| Description | 68| ------ | ------- | ---- | ------------------------------------------------------------ | 69| value | boolean | Yes | Whether to hide the title bar.<br>Default value: **false**<br>**true**: Hide the title bar.<br>**false**: Display the title bar.| 70 71### hideTitleBar<sup>13+</sup> 72 73hideTitleBar(hide: boolean, animated: boolean) 74 75Sets whether to hide the title bar and whether to animate the visibility change. 76 77**Atomic service API**: This API can be used in atomic services since API version 13. 78 79**System capability**: SystemCapability.ArkUI.ArkUI.Full 80 81**Parameters** 82 83| Name| Type | Mandatory| Description | 84| ------ | ------- | ---- | ------------------------------------------------------------ | 85| hide | boolean | Yes | Whether to hide the title bar.<br>Default value: **false**<br>**true**: Hide the title bar.<br>**false**: Show the title bar.| 86| animated | boolean | Yes | Whether to animate the visibility change.<br>Default value: **false**<br>**true**: Animate the visibility change.<br>**false**: Do not animate the visibility change.| 87 88### toolbarConfiguration<sup>13+</sup> 89 90toolbarConfiguration(toolbarParam: Array<ToolbarItem> | CustomBuilder, options?: NavigationToolbarOptions) 91 92Sets the content of the toolbar. If this API is not called, the toolbar remains hidden. 93 94**Atomic service API**: This API can be used in atomic services since API version 13. 95 96**System capability**: SystemCapability.ArkUI.ArkUI.Full 97 98**Parameters** 99 100| Name | Type | Mandatory| Description | 101| ------------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 102| toolbarParam | Array<[ToolbarItem](ts-basic-components-navigation.md#toolbaritem10)> \| [CustomBuilder](ts-types.md#custombuilder8) | Yes | Content of the toolbar.<br>When configured with Array<[ToolbarItem](ts-basic-components-navigation.md#toolbaritem10)>, the toolbar follows the rules below:<br>- Toolbar items are evenly distributed on the bottom toolbar, with text and icons evenly spaced in each content area.<br>- If any item contains overlong text and there are fewer than five items, the toolbar will: 1. Increase the item width to accommodate the text until the toolbar spans the screen width; 2. Reduce the text size progressively; 3. Wrap the text over two lines; 4. Clip the text with an ellipsis (...).<br>- In portrait mode, the toolbar shows a maximum of five icons, with any additional icons placed under an automatically generated **More** icon. In landscape mode, the behavior of the toolbar is determined by the display mode: (1) If the display mode is [Split](ts-basic-components-navigation.md#navigationmode9), the toolbar follows the same rules as in portrait mode. (2) If the display mode is [Stack](ts-basic-components-navigation.md#navigationmode9), the toolbar must be used together with Array<[NavigationMenuItem](ts-basic-components-navigation.md#navigationmenuitem)> of the **menus** attribute; in this configuration, the bottom toolbar is automatically hidden, and all items on the toolbar are relocated to the menu in the upper right corner of the screen.<br>When configured with [CustomBuilder](ts-types.md#custombuilder8), the toolbar does not follow the above rules, except for evenly distributing items at the bottom of the toolbar.| 103| options | [NavigationToolbarOptions](ts-basic-components-navigation.md#navigationtoolbaroptions11) | No | Toolbar options. | 104 105> **NOTE** 106> 107> The following are not allowed: modify the icon size through the **fontSize** attribute of the **SymbolGlyphModifier** object, change the animation effects through the **effectStrategy** attribute, or change the type of animation effects through the **symbolEffect** attribute. 108 109### hideToolBar<sup>13+</sup> 110 111hideToolBar(hide: boolean, animated?: boolean) 112 113Sets whether to hide the toolbar and whether to animate the visibility change. 114 115**Atomic service API**: This API can be used in atomic services since API version 13. 116 117**System capability**: SystemCapability.ArkUI.ArkUI.Full 118 119**Parameters** 120 121| Name| Type | Mandatory| Description | 122| ------ | ------- | ---- | ------------------------------------------------------------ | 123| hide | boolean | Yes | Whether to hide the toolbar.<br>Default value: **false**<br>**true**: Hide the toolbar.<br>**false**: Show the toolbar.| 124| animated | boolean | No | Whether to animate the visibility change.<br>Default value: **false**<br>**true**: Animate the visibility change.<br>**false**: Do not animate the visibility change.| 125 126### mode <sup>11+</sup> 127 128mode(value: NavDestinationMode) 129 130Sets the mode of the **NavDestination** component. Dynamic modification is not supported. 131 132**Atomic service API**: This API can be used in atomic services since API version 12. 133 134**System capability**: SystemCapability.ArkUI.ArkUI.Full 135 136**Parameters** 137 138| Name| Type | Mandatory| Description | 139| ------ | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | 140| value | [NavDestinationMode](#navdestinationmode11) | Yes | Mode of the **NavDestination** component.<br>Default value: **NavDestinationMode.STANDARD**| 141 142### backButtonIcon<sup>11+</sup> 143 144backButtonIcon(value: ResourceStr | PixelMap | SymbolGlyphModifier) 145 146> **NOTE** 147> 148> The following are not allowed: modify the icon size through the **fontSize** attribute of the **SymbolGlyphModifier** object, change the animation effects through the **effectStrategy** attribute, or change the type of animation effects through the **symbolEffect** attribute. 149 150 151Sets the icon of the back button on the title bar. 152 153**Atomic service API**: This API can be used in atomic services since API version 12. 154 155**System capability**: SystemCapability.ArkUI.ArkUI.Full 156 157**Parameters** 158 159| Name| Type | Mandatory| Description | 160| ------ | ------------------------------------------------------------ | ---- | ------------------ | 161| value | [ResourceStr](ts-types.md#resourcestr) \| [PixelMap](../../apis-image-kit/js-apis-image.md#pixelmap7) \| [SymbolGlyphModifier<sup>12+</sup>](ts-universal-attributes-attribute-modifier.md) | Yes | Icon of the back button on the title bar.| 162 163### backButtonIcon<sup>18+</sup> 164 165backButtonIcon(icon: ResourceStr | PixelMap | SymbolGlyphModifier, accessibilityText?: ResourceStr) 166 167> **NOTE** 168> 169> The following are not allowed: modify the icon size through the **fontSize** attribute of the **SymbolGlyphModifier** object, change the animation effects through the **effectStrategy** attribute, or change the type of animation effects through the **symbolEffect** attribute. 170 171 172Sets the icon and accessibility text for the back button on the title bar. 173 174**Atomic service API**: This API can be used in atomic services since API version 18. 175 176**System capability**: SystemCapability.ArkUI.ArkUI.Full 177 178**Parameters** 179 180| Name| Type | Mandatory| Description | 181| ------ | ------------------------------------------------------------ | ---- | ------------------ | 182| icon | [ResourceStr](ts-types.md#resourcestr) \| [PixelMap](../../apis-image-kit/js-apis-image.md#pixelmap7) \| [SymbolGlyphModifier](ts-universal-attributes-attribute-modifier.md) | Yes | Icon of the back button on the title bar.| 183| accessibilityText | [ResourceStr](ts-types.md#resourcestr) | No| Accessibility text for the back button.<br>Default value: **back** when the system language is English.| 184 185### menus<sup>12+</sup> 186 187menus(items: Array<NavigationMenuItem> | CustomBuilder, options?: NavigationMenuOptions) 188 189> **NOTE** 190> 191> The following are not allowed: modify the icon size through the **fontSize** attribute of the **SymbolGlyphModifier** object, change the animation effects through the **effectStrategy** attribute, or change the type of animation effects through the **symbolEffect** attribute. 192 193 194Sets the menu items in the upper right corner of the page. If this attribute is not set, no menu item is displayed. When the value type is Array<[NavigationMenuItem](ts-basic-components-navigation.md#navigationmenuitem)>, the menu shows a maximum of three icons in portrait mode and a maximum of five icons in landscape mode, with excess icons (if any) placed under the automatically generated **More** icon. 195 196**Atomic service API**: This API can be used in atomic services since API version 12. 197 198**System capability**: SystemCapability.ArkUI.ArkUI.Full 199 200**Parameters** 201 202| Name| Type | Mandatory| Description | 203| ------ | ------------------------------------------------------------ | ---- | ------------------ | 204| items | Array<[NavigationMenuItem](ts-basic-components-navigation.md#navigationmenuitem)> \| [CustomBuilder](ts-types.md#custombuilder8) | Yes | Menu items in the upper right corner of the page.| 205| options<sup>18+</sup> | [NavigationMenuOptions](ts-basic-components-navigation.md#navigationmenuoptions18) | No | Optional settings for menu items in the upper right corner of the page.| 206 207### ignoreLayoutSafeArea<sup>12+</sup> 208 209ignoreLayoutSafeArea(types?: Array<LayoutSafeAreaType>, edges?: Array<LayoutSafeAreaEdge>) 210 211Ignores the layout safe area by allowing the component to extend into the non-safe areas of the screen. 212 213**Atomic service API**: This API can be used in atomic services since API version 12. 214 215**System capability**: SystemCapability.ArkUI.ArkUI.Full 216 217**Parameters** 218 219| Name| Type | Mandatory| Description | 220| ------ | -------------------------------------------------- | ---- | ------------------------------------------------------------ | 221| types | Array <[LayoutSafeAreaType](ts-types.md#layoutsafeareatype12)> | No | Types of non-safe areas to extend into.<br>Default value:<br>[LayoutSafeAreaType.SYSTEM] | 222| edges | Array <[LayoutSafeAreaEdge](ts-types.md#layoutsafeareaedge12)> | No | Edges for expanding the safe area.<br> Default value:<br>[LayoutSafeAreaEdge.TOP, LayoutSafeAreaEdge.BOTTOM]| 223 224> **NOTE** 225> 226> After **LayoutSafeArea** is set: 227> When **LayoutSafeAreaType.SYSTEM** is set, the component can extend into the non-safe area if its boundaries overlap with it. For example, if the device's status bar is 100 high, the component must have an absolute vertical offset between 0 and 100 to extend into the non-safe area. 228> 229> If the component extends into the non-safe area, events triggered within that area (such as click events) might be intercepted by the system. This allows the system to prioritize responses to system components such as the status bar. 230 231### systemBarStyle<sup>12+</sup> 232 233systemBarStyle(style: Optional<SystemBarStyle>) 234 235Sets the style of the system status bar when this **NavDestination** page is displayed in the **Navigation** component. 236 237**Atomic service API**: This API can be used in atomic services since API version 12. 238 239**System capability**: SystemCapability.ArkUI.ArkUI.Full 240 241**Parameters** 242 243| Name| Type | Mandatory| Description | 244| ------ | -------------- | ---- | ------------------ | 245| style | [Optional](ts-universal-attributes-custom-property.md#optional12)<[SystemBarStyle](../js-apis-window.md#systembarstyle12)> | Yes | Style of the system status bar.| 246 247> **NOTE** 248> 249> 1. The setting takes effect only when the **NavDestination** component is used in conjunction with the **Navigation** component. 250> 2. For other usage restrictions, see the description of [systemBarStyle](ts-basic-components-navigation.md#systembarstyle12) for the **Navigation** component. 251 252### systemTransition<sup>14+</sup> 253systemTransition(type: NavigationSystemTransitionType) 254 255Sets the system transition animation of the **NavDestination** component. System transition animations for the title bar and content area can be configured separately. 256 257**Atomic service API**: This API can be used in atomic services since API version 14. 258 259**System capability**: SystemCapability.ArkUI.ArkUI.Full 260 261**Parameters** 262 263| Name| Type | Mandatory| Description | 264| ------ | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | 265| type | [NavigationSystemTransitionType](#navigationsystemtransitiontype14) | Yes | Type of the system transition animation.<br>Default value: **NavigationSystemTransitionType.DEFAULT**| 266 267### recoverable<sup>14+</sup> 268 269recoverable(recoverable: Optional<boolean>) 270 271Sets whether the **NavDestination** component is recoverable. If set to recoverable, when the application process exits unexpectedly and restarts, the **NavDestination** component will be automatically recreated. To use this feature, ensure that the **recoverable** attribute is set for the **Navigation** component associated with the **NavDestination** component. 272 273**System capability**: SystemCapability.ArkUI.ArkUI.Full 274 275**Parameters** 276 277| Name| Type | Mandatory| Description | 278| ------ | -------------- | ---- | ------------------ | 279| recoverable | [Optional](ts-universal-attributes-custom-property.md#optional12)<boolean> | Yes | Whether the **NavDestination** component is recoverable. By default, it is not recoverable.<br>Default value: **false**<br>**true**: The **NavDestination** component is recoverable.<br>**false**: The **NavDestination** component is not recoverable.| 280 281> **NOTE** 282> 283> This API must be used together with the [recoverable](./ts-basic-components-navigation.md#recoverable14) API of **Navigation**. 284 285### bindToScrollable<sup>14+</sup> 286bindToScrollable(scrollers: Array<Scroller>) 287 288Binds the **NavDestination** component with a scrollable container, which can be a [List](./ts-container-list.md), [Scroll](./ts-container-scroll.md), [Grid](./ts-container-grid.md), or [WaterFlow](./ts-container-waterflow.md) component. This way, scrolling in the scrollable container triggers the display and hide animations of the title bar and toolbar of all **NavDestination** components that are bound to it – scrolling up triggers the hide animation, and scrolling down triggers the show animation. A single **NavDestination** component can be bound to multiple scrollable containers, and a single scrollable container can be bound to multiple **NavDestination** components. For details, see [Example 1](#example-1-linking-the-title-bar-and-toolbar-with-scrollable-components). 289 290> **NOTE** 291> 292> - The connection between the scrolling actions and the animations for showing or hiding the title bar and toolbar of the **NavDestination** component takes effect only when the title bar or toolbar is visible. 293> - If a **NavDestination** component is bound to multiple scrollable containers, scrolling in any of these containers triggers the display or hiding animations of the title bar and toolbar. Specifically, when any scrollable container reaches either the bottom or the top, the display animation for the title bar and toolbar is triggered without delay. As such, to ensure the optimal user experience, avoid triggering scroll events of multiple scrollable containers simultaneously. 294 295**Atomic service API**: This API can be used in atomic services since API version 14. 296 297**System capability**: SystemCapability.ArkUI.ArkUI.Full 298 299**Parameters** 300 301| Name| Type | Mandatory| Description | 302| ------ | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | 303| scrollers | Array<[Scroller](./ts-container-scroll.md#scroller)> | Yes | Controller of the target scrollable container.| 304 305### bindToNestedScrollable<sup>14+</sup> 306bindToNestedScrollable(scrollInfos: Array<NestedScrollInfo>) 307 308Binds the **NavDestination** component with a nested scrollable container, which can be a [List](./ts-container-list.md), [Scroll](./ts-container-scroll.md), [Grid](./ts-container-grid.md), or [WaterFlow](./ts-container-waterflow.md) component. This way, scrolling in the scrollable container triggers the display and hide animations of the title bar and toolbar of all **NavDestination** components that are bound to it – scrolling up triggers the hide animation, and scrolling down triggers the show animation. A single **NavDestination** component can be bound to multiple nested scrollable containers, and a single nested scrollable container can be bound to multiple **NavDestination** components. For details, see [Example 1](#example-1-linking-the-title-bar-and-toolbar-with-scrollable-components). 309 310> **NOTE** 311> 312> - The connection between the scrolling actions and the animations for showing or hiding the title bar and toolbar of the **NavDestination** component takes effect only when the title bar or toolbar is visible. 313> - If a **NavDestination** component is bound to multiple scrollable containers, scrolling in any of these containers triggers the display or hiding animations of the title bar and toolbar. Specifically, when any scrollable container reaches either the bottom or the top, the display animation for the title bar and toolbar is triggered without delay. As such, to ensure the optimal user experience, avoid triggering scroll events of multiple scrollable containers simultaneously. 314 315**Atomic service API**: This API can be used in atomic services since API version 14. 316 317**System capability**: SystemCapability.ArkUI.ArkUI.Full 318 319**Parameters** 320 321| Name| Type | Mandatory| Description | 322| ------ | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | 323| scrollInfos | Array<[NestedScrollInfo](#nestedscrollinfo14)> | Yes | Controller of the target nested scrollable containers.| 324 325### hideBackButton<sup>15+</sup> 326 327hideBackButton(hide: Optional<boolean>) 328 329Sets whether to hide the back button in the title bar. 330 331**Atomic service API**: This API can be used in atomic services since API version 15. 332 333**System capability**: SystemCapability.ArkUI.ArkUI.Full 334 335**Parameters** 336 337| Name| Type | Mandatory| Description | 338| ------ | ------- | ---- | ------------------------------------------------------------ | 339| hide | [Optional](ts-universal-attributes-custom-property.md#optional12)<boolean> | Yes | Whether to hide the back button in the title bar.<br>Default value: **false**<br>**true**: Hide the back button.<br>**false**: Show the back button.| 340 341### customTransition<sup>15+</sup> 342 343customTransition(delegate: NavDestinationTransitionDelegate) 344 345Sets a custom transition animation for the **NavDestination** component. 346 347> **NOTE** 348> 349> If both this attribute and [systemTransition](#systemtransition14) are set, whichever is set later takes effect. 350 351**Atomic service API**: This API can be used in atomic services since API version 15. 352 353**System capability**: SystemCapability.ArkUI.ArkUI.Full 354 355**Parameters** 356 357| Name| Type | Mandatory| Description | 358| ------ | ------- | ---- | ------------------------------------------------------------ | 359| delegate | [NavDestinationTransitionDelegate](#navdestinationtransitiondelegate15) | Yes | Delegate function for custom animations of the **NavDestination** component.| 360 361### preferredOrientation<sup>18+</sup> 362 363preferredOrientation(orientation: Optional<Orientation>) 364 365Sets the display orientation for the **NavDestination** component. After the transition to the NavDestination, the system also switches the application's main window to the specified display orientation. 366 367> **NOTE** 368> 369> This attribute is effective only if the following conditions are all met: 370> 1. The **NavDestination** component belongs to the application's main window page, and the main window is a full-screen window. 371> 2. The size of the **Navigation** container to which the **NavDestination** component belongs occupies the entire application page. 372> 3. The type of **NavDestination** is [STANDARD](#navdestinationmode11). 373> 374> The actual effect of setting the display orientation depends on the specific device support. For details, see [setPreferredOrientation](../js-apis-window.md#setpreferredorientation9-1). 375 376**Atomic service API**: This API can be used in atomic services since API version 18. 377 378**System capability**: SystemCapability.ArkUI.ArkUI.Full 379 380**Parameters** 381 382| Name| Type | Mandatory| Description | 383| ------ | ------- | ---- | ------------------------------------------------------------ | 384| orientation | [Optional](ts-universal-attributes-custom-property.md#optional12)<[Orientation](../js-apis-window.md#orientation9)> | Yes | Display orientation to set.| 385 386### enableStatusBar<sup>18+</sup> 387 388enableStatusBar(enabled: Optional<boolean>, animated?: boolean) 389 390Sets whether to show or hide the system status bar when entering this **NavDestination** component. 391 392> **NOTE** 393> 394> This attribute is effective only if the following conditions are all met: 395> 1. The **NavDestination** component belongs to the application's main window page, and the main window is a full-screen window. 396> 2. The size of the **Navigation** container to which the **NavDestination** component belongs occupies the entire application page. 397> 3. The size of the **NavDestination** component occupies the entire **Navigation** container. 398> 4. The type of **NavDestination** is [STANDARD](#navdestinationmode11). 399> 400> The actual effect of setting the system status bar depends on the specific device support. For details, see [setSpecificSystemBarEnabled](../js-apis-window.md#setspecificsystembarenabled11). 401 402**Atomic service API**: This API can be used in atomic services since API version 18. 403 404**System capability**: SystemCapability.ArkUI.ArkUI.Full 405 406**Parameters** 407 408| Name| Type | Mandatory| Description | 409| ------ | ------- | ---- | ------------------------------------------------------------ | 410| enabled | [Optional](ts-universal-attributes-custom-property.md#optional12)<boolean> | Yes | Whether to show or hide the system status bar when entering the current **NavDestination** component.| 411| animated | boolean | No | Whether to use an animation to show or hide the system status bar.<br>Default value: **false**| 412 413### enableNavigationIndicator<sup>18+</sup> 414 415enableNavigationIndicator(enabled: Optional<boolean>) 416 417Sets whether to show or hide the system navigation bar when entering this **NavDestination** component. 418 419> **NOTE** 420> 421> This attribute is effective only if the following conditions are all met: 422> 1. The **NavDestination** component belongs to the application's main window page, and the main window is a full-screen window. 423> 2. The size of the **Navigation** container to which the **NavDestination** component belongs occupies the entire application page. 424> 3. The size of the **NavDestination** component occupies the entire **Navigation** container. 425> 4. The type of **NavDestination** is [STANDARD](#navdestinationmode11). 426> 427> The actual effect of setting the system navigation bar depends on the specific device support. For details, see [setSpecificSystemBarEnabled](../js-apis-window.md#setspecificsystembarenabled11). 428 429**Atomic service API**: This API can be used in atomic services since API version 18. 430 431**System capability**: SystemCapability.ArkUI.ArkUI.Full 432 433**Parameters** 434 435| Name| Type | Mandatory| Description | 436| ------ | ------- | ---- | ------------------------------------------------------------ | 437| enabled | [Optional](ts-universal-attributes-custom-property.md#optional12)<boolean> | Yes | Whether to show or hide the system navigation bar when entering the current **NavDestination** component.| 438 439## NavDestinationMode<sup>11+</sup> 440 441**Atomic service API**: This API can be used in atomic services since API version 12. 442 443**System capability**: SystemCapability.ArkUI.ArkUI.Full 444 445| Name | Value| Description | 446| ---- | --- | ---------------------------------------- | 447| STANDARD | 0 | Standard mode. | 448| DIALOG | 1 | Dialog mode, where the navigation destination is transparent by default, and adding or removing the navigation destination from the navigation stack does not affect the lifecycle of the lower-layer navigation destinations.<br>System transition animations are supported since API version 13. | 449 450## NavigationSystemTransitionType<sup>14+</sup> 451 452**System capability**: SystemCapability.ArkUI.ArkUI.Full 453 454| Name | Value | Description| 455| ---- | --- | ----- | 456| DEFAULT | 0 | Default system transition animation.<br>**Atomic service API**: This API can be used in atomic services since API version 14.| 457| NONE| 1 | No system transition animation.<br>**Atomic service API**: This API can be used in atomic services since API version 14.| 458| TITLE | 2 | System transition animation of the title bar.<br>**Atomic service API**: This API can be used in atomic services since API version 14.| 459| CONTENT | 3 | System transition animation of the content area.<br>**Atomic service API**: This API can be used in atomic services since API version 14.| 460| FADE<sup>15+</sup> | 4 | Fade-type system transition animation.<br>**Atomic service API**: This API can be used in atomic services since API version 15.| 461| EXPLODE<sup>15+</sup> | 5 | Center-scale type system transition animation.<br>**Atomic service API**: This API can be used in atomic services since API version 15.| 462| SLIDE_RIGHT<sup>15+</sup> | 6 | Right-slide type system transition animation.<br>**Atomic service API**: This API can be used in atomic services since API version 15.| 463| SLIDE_BOTTOM<sup>15+</sup> | 7 | Bottom-slide type system transition animation.<br>**Atomic service API**: This API can be used in atomic services since API version 15.| 464 465**NOTE** 466> 467> System transition animations for the title bar and content area can be configured separately. 468> 469> The system transition animation of the title bar is only available for the push and pop animations of navigation destination pages in STANDARD mode, with the following constraints: 470> 1. When **NavigationSystemTransitionType** is set to **TITLE**, only the system transition animation of the title bar is displayed. 471> 2. When **NavigationSystemTransitionType** is set to **CONTENT**, only the system transition animation of the content area is displayed. 472> 473> When **NONE** or **TITLE** is set, no system transition animation is displayed. When **CONTENT** or **DEFAULT** is set, the system transition animation is displayed by default. 474 475## Events 476 477In addition to the [universal events](ts-component-general-events.md), the following events are supported. 478 479### onShown<sup>10+</sup> 480 481onShown(callback: () => void) 482 483Called when the navigation destination page is displayed. 484 485**Atomic service API**: This API can be used in atomic services since API version 11. 486 487**System capability**: SystemCapability.ArkUI.ArkUI.Full 488 489### onHidden<sup>10+</sup> 490 491onHidden(callback: () => void) 492 493Called when the navigation destination page is hidden. 494 495**Atomic service API**: This API can be used in atomic services since API version 11. 496 497**System capability**: SystemCapability.ArkUI.ArkUI.Full 498 499### onWillAppear<sup>12+</sup> 500 501onWillAppear(callback: Callback\<void>) 502 503Called when the navigation destination is about to be mounted. You can change the navigation stack in this callback function, and the change takes effect in the current frame. 504 505**Atomic service API**: This API can be used in atomic services since API version 12. 506 507**System capability**: SystemCapability.ArkUI.ArkUI.Full 508 509### onWillShow<sup>12+</sup> 510 511onWillShow(callback: Callback\<void>) 512 513Called when the navigation destination is about to be displayed. 514 515**Atomic service API**: This API can be used in atomic services since API version 12. 516 517**System capability**: SystemCapability.ArkUI.ArkUI.Full 518 519### onWillHide<sup>12+</sup> 520 521onWillHide(callback: Callback\<void>) 522 523Called when the navigation destination is about to be hidden. 524 525**Atomic service API**: This API can be used in atomic services since API version 12. 526 527**System capability**: SystemCapability.ArkUI.ArkUI.Full 528 529### onWillDisappear<sup>12+</sup> 530 531onWillDisappear(callback: Callback\<void>) 532 533Called when the navigation destination is about to be unmounted (or when the transition animation, if any, is about to start). 534 535**Atomic service API**: This API can be used in atomic services since API version 12. 536 537**System capability**: SystemCapability.ArkUI.ArkUI.Full 538 539### onBackPressed<sup>10+</sup> 540 541onBackPressed(callback: () => boolean) 542 543This callback takes effect when there is one or more entries in the navigation stack bound to the **Navigation** component. Called when the back button is pressed. 544 545The value **true** means that the back button logic is overridden, and **false** means that the previous page is displayed. 546 547**Atomic service API**: This API can be used in atomic services since API version 11. 548 549**System capability**: SystemCapability.ArkUI.ArkUI.Full 550 551### onReady<sup>11+</sup> 552 553onReady(callback: [Callback](../../apis-basic-services-kit/js-apis-base.md#callback)<[NavDestinationContext](#navdestinationcontext11)>) 554 555Called when the **NavDestination** component is about to build a child component. 556 557**Atomic service API**: This API can be used in atomic services since API version 11. 558 559**System capability**: SystemCapability.ArkUI.ArkUI.Full 560 561### onResult<sup>15+</sup> 562 563onResult(callback: Optional\<Callback\<ESObject\>\>) 564 565Triggered when the **NavDestination** component returns. 566 567**Atomic service API**: This API can be used in atomic services since API version 15. 568 569**System capability**: SystemCapability.ArkUI.ArkUI.Full 570 571**Parameters** 572| Name| Type| Mandatory| Description| 573| ------ | ------ | ---- | ---------------- | 574|callback | [Optional](./ts-universal-attributes-custom-property.md)\<[Callback](../../apis-basic-services-kit/js-apis-base.md#callback)\<ESObject\>\>| Yes| Callback for page returning, with the parameter being the **result** parameter passed to the **pop** API. If this parameter is not passed, the input is **undefined**.| 575 576### onActive<sup>18+</sup> 577 578onActive(callback: Optional\<Callback\<NavDestinationActiveReason\>\>) 579 580Triggered when the **NavDestination** component becomes active (on top of the stack and operable, with no special components blocking it). 581 582**Atomic service API**: This API can be used in atomic services since API version 18. 583 584**System capability**: SystemCapability.ArkUI.ArkUI.Full 585 586**Parameters** 587| Name| Type| Mandatory| Description| 588| ------ | ------ | ---- | ---------------- | 589|callback | [Optional](./ts-universal-attributes-custom-property.md#optional12)\<[Callback](../../apis-basic-services-kit/js-apis-base.md#callback)\<[NavDestinationActiveReason](#navdestinationactivereason18)\>\>| Yes| Reason why the **NavDestination** component switches from inactive to active.| 590 591### onInactive<sup>18+</sup> 592 593onInactive(callback: Optional\<Callback\<NavDestinationActiveReason\>\>) 594 595Triggered when **NavDestination** component becomes inactive (not on top of the stack and inoperable, or on top but blocked by special components). 596 597**Atomic service API**: This API can be used in atomic services since API version 18. 598 599**System capability**: SystemCapability.ArkUI.ArkUI.Full 600 601**Parameters** 602| Name| Type| Mandatory| Description| 603| ------ | ------ | ---- | ---------------- | 604|callback | [Optional](./ts-universal-attributes-custom-property.md#optional12)\<[Callback](../../apis-basic-services-kit/js-apis-base.md#callback)\<[NavDestinationActiveReason](#navdestinationactivereason18)\>\>| Yes| Reason why the **NavDestination** component switches from active to inactive.| 605 606### onNewParam<sup>18+</sup> 607 608onNewParam(callback: Optional\<Callback\<ESObject\>\>) 609 610Triggered when a **NavDestination** page that already exists in the stack is moved to the top using [launchMode.MOVE_TO_TOP_SINGLETON](./ts-basic-components-navigation.md#launchmode12) or [launchMode.POP_TO_SINGLETON](./ts-basic-components-navigation.md#launchmode12). 611 612**Atomic service API**: This API can be used in atomic services since API version 18. 613 614**System capability**: SystemCapability.ArkUI.ArkUI.Full 615 616**Parameters** 617| Name| Type| Mandatory| Description| 618| ------ | ------ | ---- | ---------------- | 619|callback | [Optional](./ts-universal-attributes-custom-property.md#optional12)\<[Callback](../../apis-basic-services-kit/js-apis-base.md#callback)\<ESObject\>\>| Yes| Callback triggered by **onNewParam**, with the parameter being the data passed to the target page during navigation.| 620 621> **NOTE** 622> 623> This callback is not triggered by [replacePath](./ts-basic-components-navigation.md#replacepath11) or [replaceDestination](./ts-basic-components-navigation.md#replacedestination18). 624 625## NavDestinationCommonTitle 626 627**Atomic service API**: This API can be used in atomic services since API version 11. 628 629**System capability**: SystemCapability.ArkUI.ArkUI.Full 630 631| Name | Type | Mandatory | Description | 632| ---- | ------ | ---- | ------ | 633| main | string \| [Resource<sup>14+<sup>](ts-types.md#resource) | Yes | Main title.| 634| sub | string \| [Resource<sup>14+<sup>](ts-types.md#resource) | Yes | Subtitle.| 635 636## NavDestinationCustomTitle 637 638**Atomic service API**: This API can be used in atomic services since API version 11. 639 640**System capability**: SystemCapability.ArkUI.ArkUI.Full 641 642| Name | Type | Mandatory | Description | 643| ------- | ---------------------------------------- | ---- | -------- | 644| builder | [CustomBuilder](ts-types.md#custombuilder8) | Yes | Content of the title bar.| 645| height | [TitleHeight](ts-appendix-enums.md#titleheight9) \| [Length](ts-types.md#length) | Yes | Height of the title bar.<br>Value range: [0, +∞)| 646 647## NavDestinationContext<sup>11+</sup> 648 649**System capability**: SystemCapability.ArkUI.ArkUI.Full 650 651| Name | Type | Mandatory | Description | 652| ---- | ------ | ----- | ------ | 653| pathInfo | [NavPathInfo](ts-basic-components-navigation.md#navpathinfo10) | Yes| Path information of the navigation destination page.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 654| pathStack | [NavPathStack](ts-basic-components-navigation.md#navpathstack10) | Yes| Page stack where the current navigation destination page is located.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 655| navDestinationId<sup>12+</sup> | string | No| Unique ID of the current navigation destination page, which is automatically generated by the system and is irrelevant to the universal attribute **id** of the component.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 656 657### getConfigInRouteMap<sup>12+</sup> 658 659getConfigInRouteMap(): RouteMapConfig |undefined 660 661**Atomic service API**: This API can be used in atomic services since API version 12. 662 663**System capability**: SystemCapability.ArkUI.ArkUI.Full 664 665**Return value** 666 667| Type| Description| 668| --- | --- | 669| [RouteMapConfig](#routemapconfig12) | Route map configuration of the current page.| 670| undefined | **undefined**, returned when the page is not configured through the route table.| 671 672## RouteMapConfig<sup>12+</sup> 673 674**Atomic service API**: This API can be used in atomic services since API version 12. 675 676**System capability**: SystemCapability.ArkUI.ArkUI.Full 677 678| Name | Type |Mandatory| Description| 679| ---- | --- | ---- |----- | 680| name | string | Yes| Page name.| 681| pageSourceFile| string | Yes| Path of the page in the current package.| 682| data | Object | Yes| Custom data of the page.| 683 684## NestedScrollInfo<sup>14+</sup> 685 686Provides the information about the nested scrollable containers. 687 688**Atomic service API**: This API can be used in atomic services since API version 14. 689 690**System capability**: SystemCapability.ArkUI.ArkUI.Full 691 692| Name | Type |Mandatory| Description| 693| ---- | --- | ---- |----- | 694| parent | [Scroller](./ts-container-scroll.md#scroller) | Yes| Controller of the target scrollable container.| 695| child | [Scroller](./ts-container-scroll.md#scroller) | Yes| Controller of the scrollable container nested within the target scrollable container. This scrollable container is a child component of the target scrollable container.| 696 697### NavDestinationActiveReason<sup>18+</sup> 698 699Enumerates the reasons why the activation state of the **NavDestination** component changes. 700 701**Atomic service API**: This API can be used in atomic services since API version 18. 702 703**System capability**: SystemCapability.ArkUI.ArkUI.Full 704 705| Name | Value| Description | 706| ---- | -- | ---------------------------------------- | 707| TRANSITION | 0 | The activation state changes through page navigation. | 708| CONTENT_COVER | 1 | The activation state changes due to the opening or closing of a modal page. | 709| SHEET | 2 | The activation state changes due to the opening or closing of a sheet.| 710| DIALOG | 3 | The activation state changes due to the opening or closing of a custom dialog box.| 711| OVERLAY | 4 | The activation state changes due to the opening or closing of an overlay using **OverlayManager**.| 712| APP_STATE | 5 | The activation state changes due to switching between foreground and background states of the application.| 713 714## NavDestinationTransition<sup>15+</sup> 715 716Defines a custom transition animation for the **NavDestination** component. 717 718**Atomic service API**: This API can be used in atomic services since API version 15. 719 720**System capability**: SystemCapability.ArkUI.ArkUI.Full 721 722| Name | Type |Mandatory| Description| 723| ---- | --- | ---- |----- | 724| onTransitionEnd | Callback\<void> | No| Callback triggered when the transition animation ends.| 725| duration | number | No| Duration of the transition animation.<br>Default value: **1000** (in milliseconds)| 726| curve | [Curve](ts-appendix-enums.md#curve) | No| Curve type of the animation.<br>Default value: Curve.EaseInOut](ts-appendix-enums.md#curve)| 727| delay | number | No| Delay of the transition animation. <br>Default value: **0** (in milliseconds)| 728| event | Callback\<void> | Yes| Closure function specifying the transition animation. The system generates the corresponding transition animation based on the modifications to the component's UI state within the closure. For details, see **event** in [animateTo](../js-apis-arkui-UIContext.md#animateto).| 729 730## NavDestinationTransitionDelegate<sup>15+</sup> 731 732type NavDestinationTransitionDelegate = (operation: NavigationOperation, isEnter: boolean) => Array\<NavDestinationTransition> | undefined 733 734Defines the delegate function for custom transition animations of the **NavDestination** component. 735 736**Atomic service API**: This API can be used in atomic services since API version 15. 737 738**System capability**: SystemCapability.ArkUI.ArkUI.Full 739 740**Parameters** 741 742| Name | Type | Mandatory| Description | 743|------|--------|----|-----------------------| 744| operation | [NavigationOperation](ts-basic-components-navigation.md#navigationoperation11) | Yes | Type of navigation operation for the current page transition.| 745| isEnter | boolean | Yes | Whether the current page is an entry page.<br>**true**: The current page is an entry page.<br>**false**: The current page is not an entry page.| 746 747**Return value** 748 749| Type | Description | 750|---------|-----------| 751| Array<[NavDestinationTransition](#navdestinationtransition15)> \| undefined | Array of custom animations for the **NavDestination** page. If **undefined** is returned, the default system animation is used.| 752 753## Example 754 755### Example 1: Linking the Title Bar and Toolbar with Scrollable Components 756 757This example shows how to bind a **NavDestination** component to scrollable containers so that scrolling in the scrollable containers triggers the animations for showing or hiding the title bar and toolbar of the **NavDestination** component. 758 759```ts 760import { SymbolGlyphModifier } from '@kit.ArkUI'; 761 762@Component 763struct MyPageOne { 764 private listScroller: Scroller = new Scroller(); 765 private scrollScroller: Scroller = new Scroller(); 766 private arr: number[] = []; 767 768 aboutToAppear(): void { 769 for (let i = 0; i < 30; i++) { 770 this.arr.push(i); 771 } 772 } 773 774 build() { 775 NavDestination() { 776 Scroll(this.scrollScroller) { 777 Column() { 778 List({ space: 0, initialIndex: 0, scroller: this.listScroller }) { 779 ForEach(this.arr, (item: number, index: number) => { 780 ListItem() { 781 Text('' + item) 782 .height(100) 783 .fontSize(16) 784 .textAlign(TextAlign.Center) 785 .width('90%') 786 .margin({ left: '5%' }) 787 .borderRadius(10) 788 .backgroundColor(Color.Gray) 789 } 790 }, (item: string) => item); 791 }.width('100%').height('80%').scrollBar(BarState.Off) 792 .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.SELF_FIRST }) 793 794 ForEach(this.arr, (item: number, index: number) => { 795 ListItem() { 796 Text('' + item) 797 .height(100) 798 .fontSize(16) 799 .textAlign(TextAlign.Center) 800 .width('90%') 801 .margin({ top: '5%' }) 802 .borderRadius(10) 803 .backgroundColor(Color.Pink) 804 } 805 }, (item: string) => item); 806 } 807 } 808 .width('100%') 809 .scrollBar(BarState.Off) 810 .scrollable(ScrollDirection.Vertical) 811 .edgeEffect(EdgeEffect.Spring) 812 } 813 .title('PageOne', { backgroundColor: Color.Yellow, barStyle: BarStyle.STACK }) 814 .toolbarConfiguration([ 815 { 816 value: 'item1', 817 symbolIcon: new SymbolGlyphModifier($r('sys.symbol.phone_badge_star')) 818 } 819 ], { backgroundColor: Color.Orange, barStyle: BarStyle.STACK }) 820 // Bind the NavDestination component to nested scrollable containers. 821 .bindToNestedScrollable([{ parent: this.scrollScroller, child: this.listScroller }]) 822 } 823} 824 825@Component 826struct MyPageTwo { 827 private listScroller: Scroller = new Scroller(); 828 private arr: number[] = []; 829 830 aboutToAppear(): void { 831 for (let i = 0; i < 30; i++) { 832 this.arr.push(i); 833 } 834 } 835 836 build() { 837 NavDestination() { 838 List({ scroller: this.listScroller }) { 839 ForEach(this.arr, (item: number, index: number) => { 840 ListItem() { 841 Text('' + item) 842 .height(100) 843 .fontSize(16) 844 .textAlign(TextAlign.Center) 845 .width('90%') 846 .margin({ left: '5%' }) 847 .borderRadius(10) 848 .backgroundColor(Color.Gray) 849 } 850 }, (item: string) => item); 851 }.width('100%') 852 } 853 .title('PageTwo', { backgroundColor: Color.Yellow, barStyle: BarStyle.STACK }) 854 .toolbarConfiguration([ 855 { 856 value: 'item1', 857 symbolIcon: new SymbolGlyphModifier($r('sys.symbol.phone_badge_star')) 858 } 859 ], { backgroundColor: Color.Orange, barStyle: BarStyle.STACK }) 860 // Bind the NavDestination component to a scrollable container. 861 .bindToScrollable([this.listScroller]) 862 } 863} 864 865@Entry 866@Component 867struct Index { 868 private stack: NavPathStack = new NavPathStack(); 869 870 @Builder 871 MyPageMap(name: string) { 872 if (name === 'myPageOne') { 873 MyPageOne() 874 } else { 875 MyPageTwo() 876 } 877 } 878 879 build() { 880 Navigation(this.stack) { 881 Column() { 882 Button('push PageOne').onClick(() => { 883 this.stack.pushPath({ name: 'myPageOne' }) 884 }) 885 Button('push PageTwo').onClick(() => { 886 this.stack.pushPath({ name: 'myPageTwo' }) 887 }) 888 }.height('40%').justifyContent(FlexAlign.SpaceAround) 889 }.width('100%') 890 .height('100%') 891 .title({ main: 'MainTitle', sub: 'subTitle' }) 892 .navDestination(this.MyPageMap) 893 } 894} 895``` 896 897 898### Example 2: Setting a Custom Transitions for the NavDestination Component 899 900The following example demonstrates how to set a custom transition animation for the **NavDestination** component using [customTransition](#customtransition15). 901 902```ts 903@Entry 904@Component 905struct NavDestinationCustomTransition { 906 stack: NavPathStack = new NavPathStack() 907 908 @Builder 909 pageMap(name: string) { 910 if (name) { 911 NavDest() 912 } 913 } 914 915 aboutToAppear(): void { 916 this.stack.pushPath({name: 'dest0'}) 917 } 918 919 build() { 920 Navigation(this.stack) { 921 // empty 922 } 923 .navDestination(this.pageMap) 924 .hideNavBar(true) 925 .title('Main Page') 926 .titleMode(NavigationTitleMode.Mini) 927 } 928} 929 930declare type voidFunc = () => void; 931 932@Component 933struct NavDest { 934 @State name: string = 'NA' 935 @State destWidth: string = '100%' 936 stack: NavPathStack = new NavPathStack() 937 @State y: string = '0'; 938 939 build() { 940 NavDestination() { 941 Column() { 942 Button('push next page', { stateEffect: true, type: ButtonType.Capsule }) 943 .width('80%') 944 .height(40) 945 .margin(20) 946 .onClick(() => { 947 this.stack.pushPath({ name: this.name == 'PageOne' ? "PageTwo" : "PageOne" }) 948 }) 949 } 950 .size({ width: '100%', height: '100%' }) 951 } 952 .title(this.name) 953 .translate({ y: this.y }) 954 .onReady((context) => { 955 this.name = context.pathInfo.name; 956 this.stack = context.pathStack; 957 }) 958 .backgroundColor(this.name == 'PageOne' ? '#F1F3F5' : '#ff11dee5') 959 .customTransition( 960 (op: NavigationOperation, isEnter: boolean) 961 : Array<NavDestinationTransition> | undefined => { 962 console.log('[NavDestinationTransition]', 'reached delegate in frontend, op: ' + op + ', isEnter: ' + isEnter); 963 964 let transitionOneEvent: voidFunc = () => { console.log('[NavDestinationTransition]', 'reached transitionOne, empty now!'); } 965 let transitionOneFinishEvent: voidFunc = () => { console.log('[NavDestinationTransition]', 'reached transitionOneFinish, empty now!'); } 966 let transitionOneDuration: number = 500; 967 if (op === NavigationOperation.PUSH) { 968 if (isEnter) { 969 // ENTER_PUSH 970 this.y = '100%'; 971 transitionOneEvent = () => { 972 console.log('[NavDestinationTransition]', 'transitionOne, push & isEnter'); 973 this.y = '0'; 974 } 975 } else { 976 // EXIT_PUSH 977 this.y = '0'; 978 transitionOneEvent = () => { 979 console.log('[NavDestinationTransition]', 'transitionOne, push & !isEnter'); 980 this.y = '0'; 981 } 982 transitionOneDuration = 450 983 } 984 } else if (op === NavigationOperation.POP) { 985 if (isEnter) { 986 // ENTER_POP 987 this.y = '0'; 988 transitionOneEvent = () => { 989 console.log('[NavDestinationTransition]', 'transitionOne, pop & isEnter'); 990 this.y = '0'; 991 } 992 } else { 993 // EXIT_POP 994 this.y = '0'; 995 transitionOneEvent = () => { 996 console.log('[NavDestinationTransition]', 'transitionOne, pop & !isEnter'); 997 this.y = '100%'; 998 } 999 } 1000 } else { 1001 console.log('[NavDestinationTransition]', '----- NOT-IMPL BRANCH of NAV-DESTINATION CUSTOM TRANSITION -----'); 1002 } 1003 1004 let transitionOne: NavDestinationTransition = { 1005 duration: transitionOneDuration, 1006 delay: 0, 1007 curve: Curve.Friction, 1008 event: transitionOneEvent, 1009 onTransitionEnd: transitionOneFinishEvent 1010 }; 1011 1012 let transitionTwoEvent: voidFunc = () => { console.log('[NavDestinationTransition]', 'reached transitionTwo, empty now!'); } 1013 let transitionTwo: NavDestinationTransition = { 1014 duration: 1000, 1015 delay: 0, 1016 curve: Curve.EaseInOut, 1017 event: transitionTwoEvent, 1018 onTransitionEnd: () => { console.log('[NavDestinationTransition]', 'reached Two\'s finish'); } 1019 }; 1020 1021 return [ 1022 transitionOne, 1023 transitionTwo, 1024 ]; 1025 }) 1026 } 1027} 1028``` 1029 1030 1031### Example 3: Setting System Transition Animations for the NavDestination Component 1032 1033The following example demonstrates how to set system transition animations using [systemTransition](#systemtransition14) with **Fade**, **Explode**, **SlideBottom**, and **SlideRight** effects. 1034 1035```ts 1036@Entry 1037@Component 1038struct NavDestinationSystemTransition { 1039 @Provide stack: NavPathStack = new NavPathStack() 1040 @Provide homePageTransitionType: NavigationSystemTransitionType = NavigationSystemTransitionType.DEFAULT; 1041 1042 @Builder 1043 pageMap(name: string) { 1044 if (name === 'Fade') { 1045 Fade() 1046 } else if (name === 'Explode') { 1047 Explode() 1048 } else if (name === 'SlideRight') { 1049 SlideRight() 1050 } else if (name === 'SlideBottom') { 1051 SlideBottom() 1052 } else { 1053 Dest() 1054 } 1055 } 1056 1057 aboutToAppear(): void { 1058 this.stack.pushPath({name: 'Dest'}) 1059 } 1060 1061 build() { 1062 Navigation(this.stack) { 1063 // empty 1064 } 1065 .navDestination(this.pageMap) 1066 .hideNavBar(true) 1067 } 1068} 1069 1070@Component 1071struct Dest { 1072 @Consume stack: NavPathStack; 1073 @Consume homePageTransitionType: NavigationSystemTransitionType; 1074 @State name: string = 'NA'; 1075 1076 build() { 1077 NavDestination() { 1078 HomeBody() 1079 } 1080 .title('Navigation System Animation') 1081 .onReady((context) => { 1082 this.name = context.pathInfo.name 1083 }) 1084 .systemTransition(this.homePageTransitionType) 1085 } 1086} 1087 1088@Component 1089struct Fade { 1090 @Consume stack: NavPathStack; 1091 @State name: string = 'NA'; 1092 1093 build() { 1094 NavDestination() { 1095 DestBody({ 1096 name: this.name 1097 }) 1098 } 1099 .title(this.name) 1100 .onReady((context) => { 1101 this.name = context.pathInfo.name 1102 }) 1103 .systemTransition(NavigationSystemTransitionType.FADE) 1104 } 1105} 1106 1107@Component 1108struct Explode { 1109 @Consume stack: NavPathStack; 1110 @State name: string = 'NA'; 1111 1112 build() { 1113 NavDestination() { 1114 DestBody({ 1115 name: this.name 1116 }) 1117 } 1118 .title(this.name) 1119 .onReady((context) => { 1120 this.name = context.pathInfo.name 1121 }) 1122 .systemTransition(NavigationSystemTransitionType.EXPLODE) 1123 } 1124} 1125 1126@Component 1127struct SlideRight { 1128 @Consume stack: NavPathStack; 1129 @State name: string = 'NA'; 1130 1131 build() { 1132 NavDestination() { 1133 DestBody({ 1134 name: this.name 1135 }) 1136 } 1137 .title(this.name) 1138 .onReady((context) => { 1139 this.name = context.pathInfo.name 1140 }) 1141 .systemTransition(NavigationSystemTransitionType.SLIDE_RIGHT) 1142 } 1143} 1144 1145@Component 1146struct SlideBottom { 1147 @Consume stack: NavPathStack; 1148 @State name: string = 'NA'; 1149 1150 build() { 1151 NavDestination() { 1152 DestBody({ 1153 name: this.name 1154 }) 1155 } 1156 .title(this.name) 1157 .onReady((context) => { 1158 this.name = context.pathInfo.name 1159 }) 1160 .systemTransition(NavigationSystemTransitionType.SLIDE_BOTTOM) 1161 } 1162} 1163 1164@Component 1165struct DestBody { 1166 name: string = 'NA' 1167 1168 columnTextSize: number = 22 1169 columnTextFontWeight: FontWeight = FontWeight.Bolder 1170 columnWidth: string = '65%' 1171 columnPadding: number = 22 1172 columnMargin: number = 10 1173 columnBorderRadius: number = 10 1174 1175 build() { 1176 Column() { 1177 Column() 1178 .width('85') 1179 .height(50) 1180 .backgroundColor(Color.White) 1181 Column() { 1182 Text(this.name) 1183 .fontSize(this.columnTextSize) 1184 .fontWeight(this.columnTextFontWeight) 1185 } 1186 .width(this.columnWidth) 1187 .padding(this.columnPadding) 1188 .margin(this.columnMargin) 1189 .borderRadius(this.columnBorderRadius) 1190 .shadow(ShadowStyle.OUTER_DEFAULT_LG) 1191 } 1192 } 1193} 1194 1195@Component 1196struct HomeBody { 1197 @Consume stack: NavPathStack; 1198 @Consume homePageTransitionType: NavigationSystemTransitionType; 1199 1200 columnTextSize: number = 22 1201 columnTextFontWeight: FontWeight = FontWeight.Bolder 1202 columnWidth: string = '85%' 1203 columnPadding: number = 22 1204 columnMargin: number = 10 1205 columnBorderRadius: number = 10 1206 columnShadow: ShadowStyle = ShadowStyle.OUTER_DEFAULT_MD 1207 1208 build() { 1209 Column() { 1210 Search({ value: 'Search' }) 1211 .width(this.columnWidth) 1212 1213 Column() { 1214 Text('fade') 1215 .fontSize(this.columnTextSize) 1216 .fontWeight(this.columnTextFontWeight) 1217 } 1218 .width(this.columnWidth) 1219 .padding(this.columnPadding) 1220 .margin(this.columnMargin) 1221 .borderRadius(this.columnBorderRadius) 1222 .shadow(this.columnShadow) 1223 .onClick(() => { 1224 this.homePageTransitionType = NavigationSystemTransitionType.FADE 1225 this.stack.pushPath({name: 'Fade'}) 1226 }) 1227 1228 Column() { 1229 Text('explode') 1230 .fontSize(this.columnTextSize) 1231 .fontWeight(this.columnTextFontWeight) 1232 } 1233 .width(this.columnWidth) 1234 .padding(this.columnPadding) 1235 .margin(this.columnMargin) 1236 .borderRadius(this.columnBorderRadius) 1237 .shadow(this.columnShadow) 1238 .onClick(() => { 1239 this.homePageTransitionType = NavigationSystemTransitionType.EXPLODE 1240 this.stack.pushPath({name: 'Explode'}) 1241 }) 1242 1243 Column() { 1244 Text('slide right') 1245 .fontSize(this.columnTextSize) 1246 .fontWeight(this.columnTextFontWeight) 1247 } 1248 .width(this.columnWidth) 1249 .padding(this.columnPadding) 1250 .margin(this.columnMargin) 1251 .borderRadius(this.columnBorderRadius) 1252 .shadow(this.columnShadow) 1253 .onClick(() => { 1254 this.homePageTransitionType = NavigationSystemTransitionType.SLIDE_RIGHT 1255 this.stack.pushPath({name: 'SlideRight'}) 1256 }) 1257 1258 Column() { 1259 Text('slide bottom') 1260 .fontSize(this.columnTextSize) 1261 .fontWeight(this.columnTextFontWeight) 1262 } 1263 .width(this.columnWidth) 1264 .padding(this.columnPadding) 1265 .margin(this.columnMargin) 1266 .borderRadius(this.columnBorderRadius) 1267 .shadow(this.columnShadow) 1268 .onClick(() => { 1269 this.homePageTransitionType = NavigationSystemTransitionType.SLIDE_BOTTOM 1270 this.stack.pushPath({name: 'SlideBottom'}) 1271 }) 1272 } 1273 } 1274} 1275``` 1276 1277 1278 1279 1280 1281### Example 4: Configuring Display Orientation and Status Bar and Navigation Bar Visibility 1282 1283This example demonstrates how to configure each **NavDestination** component with specific display orientations and control the visibility of the status bar and navigation bar. 1284 1285```ts 1286import { window } from '@kit.ArkUI'; 1287 1288@Component 1289struct PortraitPage { 1290 private stack: NavPathStack | undefined = undefined; 1291 build() { 1292 NavDestination() { 1293 Stack({alignContent: Alignment.Center}) { 1294 Button('push LANDSCAPE page').onClick(() => { 1295 this.stack?.pushPath({name: 'landscape'}) 1296 }) 1297 }.width('100%').height('100%') 1298 } 1299 .width('100%').height('100%') 1300 .title('PortraitPage') 1301 .preferredOrientation(window.Orientation.PORTRAIT) // Portrait orientation. 1302 .enableStatusBar (true) // Show the status bar. 1303 .enableNavigationIndicator(true) // Show the navigation bar. 1304 .backgroundColor('#ffbaece9') 1305 .onReady((ctx: NavDestinationContext) => { 1306 this.stack = ctx.pathStack; 1307 }) 1308 } 1309} 1310 1311@Component 1312struct LandscapePage { 1313 private stack: NavPathStack | undefined = undefined; 1314 build() { 1315 NavDestination() { 1316 Stack({alignContent: Alignment.Center}) { 1317 Button('push PORTRAIT page').onClick(() => { 1318 this.stack?.pushPath({name: 'portrait'}) 1319 }) 1320 }.width('100%').height('100%') 1321 } 1322 .width('100%').height('100%') 1323 .title('LandscapePage') 1324 .preferredOrientation(window.Orientation.LANDSCAPE) // Landscape orientation. 1325 .enableStatusBar(false) // Hide the status bar. 1326 .enableNavigationIndicator(false) // Hide the navigation bar. 1327 .backgroundColor('#ffecb8b8') 1328 .ignoreLayoutSafeArea([LayoutSafeAreaType.SYSTEM], [LayoutSafeAreaEdge.TOP, LayoutSafeAreaEdge.BOTTOM]) 1329 .onReady((ctx: NavDestinationContext) => { 1330 this.stack = ctx.pathStack; 1331 }) 1332 } 1333} 1334 1335@Entry 1336@Component 1337struct ExamplePage { 1338 private stack: NavPathStack = new NavPathStack(); 1339 1340 aboutToAppear(): void { 1341 this.stack.pushPath({name: "portrait"}) 1342 } 1343 1344 @Builder 1345 MyPageMap(name: string) { 1346 if (name === 'portrait') { 1347 PortraitPage() 1348 } else { 1349 LandscapePage() 1350 } 1351 } 1352 1353 build() { 1354 Navigation(this.stack) { 1355 } 1356 .width('100%') 1357 .height('100%') 1358 .hideNavBar(true) 1359 .navDestination(this.MyPageMap) 1360 } 1361} 1362``` 1363 1364 1365For more usage of the **NavDestination** component, see [Example in Navigation](ts-basic-components-navigation.md#example). 1366