1e41f4b71Sopenharmony_ci# ComposeTitleBar 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ciA one- or two-row title bar with profile picture is a common title bar that contains a title, subtitle (optional), and profile picture (optional). It can come with a Back button for switching between pages of different levels. 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ci> **NOTE** 8e41f4b71Sopenharmony_ci> 9e41f4b71Sopenharmony_ci> This component is supported since API version 10. Updates will be marked with a superscript to indicate their earliest API version. 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci## Modules to Import 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci``` 15e41f4b71Sopenharmony_ciimport { ComposeTitleBar } from '@kit.ArkUI' 16e41f4b71Sopenharmony_ci``` 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci## Child Components 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ciNot supported 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci## Attributes 24e41f4b71Sopenharmony_ciThe [universal attributes](ts-universal-attributes-size.md) are not supported. 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci## ComposeTitleBar 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ciComposeTitleBar({item?: ComposeTitleBarMenuItem, title: ResourceStr, subtitle?: ResourceStr, menuItems?: Array<ComposeTitleBarMenuItem>}) 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci**Decorator**: @Component 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci**Parameters** 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 40e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 41e41f4b71Sopenharmony_ci| item | [ComposeTitleBarMenuItem](#composetitlebarmenuitem) | No| A single menu item for the profile picture on the left.| 42e41f4b71Sopenharmony_ci| title | [ResourceStr](ts-types.md#resourcestr) | Yes| Title.| 43e41f4b71Sopenharmony_ci| subtitle | [ResourceStr](ts-types.md#resourcestr) | No| Subtitle.| 44e41f4b71Sopenharmony_ci| menuItems | Array<[ComposeTitleBarMenuItem](#composetitlebarmenuitem)> | No| List of menu items on the right.| 45e41f4b71Sopenharmony_ci 46e41f4b71Sopenharmony_ci## ComposeTitleBarMenuItem 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 49e41f4b71Sopenharmony_ci 50e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 51e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 52e41f4b71Sopenharmony_ci| value | [ResourceStr](ts-types.md#resourcestr) | Yes| Icon resource.| 53e41f4b71Sopenharmony_ci| label<sup>13+</sup> | [ResourceStr](ts-types.md#resourcestr) | No| Icon label.| 54e41f4b71Sopenharmony_ci| isEnabled | boolean | No| Whether to enable the item.<br>Default value: **false**<br> **true**: The item is enabled.<br> **false**: The item is disabled.| 55e41f4b71Sopenharmony_ci| action | () => void | No| Action to perform. This parameter is not available for the item attribute.| 56e41f4b71Sopenharmony_ci 57e41f4b71Sopenharmony_ci## Events 58e41f4b71Sopenharmony_ciThe [universal events](ts-universal-events-click.md) are not supported. 59e41f4b71Sopenharmony_ci 60e41f4b71Sopenharmony_ci## Example 61e41f4b71Sopenharmony_ci 62e41f4b71Sopenharmony_ci```ts 63e41f4b71Sopenharmony_ciimport { ComposeTitleBar, promptAction, ComposeTitleBarMenuItem } from '@kit.ArkUI' 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ci@Entry 66e41f4b71Sopenharmony_ci@Component 67e41f4b71Sopenharmony_cistruct Index { 68e41f4b71Sopenharmony_ci private menuItems: Array<ComposeTitleBarMenuItem> = [ 69e41f4b71Sopenharmony_ci { 70e41f4b71Sopenharmony_ci value: $r('app.media.ic_public_save'), 71e41f4b71Sopenharmony_ci isEnabled: true, 72e41f4b71Sopenharmony_ci action: () => promptAction.showToast({ message: "show toast index 1" }) 73e41f4b71Sopenharmony_ci }, 74e41f4b71Sopenharmony_ci { 75e41f4b71Sopenharmony_ci value: $r('app.media.ic_public_save'), 76e41f4b71Sopenharmony_ci isEnabled: true, 77e41f4b71Sopenharmony_ci action: () => promptAction.showToast({ message: "show toast index 1" }) 78e41f4b71Sopenharmony_ci }, 79e41f4b71Sopenharmony_ci { 80e41f4b71Sopenharmony_ci value: $r('app.media.ic_public_save'), 81e41f4b71Sopenharmony_ci isEnabled: true, 82e41f4b71Sopenharmony_ci action: () => promptAction.showToast({ message: "show toast index 1" }) 83e41f4b71Sopenharmony_ci }, 84e41f4b71Sopenharmony_ci { 85e41f4b71Sopenharmony_ci value: $r('app.media.ic_public_save'), 86e41f4b71Sopenharmony_ci isEnabled: true, 87e41f4b71Sopenharmony_ci action: () => promptAction.showToast({ message: "show toast index 1" }) 88e41f4b71Sopenharmony_ci }, 89e41f4b71Sopenharmony_ci ] 90e41f4b71Sopenharmony_ci 91e41f4b71Sopenharmony_ci build() { 92e41f4b71Sopenharmony_ci Row() { 93e41f4b71Sopenharmony_ci Column() { 94e41f4b71Sopenharmony_ci Divider().height(2).color(0xCCCCCC) 95e41f4b71Sopenharmony_ci ComposeTitleBar({ 96e41f4b71Sopenharmony_ci title: "Title", 97e41f4b71Sopenharmony_ci subtitle: "Subtitle", 98e41f4b71Sopenharmony_ci menuItems: this.menuItems.slice(0, 1), 99e41f4b71Sopenharmony_ci }) 100e41f4b71Sopenharmony_ci Divider().height(2).color(0xCCCCCC) 101e41f4b71Sopenharmony_ci ComposeTitleBar({ 102e41f4b71Sopenharmony_ci title: "Title", 103e41f4b71Sopenharmony_ci subtitle: "Subtitle", 104e41f4b71Sopenharmony_ci menuItems: this.menuItems.slice(0, 2), 105e41f4b71Sopenharmony_ci }) 106e41f4b71Sopenharmony_ci Divider().height(2).color(0xCCCCCC) 107e41f4b71Sopenharmony_ci ComposeTitleBar({ 108e41f4b71Sopenharmony_ci title: "Title", 109e41f4b71Sopenharmony_ci subtitle: "Subtitle", 110e41f4b71Sopenharmony_ci menuItems: this.menuItems, 111e41f4b71Sopenharmony_ci }) 112e41f4b71Sopenharmony_ci Divider().height(2).color(0xCCCCCC) 113e41f4b71Sopenharmony_ci ComposeTitleBar({ 114e41f4b71Sopenharmony_ci menuItems: [{ isEnabled: true, value: $r('app.media.ic_public_save'), 115e41f4b71Sopenharmony_ci action: () => promptAction.showToast({ message: "show toast index 1" }) 116e41f4b71Sopenharmony_ci }], 117e41f4b71Sopenharmony_ci title: "Title", 118e41f4b71Sopenharmony_ci subtitle: "Subtitle", 119e41f4b71Sopenharmony_ci item: { isEnabled: true, value: $r('app.media.app_icon') } 120e41f4b71Sopenharmony_ci }) 121e41f4b71Sopenharmony_ci Divider().height(2).color(0xCCCCCC) 122e41f4b71Sopenharmony_ci } 123e41f4b71Sopenharmony_ci }.height('100%') 124e41f4b71Sopenharmony_ci } 125e41f4b71Sopenharmony_ci} 126e41f4b71Sopenharmony_ci``` 127e41f4b71Sopenharmony_ci 128e41f4b71Sopenharmony_ci 129