Skip to main content
Use this API to hide the tab bar, optionally with an animation effect.

Parameters

PropertyTypeRequiredDescription
animationBooleanNoWhether to animate the hiding. Default: false
successFunctionNoCallback on success
failFunctionNoCallback on failure
completeFunctionNoCallback that always executes

Code Example

Basic Usage

my.hideTabBar();

With Animation

my.hideTabBar({
  animation: true
});

With Callbacks

my.hideTabBar({
  animation: true,
  success() {
    console.log('Tab bar hidden');
  },
  fail(err) {
    console.error('Failed to hide tab bar:', err);
  }
});

Use Cases

Hide the tab bar when displaying fullscreen content like videos or images.
Page({
  enterFullscreen() {
    my.hideTabBar({ animation: true });
  },

  exitFullscreen() {
    my.showTabBar({ animation: true });
  }
});
Hide tab bar based on user role or state.
Page({
  onLoad() {
    if (this.data.isGuest) {
      my.hideTabBar();
    }
  }
});

my.setTabBarStyle

Customize tab bar style

my.switchTab

Navigate to a tab page