1e41f4b71Sopenharmony_ci# SelectTitleBar
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ciThe drop-down title bar is a title bar that contains a drop-down menu for switching between pages of different levels (configured with the Back button).
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 { SelectTitleBar } 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## SelectTitleBar
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ciSelectTitleBar({selected: number, options: Array<SelectOption>, menuItems?: Array<SelectTitleBarMenuItem>, subtitle?: ResourceStr, badgeValue?: number, hidesBackButton?: boolean, onSelected?: (index: number) => void})
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci**Decorator**: @Component
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci**Parameters**
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Decorator| Description|
39e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
40e41f4b71Sopenharmony_ci| selected | number | Yes| \@Prop | Index of the currently selected option.<br>The index of the first option is 0. If this attribute is not set, the default value **-1** will be used.|
41e41f4b71Sopenharmony_ci| options | Array&lt;[SelectOption](ts-basic-components-select.md#selectoption)&gt; | Yes| - | Options in the drop-down menu.|
42e41f4b71Sopenharmony_ci| menuItems | Array&lt;[SelectTitleBarMenuItem](#selecttitlebarmenuitem)&gt;              | No| - | List of menu items on the right of the title bar.|
43e41f4b71Sopenharmony_ci| subtitle | [ResourceStr](ts-types.md#resourcestr)                                      | No| - | Subtitle.|
44e41f4b71Sopenharmony_ci| badgeValue | number                                                                      | No| - | Badge.|
45e41f4b71Sopenharmony_ci| hidesBackButton | boolean                                                                     | No| - | Whether to hide the back arrow on the left.<br>Default value: **false** The value **true** means to hide the provider, and **false** means the opposite.|
46e41f4b71Sopenharmony_ci| onSelected | (index: number) =&gt; void                                   | No| - | Callback invoked when an option in the drop-down menu is selected. The index of the selected option is passed in.|
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci## SelectTitleBarMenuItem
49e41f4b71Sopenharmony_ci
50e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
51e41f4b71Sopenharmony_ci
52e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description|
53e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- |
54e41f4b71Sopenharmony_ci| value | [ResourceStr](ts-types.md#resourcestr) | Yes| Icon resource.|
55e41f4b71Sopenharmony_ci| label<sup>13+</sup> | [ResourceStr](ts-types.md#resourcestr) | No| Icon label.|
56e41f4b71Sopenharmony_ci| isEnabled | boolean | No| Whether to enable the item.<br>Default value: **false**<br> The value **true** means to enable the item, and **false** means the opposite.|
57e41f4b71Sopenharmony_ci| action | () =&gt; void | No| Action to perform.|
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci## Events
60e41f4b71Sopenharmony_ciThe [universal events](ts-universal-events-click.md) are not supported.
61e41f4b71Sopenharmony_ci
62e41f4b71Sopenharmony_ci## Example
63e41f4b71Sopenharmony_ci
64e41f4b71Sopenharmony_ci```ts
65e41f4b71Sopenharmony_ciimport { SelectTitleBar, promptAction } from '@kit.ArkUI'
66e41f4b71Sopenharmony_ci
67e41f4b71Sopenharmony_ciinterface menuItems {
68e41f4b71Sopenharmony_ci  value: Resource;
69e41f4b71Sopenharmony_ci  isEnabled?: boolean;
70e41f4b71Sopenharmony_ci  action?: () => void
71e41f4b71Sopenharmony_ci}  
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ci@Entry
74e41f4b71Sopenharmony_ci@Component
75e41f4b71Sopenharmony_cistruct Index {
76e41f4b71Sopenharmony_ci  private  menuItems:Array<menuItems> =
77e41f4b71Sopenharmony_ci  [
78e41f4b71Sopenharmony_ci    {
79e41f4b71Sopenharmony_ci      value:$r('app.media.ic_public_save'),
80e41f4b71Sopenharmony_ci      isEnabled:true,
81e41f4b71Sopenharmony_ci      action:() => promptAction.showToast({ message: "show toast index 1" })
82e41f4b71Sopenharmony_ci    },
83e41f4b71Sopenharmony_ci    {
84e41f4b71Sopenharmony_ci      value:$r('app.media.ic_public_reduce'),
85e41f4b71Sopenharmony_ci      isEnabled:true,
86e41f4b71Sopenharmony_ci      action:() => promptAction.showToast({ message: "show toast index 2" })
87e41f4b71Sopenharmony_ci    },
88e41f4b71Sopenharmony_ci    {
89e41f4b71Sopenharmony_ci      value:$r('app.media.ic_public_edit'),
90e41f4b71Sopenharmony_ci      isEnabled:true,
91e41f4b71Sopenharmony_ci      action:() => promptAction.showToast({ message: "show toast index 3" })
92e41f4b71Sopenharmony_ci    },
93e41f4b71Sopenharmony_ci    {
94e41f4b71Sopenharmony_ci      value:$r('app.media.ic_public_reduce'),
95e41f4b71Sopenharmony_ci      isEnabled:true,
96e41f4b71Sopenharmony_ci      action:() => promptAction.showToast({ message: "show toast index 4" })
97e41f4b71Sopenharmony_ci    }
98e41f4b71Sopenharmony_ci  ]
99e41f4b71Sopenharmony_ci
100e41f4b71Sopenharmony_ci  build() {
101e41f4b71Sopenharmony_ci    Row() {
102e41f4b71Sopenharmony_ci      Column() {
103e41f4b71Sopenharmony_ci		Divider().height(2).color(0xCCCCCC)
104e41f4b71Sopenharmony_ci        SelectTitleBar({
105e41f4b71Sopenharmony_ci          options: [
106e41f4b71Sopenharmony_ci            { value: 'All photos' },
107e41f4b71Sopenharmony_ci            { value: 'Local (device)' },
108e41f4b71Sopenharmony_ci            { value: 'Local (memory card)'}
109e41f4b71Sopenharmony_ci          ],
110e41f4b71Sopenharmony_ci          selected: 0,
111e41f4b71Sopenharmony_ci          onSelected: (index) => promptAction.showToast({ message: 'page index ' + index }),
112e41f4b71Sopenharmony_ci          hidesBackButton: true
113e41f4b71Sopenharmony_ci        })
114e41f4b71Sopenharmony_ci        Divider().height(2).color(0xCCCCCC)
115e41f4b71Sopenharmony_ci        SelectTitleBar({
116e41f4b71Sopenharmony_ci          options: [
117e41f4b71Sopenharmony_ci            { value: 'All photos' },
118e41f4b71Sopenharmony_ci            { value: 'Local (device)' },
119e41f4b71Sopenharmony_ci            { value: 'Local (memory card)'}
120e41f4b71Sopenharmony_ci          ],
121e41f4b71Sopenharmony_ci          selected: 0,
122e41f4b71Sopenharmony_ci          onSelected: (index) => promptAction.showToast({ message: 'page index ' + index }),
123e41f4b71Sopenharmony_ci          hidesBackButton: false
124e41f4b71Sopenharmony_ci        })
125e41f4b71Sopenharmony_ci        Divider().height(2).color(0xCCCCCC)
126e41f4b71Sopenharmony_ci        SelectTitleBar({
127e41f4b71Sopenharmony_ci          options: [
128e41f4b71Sopenharmony_ci            { value: 'All photos' },
129e41f4b71Sopenharmony_ci            { value: 'Local (device)' },
130e41f4b71Sopenharmony_ci            { value: 'Local (memory card)'}
131e41f4b71Sopenharmony_ci          ],
132e41f4b71Sopenharmony_ci          selected: 1,
133e41f4b71Sopenharmony_ci          onSelected: (index) => promptAction.showToast({ message: 'page index ' + index }),
134e41f4b71Sopenharmony_ci          subtitle: "example@example.com"
135e41f4b71Sopenharmony_ci        })
136e41f4b71Sopenharmony_ci        Divider().height(2).color(0xCCCCCC)
137e41f4b71Sopenharmony_ci        SelectTitleBar({
138e41f4b71Sopenharmony_ci          options: [
139e41f4b71Sopenharmony_ci            { value: 'All photos' },
140e41f4b71Sopenharmony_ci            { value: 'Local (device)' },
141e41f4b71Sopenharmony_ci            { value: 'Local (memory card)'}
142e41f4b71Sopenharmony_ci          ],
143e41f4b71Sopenharmony_ci          selected: 1,
144e41f4b71Sopenharmony_ci          onSelected: (index) => promptAction.showToast({ message: 'page index ' + index }),
145e41f4b71Sopenharmony_ci          subtitle: "example@example.com",
146e41f4b71Sopenharmony_ci          menuItems: [{ isEnabled: true, value: $r('app.media.ic_public_save'),
147e41f4b71Sopenharmony_ci            action: () => promptAction.showToast({ message: "show toast index 1" })
148e41f4b71Sopenharmony_ci          }]
149e41f4b71Sopenharmony_ci        })
150e41f4b71Sopenharmony_ci        Divider().height(2).color(0xCCCCCC)
151e41f4b71Sopenharmony_ci        SelectTitleBar({
152e41f4b71Sopenharmony_ci          options: [
153e41f4b71Sopenharmony_ci            { value: 'All photos' },
154e41f4b71Sopenharmony_ci            { value: 'Local (device)' },
155e41f4b71Sopenharmony_ci            { value: 'Local (memory card)'}
156e41f4b71Sopenharmony_ci          ],
157e41f4b71Sopenharmony_ci          selected: 0,
158e41f4b71Sopenharmony_ci          onSelected: (index) => promptAction.showToast({ message: 'page index ' + index }),
159e41f4b71Sopenharmony_ci          subtitle: "example@example.com",
160e41f4b71Sopenharmony_ci          menuItems: this.menuItems,
161e41f4b71Sopenharmony_ci          badgeValue: 99,
162e41f4b71Sopenharmony_ci          hidesBackButton: true
163e41f4b71Sopenharmony_ci        })
164e41f4b71Sopenharmony_ci        Divider().height(2).color(0xCCCCCC)
165e41f4b71Sopenharmony_ci      }.width('100%')
166e41f4b71Sopenharmony_ci    }.height('100%')
167e41f4b71Sopenharmony_ci  }
168e41f4b71Sopenharmony_ci}
169e41f4b71Sopenharmony_ci```
170e41f4b71Sopenharmony_ci
171e41f4b71Sopenharmony_ci![en-us_image_0000001616959836](figures/en-us_image_0000001616959836.jpg)
172