Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

ionic tab (tab)


May 21, 2021 ionic


Table of contents


ionic tab (tab)

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.

Instance

<div class="tabs">
  <a class="tab-item">
    主页
  </a>
  <a class="tab-item">
    收藏
  </a>
  <a class="tab-item">
    设置
  </a>
</div>

Try it out . . .

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.

Icon tab

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>

Try it out . . .

The top icon and text tab

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>

Try it out . . .

Icons on the left and text tabs

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>

Try it out . . .

Stripe style tab

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>

Try it out . . .

Here's how it works:

ionic tab (tab)