# TabContent The **TabContent** component is used only in the **Tabs** component. It corresponds to the content view of a switched tab page. > **NOTE** > > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. ## Child Components This component supports only one child component. > **NOTE** > > Built-in components and custom components are allowed, with support for ([if/else](../../../quick-start/arkts-rendering-control-ifelse.md), [ForEach](../../../quick-start/arkts-rendering-control-foreach.md), and [LazyForEach](../../../quick-start/arkts-rendering-control-lazyforeach.md)) rendering control. ## APIs TabContent() **Atomic service API**: This API can be used in atomic services since API version 11. **System capability**: SystemCapability.ArkUI.ArkUI.Full ## Attributes In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. ### tabBar tabBar(value: string | Resource | CustomBuilder | { icon?: string | Resource; text?: string | Resource }) Sets the content displayed on the tab bar. If an icon uses an SVG image, the width and height attributes of the SVG image must be deleted. Otherwise, the icon size will be determined by the width and height attributes of the SVG image. If the content set exceeds the space provided by the tab bar, it will be clipped. **Atomic service API**: This API can be used in atomic services since API version 11. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | value | string \| [Resource](ts-types.md#resource) \|
[CustomBuilder](ts-types.md#custombuilder8)8+\| {
icon?: string \| [Resource](ts-types.md#resource),
text?: string \| [Resource](ts-types.md#resource)
} | Yes| Content displayed on the tab bar.
**CustomBuilder**: builder, to which components can be passed (applicable to API version 8 and later versions).| ### tabBar9+ tabBar(value: SubTabBarStyle | BottomTabBarStyle) Sets the content displayed on the tab bar. The bottom tab style does not include an indicator. When an icon display error occurs, a gray blank block is displayed. **Atomic service API**: This API can be used in atomic services since API version 11. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name| Type | Mandatory| Description | | ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | value | [SubTabBarStyle](#subtabbarstyle9) \| [BottomTabBarStyle](#bottomtabbarstyle9)| Yes | Content displayed on the tab bar.
**SubTabBarStyle**: subtab style
**BottomTabBarStyle**: bottom and side tab style| > **NOTE** > > - The **TabContent** component does not support setting of the common width attribute. By default, its width is the same as that of the parent **Tabs** component. > - The **TabContent** component does not support setting of the universal height attribute. Its height is determined by the height of the parent **Tabs** component and the **TabBar** component. > - If the **vertical** attribute is **false**, the width and height descriptions are swapped in the preceding two restrictions. > - **TabContent** does not support page scrolling. If page scrolling is required, consider nesting a list. ## SubTabBarStyle9+ Implements the subtab style. When this attribute is enabled, the transition animation is played when the user switches between tabs. ### constructor constructor(content: ResourceStr) Constructor used to create a **SubTabBarStyle** instance. **Atomic service API**: This API can be used in atomic services since API version 11. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name| Type | Mandatory| Description| | -------- | -------- | -------- | -------- | | content | [ResourceStr](ts-types.md#resourcestr) | Yes| Text for the tab.| ### constructor12+ constructor(content: ResourceStr | ComponentContent) Constructor used to create a **SubTabBarStyle** instance. You can set custom content with **ComponentContent**. **Atomic service API**: This API can be used in atomic services since API version 12. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name| Type | Mandatory| Description| | -------- | -------- | -------- | -------- | | content | [ResourceStr](ts-types.md#resourcestr) \| [ComponentContent](../js-apis-arkui-ComponentContent.md) | Yes| Content on the tab.
**NOTE**
1. Custom content does not support the **labelStyle** attribute.
2. If the custom content exceeds the content box of the tab page, the excess part is not displayed.
3. If the custom content is within the content box of the tab page, it is aligned in the center.
4. If the custom content is abnormal or no display component is available, a blank area is displayed.| ### of10+ static of(content: ResourceStr): SubTabBarStyle Static constructor used to create a **SubTabBarStyle** instance. **Atomic service API**: This API can be used in atomic services since API version 11. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name | Type | Mandatory| Description | | ------- | ------------------------------------------ | ---- | ------------------ | | content | [ResourceStr](ts-types.md#resourcestr) | Yes | Text for the tab.| **Return value** | Type | Description | | ------- | ------------------------------------------------------------ | | [SubTabBarStyle](#subtabbarstyle9) | **SubTabBarStyle** object created.| ### of12+ static of(content: ResourceStr | ComponentContent): SubTabBarStyle Static constructor used to create a **SubTabBarStyle** instance. **Atomic service API**: This API can be used in atomic services since API version 12. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name | Type | Mandatory| Description | | ------- | ------------------------------------------ | ---- | ------------------ | | content | [ResourceStr](ts-types.md#resourcestr) \| [ComponentContent](../js-apis-arkui-ComponentContent.md) | Yes | Content on the tab. You can set custom content with **ComponentContent**.
**NOTE**
1. Custom content does not support the **labelStyle** attribute.
2. If the custom content exceeds the content box of the tab page, the excess part is not displayed.
3. If the custom content is within the content box of the tab page, it is aligned in the center.
4. If the custom content is abnormal or no display component is available, a blank area is displayed.| **Return value** | Type | Description | | ------- | ------------------------------------------------------------ | | [SubTabBarStyle](#subtabbarstyle9) | **SubTabBarStyle** object created.| ### Attributes The following attributes are supported. **System capability**: SystemCapability.ArkUI.ArkUI.Full | Name | Type | Mandatory| Description | | ----------- | ----------------- | ---- |---------------------------------------- | | indicator10+ | [IndicatorStyle](#indicatorstyle10)| Yes| Indicator style of the selected subtab. It takes effect only in the horizontal layout.
**Atomic service API**: This API can be used in atomic services since API version 11.| | selectedMode10+ | [SelectedMode](#selectedmode10) | Yes| Display mode of the selected subtab. It takes effect only in the horizontal layout.
Default value: **SelectedMode.INDICATOR**
**Atomic service API**: This API can be used in atomic services since API version 11.| | board10+ | [BoardStyle](#boardstyle10) | Yes| Board style of the selected subtab. It takes effect only in the horizontal layout.
**Atomic service API**: This API can be used in atomic services since API version 11.| | labelStyle10+ | [LabelStyle](#labelstyle10) | Yes| Label text and font of the subtab.
**Atomic service API**: This API can be used in atomic services since API version 11.| | padding10+ | [Padding](ts-types.md#padding) \| [Dimension](ts-types.md#dimension10) | Yes| Padding of the subtab. It cannot be set in percentage. When the parameter is of the Dimension type, the value applies to all sides.
Default value: **{left:8.0vp,right:8.0vp,top:17.0vp,bottom:18.0vp}**
**Atomic service API**: This API can be used in atomic services since API version 11.| | padding12+ | [LocalizedPadding](ts-types.md#localizedpadding12) | Yes| Padding of the subtab. The mirroring capability is supported (percentage values are not allowed).
Default value: {start:LengthMetircs.vp(8),end:LengthMetircs.vp(8),
top:LengthMetircs.vp(17),bottom:LengthMetircs.vp(18)}
**Atomic service API**: This API can be used in atomic services since API version 12.| | id11+ | string | Yes| [ID](ts-universal-attributes-component-id.md#attributes) of the subtab.
**Atomic service API**: This API can be used in atomic services since API version 12.| ## IndicatorStyle10+ **Atomic service API**: This API can be used in atomic services since API version 11. **System capability**: SystemCapability.ArkUI.ArkUI.Full | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------------------------------- | | color | [ResourceColor](ts-types.md#resourcecolor) | No| Color of the indicator and board.
Default value: **#FF007DFF**| | height | [Length](ts-types.md#length) | No| Height of the indicator. It cannot be set in percentage.
Default value: **2.0**
Unit: vp| | width | [Length](ts-types.md#length) | No| Width of the indicator. It cannot be set in percentage.
Default value: **0.0**
Unit: vp
**NOTE**
If this parameter is set to **0**, the tab text width will be used instead.| | borderRadius | [Length](ts-types.md#length) | No| Rounded corner radius of the indicator. It cannot be set in percentage.
Default value: **0.0**
Unit: vp| | marginTop | [Length](ts-types.md#length) | No| Spacing between the indicator and text. It cannot be set in percentage.
Default value: **8.0**
Unit: vp| ## SelectedMode10+ **Atomic service API**: This API can be used in atomic services since API version 11. **System capability**: SystemCapability.ArkUI.ArkUI.Full | Name | Description | | ---------- | ------------------------ | | INDICATOR | Indicator mode. | | BOARD | Board mode. | ## BoardStyle10+ **Atomic service API**: This API can be used in atomic services since API version 11. **System capability**: SystemCapability.ArkUI.ArkUI.Full | Name| Type| Mandatory| Description| | -------- | -------- | -------- | ------------------------------------ | | borderRadius | [Length](ts-types.md#length) | No| Rounded corner radius of the board. It cannot be set in percentage.
Default value: **8.0**
Unit: vp| ## LabelStyle10+ **System capability**: SystemCapability.ArkUI.ArkUI.Full | Name | Type | Mandatory| Description | | -------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | overflow | [TextOverflow](ts-appendix-enums.md#textoverflow) | No | Display mode when the label text is too long. By default, an ellipsis (...) is used to represent text overflow.
**Atomic service API**: This API can be used in atomic services since API version 11.| | maxLines | number | No | Maximum number of lines in the label text. If this attribute is specified, the text will not exceed the specified number of lines. You can use **textOverflow** to specify how to represent text overflow. Default value: **1**
**Atomic service API**: This API can be used in atomic services since API version 11.| | minFontSize | number \| [ResourceStr](ts-types.md#resourcestr) | No | Minimum font size of the label text. It cannot be set in percentage. For the setting to take effect, this attribute must be used together with **maxFontSize**, **maxLines**, or layout constraint settings. When the adaptive text size is set, **font.size** does not take effect. Default value: **0.0fp**
**Atomic service API**: This API can be used in atomic services since API version 11.| | maxFontSize | number \| [ResourceStr](ts-types.md#resourcestr) | No | Maximum font size of the label text. It cannot be set in percentage. For the setting to take effect, this attribute must be used together with **minFontSize**, **maxLines**, or layout constraint settings. When the adaptive text size is set, **font.size** does not take effect. Default value: **0.0fp**
**Atomic service API**: This API can be used in atomic services since API version 11.| | heightAdaptivePolicy | [TextHeightAdaptivePolicy](ts-appendix-enums.md#textheightadaptivepolicy10) | No | How the adaptive height is determined for the label text. By default, the **maxLines** settings are prioritized.
**Atomic service API**: This API can be used in atomic services since API version 11.| | font | [Font](ts-types.md#font) | No | Font of the label text.
When the tab is a subtab, the default font is in 16.0 fp size, 'HarmonyOS Sans' family, and normal font style and weight.
When the tab is a bottom tab, the default font is in 10.0 fp size, 'HarmonyOS Sans' family, normal font style, and medium weight.
The default font size of the bottom tab page is 12.0 fp since API version 12.
**Atomic service API**: This API can be used in atomic services since API version 11.| | unselectedColor12+ | [ResourceColor](ts-types.md#resourcecolor) | No| Font color of the label text when it is not selected.
Default value: **#99182431**
**Atomic service API**: This API can be used in atomic services since API version 12.| | selectedColor12+ | [ResourceColor](ts-types.md#resourcecolor) | No| Font color of the label text when it is selected.
Default value: **#FF007DFF**
**Atomic service API**: This API can be used in atomic services since API version 12.| ## BottomTabBarStyle9+ Implements the bottom and side tab style. ### constructor constructor(icon: ResourceStr | TabBarSymbol, text: ResourceStr) A constructor used to create a **BottomTabBarStyle** instance. **Atomic service API**: This API can be used in atomic services since API version 11. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name| Type | Mandatory| Description| | -------- | -------- | -------- | -------- | | icon | [ResourceStr](ts-types.md#resourcestr) \| [TabBarSymbol12+](#tabbarsymbol12)| Yes| Image for the tab.| | text | [ResourceStr](ts-types.md#resourcestr) | Yes| Text for the tab.| ### of10+ static of(icon: ResourceStr | TabBarSymbol, text: ResourceStr): BottomTabBarStyle Static constructor used to create a **BottomTabBarStyle** instance. **Atomic service API**: This API can be used in atomic services since API version 11. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name| Type | Mandatory| Description| | -------- | -------- | -------- | -------- | | icon | [ResourceStr](ts-types.md#resourcestr) \| [TabBarSymbol12+](#tabbarsymbol12)| Yes| Image for the tab.| | text | [ResourceStr](ts-types.md#resourcestr) | Yes| Text for the tab.| **Return value** | Type | Description | | ------- | ------------------------------------------------------------ | | [BottomTabBarStyle](#bottomtabbarstyle9)| **BottomTabBarStyle** object created.| ### Attributes The following attributes are supported. **System capability**: SystemCapability.ArkUI.ArkUI.Full | Name | Type | Mandatory| Description | | ------------ | ---------------------------- | ---- |----------------------------------- | | padding10+ | [Padding](ts-types.md#padding) \| [Dimension](ts-types.md#dimension10) \| [LocalizedPadding12+](ts-types.md#localizedpadding12) | Yes| Padding of the bottom tab. It cannot be set in percentage. When the parameter is of the Dimension type, the value applies to all sides.
Default value: **{left:4.0vp,right:4.0vp,top:0.0vp,bottom:0.0vp}**
If of the LocalizedPadding type, this attribute supports the mirroring capability.
Default value: {start:LengthMetircs.vp(4),end:LengthMetircs.vp(4),
top:LengthMetircs.vp(0),bottom:LengthMetircs.vp(0)}
**Atomic service API**: This API can be used in atomic services since API version 11.| | verticalAlign10+ | [VerticalAlign](ts-appendix-enums.md#verticalalign) | Yes| Vertical alignment mode of the images and text on the bottom tab.
Default value: **VerticalAlign.Center**
**Atomic service API**: This API can be used in atomic services since API version 11.| | layoutMode10+ | [LayoutMode](#layoutmode10) | Yes| Layout of the images and text on the bottom tab. For details, see **LayoutMode**.
Default value: **LayoutMode.VERTICAL**
**Atomic service API**: This API can be used in atomic services since API version 11.| | symmetricExtensible10+ | boolean | Yes| Whether the images and text on the bottom tab can be symmetrically extended by the minimum value of the available space on the left and right bottom tabs. This parameter is valid only between bottom tabs in fixed horizontal mode.
Default value: **false**
**Atomic service API**: This API can be used in atomic services since API version 11.| | labelStyle10+ | [LabelStyle](#labelstyle10) | Yes| Label text and font of the bottom tab.
**Atomic service API**: This API can be used in atomic services since API version 11.| | id11+ | string | Yes| [ID](ts-universal-attributes-component-id.md#attributes) of the bottom tab.
**Atomic service API**: This API can be used in atomic services since API version 12.| | iconStyle12+ | [TabBarIconStyle](#tabbariconstyle12) | Yes| Style of the label icon on the bottom tab.
**Atomic service API**: This API can be used in atomic services since API version 12.| ## TabBarSymbol12+ **Atomic service API**: This API can be used in atomic services since API version 12. **System capability**: SystemCapability.ArkUI.ArkUI.Full | Name| Type | Mandatory| Description| | -------- | -------- | -------- | -------- | | normal | [SymbolGlyphModifier](ts-universal-attributes-attribute-modifier.md) | Yes| Symbol icon in the normal style.
Default value:
**fontColor**: **#66182431**, **renderingStrategy**: **SymbolRenderingStrategy.MULTIPLE_OPACITY**, **fontSize**: **24vp**| | selected | [SymbolGlyphModifier](ts-universal-attributes-attribute-modifier.md) | No| Symbol icon in the selected style.
Default value:
**fontColor**: **#ff007dff**, **renderingStrategy**: **SymbolRenderingStrategy.MULTIPLE_OPACITY**, **fontSize**: **24vp**| ## LayoutMode10+ **Atomic service API**: This API can be used in atomic services since API version 11. **System capability**: SystemCapability.ArkUI.ArkUI.Full | Name | Description | | ---------- | ---------------------------------------- | | AUTO | When the tab width is greater than 104 vp, the tab content is arranged from left to right. Otherwise,the tab content is arranged from top to bottom. This parameter is valid only when the tab bar is in vertical mode or fixed horizontal mode.| | VERTICAL | The tab content is arranged from top to bottom.| | HORIZONTAL | The tab content is arranged from left to right.| ## TabBarIconStyle12+ **Atomic service API**: This API can be used in atomic services since API version 12. **System capability**: SystemCapability.ArkUI.ArkUI.Full | Name | Type | Mandatory| Description | | -------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | unselectedColor | [ResourceColor](ts-types.md#resourcecolor) | No| Color of the label icon when it is not selected.
Default value: **#33182431**
**NOTE**
This attribute only applies to an SVG image. Once set, the fill color will replace that of the SVG image.| | selectedColor | [ResourceColor](ts-types.md#resourcecolor) | No| Color of the label icon when it is selected.
Default value: **#FF007DFF**
**NOTE**
This attribute only applies to an SVG image. Once set, the fill color will replace that of the SVG image.| ## Events In addition to the [universal events](ts-universal-events-click.md), the following events are supported. ### onWillShow12+ onWillShow(event: VoidCallback) Called when the tab content is about to be displayed. The scenarios include the first-time display, tab switching, page switching, and window switching between the foreground and background. **Atomic service API**: This API can be used in atomic services since API version 12. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name| Type | Mandatory| Description | | ------ | --------------------------------------------- | ---- | ----------------------------------- | | event | [VoidCallback](ts-types.md#voidcallback12) | Yes | Callback for when the tab content is about to be displayed. | ### onWillHide12+ onWillHide(event: VoidCallback) Called when the tab content is about to be hidden. The scenarios include the tab switching, page switching, and window switching between the foreground and background. **Atomic service API**: This API can be used in atomic services since API version 12. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name| Type | Mandatory| Description | | ------ | --------------------------------------------- | ---- | ----------------------------------- | | event | [VoidCallback](ts-types.md#voidcallback12) | Yes | Callback for when the tab content is about to be hidden. | ## Example ### Example 1 ```ts // xxx.ets @Entry @Component struct TabContentExample { @State fontColor: string = '#182431' @State selectedFontColor: string = '#007DFF' @State currentIndex: number = 0 private controller: TabsController = new TabsController() @Builder tabBuilder(index: number) { Column() { Image(this.currentIndex === index ? '/common/public_icon_on.svg' : '/common/public_icon_off.svg') .width(24) .height(24) .margin({ bottom: 4 }) .objectFit(ImageFit.Contain) Text(`Tab${index + 1}`) .fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor) .fontSize(10) .fontWeight(500) .lineHeight(14) }.width('100%') } build() { Column() { Tabs({ barPosition: BarPosition.End, controller: this.controller }) { TabContent() { Column() { Text('Tab1') .fontSize(36) .fontColor('#182431') .fontWeight(500) .opacity(0.4) .margin({ top: 30, bottom: 56.5 }) Divider() .strokeWidth(0.5) .color('#182431') .opacity(0.05) }.width('100%') }.tabBar(this.tabBuilder(0)) TabContent() { Column() { Text('Tab2') .fontSize(36) .fontColor('#182431') .fontWeight(500) .opacity(0.4) .margin({ top: 30, bottom: 56.5 }) Divider() .strokeWidth(0.5) .color('#182431') .opacity(0.05) }.width('100%') }.tabBar(this.tabBuilder(1)) TabContent() { Column() { Text('Tab3') .fontSize(36) .fontColor('#182431') .fontWeight(500) .opacity(0.4) .margin({ top: 30, bottom: 56.5 }) Divider() .strokeWidth(0.5) .color('#182431') .opacity(0.05) }.width('100%') }.tabBar(this.tabBuilder(2)) TabContent() { Column() { Text('Tab4') .fontSize(36) .fontColor('#182431') .fontWeight(500) .opacity(0.4) .margin({ top: 30, bottom: 56.5 }) Divider() .strokeWidth(0.5) .color('#182431') .opacity(0.05) }.width('100%') }.tabBar(this.tabBuilder(3)) } .vertical(false) .barHeight(56) .onChange((index: number) => { this.currentIndex = index }) .width(360) .height(190) .backgroundColor('#F1F3F5') .margin({ top: 38 }) }.width('100%') } } ``` ![tabContent](figures/tabContent1.gif) ### Example 2 ```ts // xxx.ets @Entry @Component struct TabContentExample { @State fontColor: string = '#182431' @State selectedFontColor: string = '#007DFF' @State currentIndex: number = 0 private controller: TabsController = new TabsController() @Builder tabBuilder(index: number) { Column() { Image(this.currentIndex === index ? '/common/public_icon_on.svg' : '/common/public_icon_off.svg') .width(24) .height(24) .margin({ bottom: 4 }) .objectFit(ImageFit.Contain) Text('Tab') .fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor) .fontSize(10) .fontWeight(500) .lineHeight(14) }.width('100%').height('100%').justifyContent(FlexAlign.Center) } build() { Column() { Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { TabContent() .tabBar(this.tabBuilder(0)) TabContent() .tabBar(this.tabBuilder(1)) TabContent() .tabBar(this.tabBuilder(2)) TabContent() .tabBar(this.tabBuilder(3)) } .vertical(true) .barWidth(96) .barHeight(414) .onChange((index: number) => { this.currentIndex = index }) .width(96) .height(414) .backgroundColor('#F1F3F5') .margin({ top: 52 }) }.width('100%') } } ``` ![tabContent](figures/tabContent2.gif) ### Example 3 ```ts // xxx.ets @Entry @Component struct TabBarStyleExample { build() { Column({ space: 5 }) { Text ("Subtab Style") Column() { Tabs({ barPosition: BarPosition.Start }) { TabContent() { Column().width('100%').height('100%').backgroundColor(Color.Pink) }.tabBar(new SubTabBarStyle('Pink')) .onWillShow(() => { console.info("Pink will show") }) .onWillHide(() => { console.info("Pink will hide") }) TabContent() { Column().width('100%').height('100%').backgroundColor(Color.Yellow) }.tabBar(new SubTabBarStyle('Yellow')) .onWillShow(() => { console.info("Yellow will show") }) .onWillHide(() => { console.info("Yellow will hide") }) TabContent() { Column().width('100%').height('100%').backgroundColor(Color.Blue) }.tabBar(new SubTabBarStyle('Blue')) .onWillShow(() => { console.info("Blue will show") }) .onWillHide(() => { console.info("Blue will hide") }) TabContent() { Column().width('100%').height('100%').backgroundColor(Color.Green) }.tabBar(new SubTabBarStyle('Green')) .onWillShow(() => { console.info("Green will show") }) .onWillHide(() => { console.info("Green will hide") }) } .vertical(false) .scrollable(true) .barMode(BarMode.Fixed) .onChange((index: number) => { console.info(index.toString()) }) .width('100%') .backgroundColor(0xF1F3F5) }.width('100%').height(200) Text ("Bottom Tab Style") Column() { Tabs({ barPosition: BarPosition.End }) { TabContent() { Column().width('100%').height('100%').backgroundColor(Color.Pink) }.tabBar(new BottomTabBarStyle($r('sys.media.ohos_app_icon'), 'Pink')) .onWillShow(() => { console.info("Pink will show") }) .onWillHide(() => { console.info("Pink will hide") }) TabContent() { Column().width('100%').height('100%').backgroundColor(Color.Yellow) }.tabBar(new BottomTabBarStyle($r('sys.media.ohos_app_icon'), 'Yellow')) .onWillShow(() => { console.info("Yellow will show") }) .onWillHide(() => { console.info("Yellow will hide") }) TabContent() { Column().width('100%').height('100%').backgroundColor(Color.Blue) }.tabBar(new BottomTabBarStyle($r('sys.media.ohos_app_icon'), 'Blue')) .onWillShow(() => { console.info("Blue will show") }) .onWillHide(() => { console.info("Blue will hide") }) TabContent() { Column().width('100%').height('100%').backgroundColor(Color.Green) }.tabBar(new BottomTabBarStyle($r('sys.media.ohos_app_icon'), 'Green')) .onWillShow(() => { console.info("Green will show") }) .onWillHide(() => { console.info("Green will hide") }) } .vertical(false) .scrollable(true) .barMode(BarMode.Fixed) .onChange((index: number) => { console.info(index.toString()) }) .width('100%') .backgroundColor(0xF1F3F5) }.width('100%').height(200) Text ("Side Tab Style") Column() { Tabs({ barPosition: BarPosition.Start }) { TabContent() { Column().width('100%').height('100%').backgroundColor(Color.Pink) }.tabBar(new BottomTabBarStyle($r('sys.media.ohos_app_icon'), 'Pink')) .onWillShow(() => { console.info("Pink will show") }) .onWillHide(() => { console.info("Pink will hide") }) TabContent() { Column().width('100%').height('100%').backgroundColor(Color.Yellow) }.tabBar(new BottomTabBarStyle($r('sys.media.ohos_app_icon'), 'Yellow')) .onWillShow(() => { console.info("Yellow will show") }) .onWillHide(() => { console.info("Yellow will hide") }) TabContent() { Column().width('100%').height('100%').backgroundColor(Color.Blue) }.tabBar(new BottomTabBarStyle($r('sys.media.ohos_app_icon'), 'Blue')) .onWillShow(() => { console.info("Blue will show") }) .onWillHide(() => { console.info("Blue will hide") }) TabContent() { Column().width('100%').height('100%').backgroundColor(Color.Green) }.tabBar(new BottomTabBarStyle($r('sys.media.ohos_app_icon'), 'Green')) .onWillShow(() => { console.info("Green will show") }) .onWillHide(() => { console.info("Green will hide") }) } .vertical(true).scrollable(true).barMode(BarMode.Fixed) .onChange((index: number) => { console.info(index.toString()) }) .width('100%') .backgroundColor(0xF1F3F5) }.width('100%').height(400) } } } ``` ![tabbarStyle](figures/TabBarStyle.jpeg) ### Example 4 ```ts // xxx.ets @Entry @Component struct TabsAttr { private controller: TabsController = new TabsController() @State indicatorColor: Color = Color.Blue; @State indicatorWidth: number = 40; @State indicatorHeight: number = 10; @State indicatorBorderRadius: number = 5; @State indicatorSpace: number = 10; @State subTabBorderRadius: number = 20; @State selectedMode: SelectedMode = SelectedMode.INDICATOR; private colorFlag: boolean = true; private widthFlag: boolean = true; private heightFlag: boolean = true; private borderFlag: boolean = true; private spaceFlag: boolean = true; build() { Column() { Button ("Change Indicator Color").width ('100%').margin ({ bottom:'12vp' }) .onClick((event?: ClickEvent) => { // Animation configuration for the width and height attributes of the