title: Taro.setTabBarStyle(option)

sidebar_label: setTabBarStyle

Dynamically sets the overall style of the tabBar.

Reference

Type

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

Parameters

Option

Property Type Required Description
backgroundColor string No The background color of tab, HexColor
borderStyle string No The border color of tabBar, which only supports black/white
color string NO The default color of text on tab, HexColor
selectedColor string No The color of the selected text on tab, HexColor
complete (res: CallbackResult) => void No The callback function used when the API call completed (always executed whether the call succeeds or fails)
fail (res: CallbackResult) => void No The callback function for a failed API call
success (res: CallbackResult) => void No The callback function for a successful API call

Sample Code

  1. Taro.setTabBarStyle({
  2. color: '#FF0000',
  3. selectedColor: '#00FF00',
  4. backgroundColor: '#0000FF',
  5. borderStyle: 'white'
  6. })

API Support

API WeChat Mini-Program H5 React Native
Taro.setTabBarStyle ✔️ ✔️ ✔️