May 21, 2021 ionic
An ionic tab is a horizontally arranged button or link to switch between pages. It can contain a combination of text and icons and is a popular navigation method on mobile devices.
The following tab container uses the tabs class, and each tab-item class. By default, tabs are text and have no icons.
<div class="tabs"> <a class="tab-item"> 主页 </a> <a class="tab-item"> 收藏 </a> <a class="tab-item"> 设置 </a> </div>
By default, the tab color is the default, and you can set the following different color styles: tabs-default, tabs-light, tabs-stable, tabs-positive, tabs-calm, tabs-balanced, tabs-energized, tabs-assertive, tabs-royal, tabs-dark.
To hide the tab bar, use the tabs-item-hide class.
Adding a tabs-icon-only class after the tabs class sets the display-only icon tab.
<div class="tabs tabs-icon-only"> <a class="tab-item"> <i class="icon ion-home"></i> </a> <a class="tab-item"> <i class="icon ion-star"></i> </a> <a class="tab-item"> <i class="icon ion-gear-a"></i> </a> </div>
Add a tabs-icon-top class after the tabs class to set the top icon and text tab.
<div class="tabs tabs-icon-top"> <a class="tab-item" href="#"> <i class="icon ion-home"></i> 主页 </a> <a class="tab-item" href="#"> <i class="icon ion-star"></i> 收藏 </a> <a class="tab-item" href="#"> <i class="icon ion-gear-a"></i> 设置 </a> </div>
Add the tabs-icon-left class after the tabs class to set the left icon and text tab.
<div class="tabs tabs-icon-left"> <a class="tab-item"> <i class="icon ion-home"></i> 主页 </a> <a class="tab-item"> <i class="icon ion-star"></i> 收藏 </a> <a class="tab-item"> <i class="icon ion-gear-a"></i> 设置 </a> </div>
You can add tabs-striped to elements with the style name tabs to implement Android-style tabs. You can also add tabs-top to implement tabs at the top of the page.
Stripe tab colors can be controlled by tabs-background-color and tabs-color-color, which can be: default, light, stable, positive, calm, balanced, energized, assertive, royal, or dark.
Note: If you want to set the header on the tab again, you need to use the has-tabs-top class.
<div class="tabs-striped tabs-top tabs-background-positive tabs-color-light"> <div class="tabs"> <a class="tab-item active" href="#"> <i class="icon ion-home"></i> Test </a> <a class="tab-item" href="#"> <i class="icon ion-star"></i> Favorites </a> <a class="tab-item" href="#"> <i class="icon ion-gear-a"></i> Settings </a> </div> </div> <div class="tabs-striped tabs-color-assertive"> <div class="tabs"> <a class="tab-item active" href="#"> <i class="icon ion-home"></i> Test </a> <a class="tab-item" href="#"> <i class="icon ion-star"></i> Favorites </a> <a class="tab-item" href="#"> <i class="icon ion-gear-a"></i> Settings </a> </div> </div>
Here's how it works: