1e41f4b71Sopenharmony_ci# SubHeader 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ciA subheader signifies the top of a list or the beginning a subdivision of content and tells the user what the list or subdivision is about. 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```ts 15e41f4b71Sopenharmony_ciimport { SubHeader } 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 supported. 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci> **NOTE** 27e41f4b71Sopenharmony_ci> 28e41f4b71Sopenharmony_ci> The [universal text attributes](ts-universal-attributes-text-style.md) are not supported. 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ci## SubHeader 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ciSubHeader({icon?: ResourceStr, iconSymbolOptions?: SymbolOptions, primaryTitle?: ResourceStr, secondaryTitle?: ResourceStr, select?: SelectOptions, operationType?: OperationType, operationItem?: Array<OperationOption>, operationSymbolOptions?: Array<SymbolOptions>}) 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ci**Decorator**: @Component 35e41f4b71Sopenharmony_ci 36e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci**Parameters** 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ci 42e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Decorator| Description| 43e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- | 44e41f4b71Sopenharmony_ci| icon | [ResourceStr](ts-types.md#resourcestr) | No| \@Prop | Icon.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 45e41f4b71Sopenharmony_ci| iconSymbolOptions<sup>12+</sup> | [SymbolOptions](#symboloptions12) | No| - | Icon symbol options. This parameter is available when **icon** is set to a [symbol glyph](ts-basic-components-symbolGlyph.md).<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 46e41f4b71Sopenharmony_ci| primaryTitle | [ResourceStr](ts-types.md#resourcestr) | No| \@Prop | Primary title.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 47e41f4b71Sopenharmony_ci| secondaryTitle | [ResourceStr](ts-types.md#resourcestr) | No| \@Prop | Secondary title.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 48e41f4b71Sopenharmony_ci| select | [SelectOptions](#selectoptions) | No| - | Content and events for selection.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 49e41f4b71Sopenharmony_ci| operationType | [OperationType](#operationtype) | No| \@Prop | Type of operation in the operation area (right).<br>Default value: **OperationType.BUTTON**<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 50e41f4b71Sopenharmony_ci| operationItem | Array<[OperationOption](#operationoption)> | No| - | Items in the operation area (right).<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 51e41f4b71Sopenharmony_ci| operationSymbolOptions<sup>12+</sup> | Array<[SymbolOptions](#symboloptions12)> | No| - | Icon symbol options.<br>This parameter is available when **operationType** is set to **OperationType.ICON_GROUP** and **operationItem** is set to an array of items.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 52e41f4b71Sopenharmony_ci| primaryTitleModifier<sup>12+</sup> | [TextModifier](ts-universal-attributes-attribute-modifier.md) | No| - | Text attributes of the primary title, such as the font color, font size, and font weight.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 53e41f4b71Sopenharmony_ci| secondaryTitleModifier<sup>12+</sup> | [TextModifier](ts-universal-attributes-attribute-modifier.md) | No| - | Text attributes of the secondary title, such as the font color, font size, and font weight.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 54e41f4b71Sopenharmony_ci| titleBuilder<sup>12+</sup> | () => void | No| @BuildParam | Content of the custom title area.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 55e41f4b71Sopenharmony_ci| contentMargin<sup>12+</sup> | [LocalizedMargin](ts-types.md#localizedmargin12) | No| @Prop | Margin of the content. Negative numbers are not supported.<br>Default value:<br> `{start: LengthMetrics.resource(` <br> `$r('sys.float.margin_left'))`, <br> `end: LengthMetrics.resource(` <br> `$r('sys.float.margin_right'))}`<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 56e41f4b71Sopenharmony_ci| contentPadding<sup>12+</sup> | [LocalizedPadding](ts-types.md#localizedpadding12) | No| @Prop | Padding of the content.<br>Default value:<br>If a secondary title, with or without an icon, is displayed on the left:<br> {start: LengthMetircs.vp(12), end: LengthMetrics.vp(12)}<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 57e41f4b71Sopenharmony_ci 58e41f4b71Sopenharmony_ci 59e41f4b71Sopenharmony_ci## OperationType 60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ci| Name| Value| Description| 64e41f4b71Sopenharmony_ci| -------- | -------- | -------- | 65e41f4b71Sopenharmony_ci| TEXT_ARROW | 0 | Text button with a right arrow.| 66e41f4b71Sopenharmony_ci| BUTTON | 1 | Text button without a right arrow.| 67e41f4b71Sopenharmony_ci| ICON_GROUP | 2 | Icon-attached button (A maximum of three icons can be configured.)| 68e41f4b71Sopenharmony_ci| LOADING | 3 | Loading animation.| 69e41f4b71Sopenharmony_ci 70e41f4b71Sopenharmony_ci## SelectOptions 71e41f4b71Sopenharmony_ci 72e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 73e41f4b71Sopenharmony_ci 74e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 75e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 76e41f4b71Sopenharmony_ci| options | Array<[SelectOption](ts-basic-components-select.md#selectoption)> | Yes| Value of an option in the drop-down list box.| 77e41f4b71Sopenharmony_ci| selected | number | No| Index of the initial selected option in the drop-down list.<br>The index of the first option is 0.<br>If this attribute is not set,<br>the default value **-1** is used, indicating that the option is not selected.| 78e41f4b71Sopenharmony_ci| value | string | No| Text content of the drop-down list button itself.| 79e41f4b71Sopenharmony_ci| onSelect | (index: number, value?: string) => void | No| Invoked when an option in the drop-down list box is selected.<br>- **index**: index of the selected option.<br>- **value**: value of the selected option.| 80e41f4b71Sopenharmony_ci 81e41f4b71Sopenharmony_ci## OperationOption 82e41f4b71Sopenharmony_ci 83e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 84e41f4b71Sopenharmony_ci 85e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 86e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 87e41f4b71Sopenharmony_ci| value | [ResourceStr](ts-types.md#resourcestr) | Yes| Text content.| 88e41f4b71Sopenharmony_ci| action | ()=>void | No| Event.| 89e41f4b71Sopenharmony_ci 90e41f4b71Sopenharmony_ci## SymbolOptions<sup>12+</sup> 91e41f4b71Sopenharmony_ci 92e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 93e41f4b71Sopenharmony_ci 94e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 95e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 96e41f4b71Sopenharmony_ci| fontColor | [ResourceStr](ts-types.md#resourcestr) | No| Color of the [symbol glyph](ts-basic-components-symbolGlyph.md).<br>Default value: depending on the rendering strategy| 97e41f4b71Sopenharmony_ci| fontSize | number \|string \|[Resource](ts-types.md#Resource) | No| Size of the [symbol glyph](ts-basic-components-symbolGlyph.md).<br>Default value: system default value| 98e41f4b71Sopenharmony_ci| fontWeight | [FontWeight](ts-appendix-enums.md#fontweight)\|number \|string | No| Font weight of the [symbol glyph](ts-basic-components-symbolGlyph.md).<br>For the number type, the value ranges from 100 to 900, at an interval of 100. A larger value indicates a heavier font weight. The default value is **400**.<br>For the string type, only strings of the number type are supported, for example, **"400"**, **"bold"**, **"bolder"**, **"lighter"**, **"regular"**, and **"medium"**, which correspond to the enumerated values in **FontWeight**.<br>Default value: **FontWeight.Normal**| 99e41f4b71Sopenharmony_ci| renderingStrategy | [SymbolRenderingStrategy](ts-basic-components-symbolGlyph.md#symbolrenderingstrategy11) | No| Rendering strategy of the [symbol glyph](ts-basic-components-symbolGlyph.md).<br>Default value: **SymbolRenderingStrategy.SINGLE**<br>**NOTE**<br>For the resources referenced in **$r('sys.symbol.ohos_*')**, only **ohos_trash_circle**, **ohos_folder_badge_plus**, and **ohos_lungs** support the **MULTIPLE_COLOR** modes.| 100e41f4b71Sopenharmony_ci| effectStrategy | [SymbolEffectStrategy](ts-basic-components-symbolGlyph.md#symboleffectstrategy11) | No| Effect strategy of the [symbol glyph](ts-basic-components-symbolGlyph.md).<br>Default value: **SymbolEffectStrategy.NONE**<br>**NOTE**<br>For the resources referenced in **$r('sys.symbol.ohos_*')**, only **ohos_wifi** supports the hierarchical effect.| 101e41f4b71Sopenharmony_ci 102e41f4b71Sopenharmony_ci## Events 103e41f4b71Sopenharmony_ciThe [universal events](ts-universal-events-click.md) are supported. 104e41f4b71Sopenharmony_ci 105e41f4b71Sopenharmony_ci## Example 106e41f4b71Sopenharmony_ci### Example 1 107e41f4b71Sopenharmony_ci 108e41f4b71Sopenharmony_ci```ts 109e41f4b71Sopenharmony_ciimport { promptAction, OperationType, SubHeader } from '@kit.ArkUI' 110e41f4b71Sopenharmony_ci 111e41f4b71Sopenharmony_ci@Entry 112e41f4b71Sopenharmony_ci@Component 113e41f4b71Sopenharmony_cistruct SubHeaderExample { 114e41f4b71Sopenharmony_ci build() { 115e41f4b71Sopenharmony_ci Column() { 116e41f4b71Sopenharmony_ci SubHeader({ 117e41f4b71Sopenharmony_ci icon: $r('app.media.ic_public_community_messages'), 118e41f4b71Sopenharmony_ci secondaryTitle: 'Secondary title', 119e41f4b71Sopenharmony_ci operationType: OperationType.BUTTON, 120e41f4b71Sopenharmony_ci operationItem: [{ value: 'Operation', 121e41f4b71Sopenharmony_ci action: () => { 122e41f4b71Sopenharmony_ci promptAction.showToast({ message: 'demo' }) 123e41f4b71Sopenharmony_ci } 124e41f4b71Sopenharmony_ci }] 125e41f4b71Sopenharmony_ci }) 126e41f4b71Sopenharmony_ci } 127e41f4b71Sopenharmony_ci } 128e41f4b71Sopenharmony_ci} 129e41f4b71Sopenharmony_ci``` 130e41f4b71Sopenharmony_ci 131e41f4b71Sopenharmony_ci 132e41f4b71Sopenharmony_ci 133e41f4b71Sopenharmony_ci### Example 2 134e41f4b71Sopenharmony_ci 135e41f4b71Sopenharmony_ci```ts 136e41f4b71Sopenharmony_ciimport { promptAction, OperationType, SubHeader } from '@kit.ArkUI' 137e41f4b71Sopenharmony_ci 138e41f4b71Sopenharmony_ci@Entry 139e41f4b71Sopenharmony_ci@Component 140e41f4b71Sopenharmony_cistruct SubHeaderExample { 141e41f4b71Sopenharmony_ci build() { 142e41f4b71Sopenharmony_ci Column() { 143e41f4b71Sopenharmony_ci SubHeader({ 144e41f4b71Sopenharmony_ci primaryTitle: 'Primary title', 145e41f4b71Sopenharmony_ci secondaryTitle: 'Secondary title', 146e41f4b71Sopenharmony_ci operationType: OperationType.TEXT_ARROW, 147e41f4b71Sopenharmony_ci operationItem: [{value:'More', 148e41f4b71Sopenharmony_ci action: () => { 149e41f4b71Sopenharmony_ci promptAction.showToast({ message: 'demo' }) 150e41f4b71Sopenharmony_ci } 151e41f4b71Sopenharmony_ci }] 152e41f4b71Sopenharmony_ci }) 153e41f4b71Sopenharmony_ci } 154e41f4b71Sopenharmony_ci } 155e41f4b71Sopenharmony_ci} 156e41f4b71Sopenharmony_ci``` 157e41f4b71Sopenharmony_ci 158e41f4b71Sopenharmony_ci 159e41f4b71Sopenharmony_ci 160e41f4b71Sopenharmony_ci### Example 3 161e41f4b71Sopenharmony_ci 162e41f4b71Sopenharmony_ci```ts 163e41f4b71Sopenharmony_ciimport { promptAction, OperationType, SubHeader } from '@kit.ArkUI' 164e41f4b71Sopenharmony_ci 165e41f4b71Sopenharmony_ci@Entry 166e41f4b71Sopenharmony_ci@Component 167e41f4b71Sopenharmony_cistruct SubHeaderExample { 168e41f4b71Sopenharmony_ci build() { 169e41f4b71Sopenharmony_ci Column() { 170e41f4b71Sopenharmony_ci SubHeader({ 171e41f4b71Sopenharmony_ci select: { 172e41f4b71Sopenharmony_ci options: [{ value: 'aaa' }, { value: 'bbb' }, { value: 'ccc' }], 173e41f4b71Sopenharmony_ci value: 'selectdemo', 174e41f4b71Sopenharmony_ci selected: 2, 175e41f4b71Sopenharmony_ci onSelect: (index: number, value?: string) => { 176e41f4b71Sopenharmony_ci promptAction.showToast({ message: 'demo' }) 177e41f4b71Sopenharmony_ci } 178e41f4b71Sopenharmony_ci }, 179e41f4b71Sopenharmony_ci operationType: OperationType.ICON_GROUP, 180e41f4b71Sopenharmony_ci operationItem: [{ 181e41f4b71Sopenharmony_ci value: $r('app.media.ic_public_community_messages'), 182e41f4b71Sopenharmony_ci action: () => { 183e41f4b71Sopenharmony_ci promptAction.showToast({ message: 'demo' }) 184e41f4b71Sopenharmony_ci } 185e41f4b71Sopenharmony_ci }, { 186e41f4b71Sopenharmony_ci value: $r('app.media.ic_public_community_messages'), 187e41f4b71Sopenharmony_ci action: () => { 188e41f4b71Sopenharmony_ci promptAction.showToast({ message: 'demo' }) 189e41f4b71Sopenharmony_ci } 190e41f4b71Sopenharmony_ci }, { 191e41f4b71Sopenharmony_ci value: $r('app.media.ic_public_community_messages'), 192e41f4b71Sopenharmony_ci action: () => { 193e41f4b71Sopenharmony_ci promptAction.showToast({ message: 'demo' }) 194e41f4b71Sopenharmony_ci } 195e41f4b71Sopenharmony_ci }] 196e41f4b71Sopenharmony_ci }) 197e41f4b71Sopenharmony_ci } 198e41f4b71Sopenharmony_ci } 199e41f4b71Sopenharmony_ci} 200e41f4b71Sopenharmony_ci``` 201e41f4b71Sopenharmony_ci 202e41f4b71Sopenharmony_ci 203e41f4b71Sopenharmony_ci 204e41f4b71Sopenharmony_ci### Example 4 205e41f4b71Sopenharmony_ci 206e41f4b71Sopenharmony_ci```ts 207e41f4b71Sopenharmony_ci 208e41f4b71Sopenharmony_ciimport { promptAction, OperationType, SubHeader } from '@kit.ArkUI' 209e41f4b71Sopenharmony_ci 210e41f4b71Sopenharmony_ci@Entry 211e41f4b71Sopenharmony_ci@Component 212e41f4b71Sopenharmony_cistruct SubHeaderExample { 213e41f4b71Sopenharmony_ci build() { 214e41f4b71Sopenharmony_ci Column() { 215e41f4b71Sopenharmony_ci SubHeader({ 216e41f4b71Sopenharmony_ci icon: $r('sys.symbol.ohos_wifi'), 217e41f4b71Sopenharmony_ci iconSymbolOptions: { 218e41f4b71Sopenharmony_ci effectStrategy: SymbolEffectStrategy.HIERARCHICAL, 219e41f4b71Sopenharmony_ci }, 220e41f4b71Sopenharmony_ci secondaryTitle: 'Title', 221e41f4b71Sopenharmony_ci operationType: OperationType.BUTTON, 222e41f4b71Sopenharmony_ci operationItem: [{ value: 'Operation', 223e41f4b71Sopenharmony_ci action: () => { 224e41f4b71Sopenharmony_ci promptAction.showToast({ message: 'demo' }) 225e41f4b71Sopenharmony_ci } 226e41f4b71Sopenharmony_ci }] 227e41f4b71Sopenharmony_ci }) 228e41f4b71Sopenharmony_ci } 229e41f4b71Sopenharmony_ci } 230e41f4b71Sopenharmony_ci} 231e41f4b71Sopenharmony_ci``` 232e41f4b71Sopenharmony_ci 233e41f4b71Sopenharmony_ci 234e41f4b71Sopenharmony_ci 235e41f4b71Sopenharmony_ci### Example 5 236e41f4b71Sopenharmony_ci 237e41f4b71Sopenharmony_ci```ts 238e41f4b71Sopenharmony_ciimport { promptAction, OperationType, SubHeader } from '@kit.ArkUI' 239e41f4b71Sopenharmony_ci 240e41f4b71Sopenharmony_ci@Entry 241e41f4b71Sopenharmony_ci@Component 242e41f4b71Sopenharmony_cistruct SubHeaderExample { 243e41f4b71Sopenharmony_ci build() { 244e41f4b71Sopenharmony_ci Column() { 245e41f4b71Sopenharmony_ci SubHeader({ 246e41f4b71Sopenharmony_ci select: { 247e41f4b71Sopenharmony_ci options: [{ value: 'aaa' }, { value: 'bbb' }, { value: 'ccc' }], 248e41f4b71Sopenharmony_ci value: 'selectdemo', 249e41f4b71Sopenharmony_ci selected: 2, 250e41f4b71Sopenharmony_ci onSelect: (index: number, value?: string) => { 251e41f4b71Sopenharmony_ci promptAction.showToast({ message: 'demo' }) 252e41f4b71Sopenharmony_ci } 253e41f4b71Sopenharmony_ci }, 254e41f4b71Sopenharmony_ci operationType: OperationType.ICON_GROUP, 255e41f4b71Sopenharmony_ci operationItem: [{ 256e41f4b71Sopenharmony_ci value: $r('sys.symbol.ohos_lungs'), 257e41f4b71Sopenharmony_ci action: () => { 258e41f4b71Sopenharmony_ci promptAction.showToast({ message: 'icon1' }) 259e41f4b71Sopenharmony_ci } 260e41f4b71Sopenharmony_ci }, { 261e41f4b71Sopenharmony_ci value: $r('sys.symbol.ohos_lungs'), 262e41f4b71Sopenharmony_ci action: () => { 263e41f4b71Sopenharmony_ci promptAction.showToast({ message: 'icon2' }) 264e41f4b71Sopenharmony_ci } 265e41f4b71Sopenharmony_ci }, { 266e41f4b71Sopenharmony_ci value: $r('sys.symbol.ohos_lungs'), 267e41f4b71Sopenharmony_ci action: () => { 268e41f4b71Sopenharmony_ci promptAction.showToast({ message: 'icon3' }) 269e41f4b71Sopenharmony_ci } 270e41f4b71Sopenharmony_ci }], 271e41f4b71Sopenharmony_ci operationSymbolOptions: [{ 272e41f4b71Sopenharmony_ci fontWeight: FontWeight.Lighter, 273e41f4b71Sopenharmony_ci }, { 274e41f4b71Sopenharmony_ci renderingStrategy: SymbolRenderingStrategy.MULTIPLE_COLOR, 275e41f4b71Sopenharmony_ci fontColor: [Color.Blue, Color.Grey, Color.Green], 276e41f4b71Sopenharmony_ci }, { 277e41f4b71Sopenharmony_ci renderingStrategy: SymbolRenderingStrategy.MULTIPLE_OPACITY, 278e41f4b71Sopenharmony_ci fontColor: [Color.Blue, Color.Grey, Color.Green], 279e41f4b71Sopenharmony_ci }] 280e41f4b71Sopenharmony_ci }) 281e41f4b71Sopenharmony_ci } 282e41f4b71Sopenharmony_ci } 283e41f4b71Sopenharmony_ci} 284e41f4b71Sopenharmony_ci``` 285e41f4b71Sopenharmony_ci 286e41f4b71Sopenharmony_ci 287e41f4b71Sopenharmony_ci 288e41f4b71Sopenharmony_ci### Example 6 289e41f4b71Sopenharmony_ci 290e41f4b71Sopenharmony_ci```ts 291e41f4b71Sopenharmony_ci// This example customizes the title content with a titleBuilder object in the SubHeader component. 292e41f4b71Sopenharmony_ciimport { promptAction, OperationType, SubHeader } from '@kit.ArkUI'; 293e41f4b71Sopenharmony_ci 294e41f4b71Sopenharmony_ci@Entry 295e41f4b71Sopenharmony_ci@Component 296e41f4b71Sopenharmony_cistruct SubHeaderExample { 297e41f4b71Sopenharmony_ci @Builder 298e41f4b71Sopenharmony_ci TitleBuilder(): void { 299e41f4b71Sopenharmony_ci Text('Custom title') 300e41f4b71Sopenharmony_ci .fontSize(24) 301e41f4b71Sopenharmony_ci .fontColor(Color.Red) 302e41f4b71Sopenharmony_ci .fontWeight(FontWeight.Bold) 303e41f4b71Sopenharmony_ci } 304e41f4b71Sopenharmony_ci 305e41f4b71Sopenharmony_ci build() { 306e41f4b71Sopenharmony_ci Column() { 307e41f4b71Sopenharmony_ci SubHeader({ 308e41f4b71Sopenharmony_ci titleBuilder: () => { 309e41f4b71Sopenharmony_ci this.TitleBuilder(); 310e41f4b71Sopenharmony_ci }, 311e41f4b71Sopenharmony_ci primaryTitle: 'Primary title', 312e41f4b71Sopenharmony_ci secondaryTitle: 'Secondary title', 313e41f4b71Sopenharmony_ci icon: $r('sys.symbol.ohos_star'), 314e41f4b71Sopenharmony_ci operationType: OperationType.TEXT_ARROW, 315e41f4b71Sopenharmony_ci operationItem: [{ 316e41f4b71Sopenharmony_ci value: 'More info', 317e41f4b71Sopenharmony_ci action: () => { 318e41f4b71Sopenharmony_ci promptAction.showToast({ message: 'demo'}) 319e41f4b71Sopenharmony_ci } 320e41f4b71Sopenharmony_ci }] 321e41f4b71Sopenharmony_ci }) 322e41f4b71Sopenharmony_ci } 323e41f4b71Sopenharmony_ci } 324e41f4b71Sopenharmony_ci} 325e41f4b71Sopenharmony_ci``` 326e41f4b71Sopenharmony_ci 327e41f4b71Sopenharmony_ci 328e41f4b71Sopenharmony_ci 329e41f4b71Sopenharmony_ci### Example 7 330e41f4b71Sopenharmony_ci 331e41f4b71Sopenharmony_ci```ts 332e41f4b71Sopenharmony_ci// This example demonstrates how to set the font style, margin, and padding for the primary and secondary titles in the SubHeader component. 333e41f4b71Sopenharmony_ciimport { promptAction, OperationType, SubHeader, LengthMetrics, TextModifier } from '@kit.ArkUI'; 334e41f4b71Sopenharmony_ci 335e41f4b71Sopenharmony_ci@Entry 336e41f4b71Sopenharmony_ci@Component 337e41f4b71Sopenharmony_cistruct SubHeaderExample { 338e41f4b71Sopenharmony_ci @State primaryModifier: TextModifier = new TextModifier().fontColor(Color.Red); 339e41f4b71Sopenharmony_ci @State secondaryModifier: TextModifier = new TextModifier().fontColor(Color.Red); 340e41f4b71Sopenharmony_ci 341e41f4b71Sopenharmony_ci build() { 342e41f4b71Sopenharmony_ci Column() { 343e41f4b71Sopenharmony_ci SubHeader({ 344e41f4b71Sopenharmony_ci primaryTitle: 'primaryTitle', 345e41f4b71Sopenharmony_ci secondaryTitle: 'secondaryTitle', 346e41f4b71Sopenharmony_ci primaryTitleModifier: this.primaryModifier, 347e41f4b71Sopenharmony_ci secondaryTitleModifier: this.secondaryModifier, 348e41f4b71Sopenharmony_ci operationType: OperationType.TEXT_ARROW, 349e41f4b71Sopenharmony_ci operationItem: [{ 350e41f4b71Sopenharmony_ci value: 'More info', 351e41f4b71Sopenharmony_ci action: () => { 352e41f4b71Sopenharmony_ci promptAction.showToast({ message: 'demo'}) 353e41f4b71Sopenharmony_ci } 354e41f4b71Sopenharmony_ci }], 355e41f4b71Sopenharmony_ci contentMargin: { start: LengthMetrics.vp(20), end: LengthMetrics.vp(20) }, 356e41f4b71Sopenharmony_ci contentPadding: { start: LengthMetrics.vp(20), end: LengthMetrics.vp(20) } 357e41f4b71Sopenharmony_ci }) 358e41f4b71Sopenharmony_ci } 359e41f4b71Sopenharmony_ci } 360e41f4b71Sopenharmony_ci} 361e41f4b71Sopenharmony_ci``` 362e41f4b71Sopenharmony_ci 363e41f4b71Sopenharmony_ci 364