Skip to main content
Version: Next

Taro.setTabBarStyle(option)

Dynamically sets the overall style of the tabBar.

Reference

Type

(option?: Option) => Promise<CallbackResult>

Parameters

Option

PropertyTypeRequiredDescription
backgroundColorstringNoThe background color of tab, HexColor
borderStylestringNoThe border color of tabBar, which only supports black/white
colorstringNOThe default color of text on tab, HexColor
selectedColorstringNoThe color of the selected text on tab, HexColor
complete(res: CallbackResult) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: CallbackResult) => voidNoThe callback function for a failed API call
success(res: CallbackResult) => voidNoThe callback function for a successful API call

Sample Code

Taro.setTabBarStyle({
color: '#FF0000',
selectedColor: '#00FF00',
backgroundColor: '#0000FF',
borderStyle: 'white'
})

API Support

APIWeChat Mini-ProgramH5React Native
Taro.setTabBarStyle✔️✔️✔️