R. Mani Selvam
R. Mani Selvam

Reputation: 320

How can we display multiple tabs in ionic 2 app?

Hi all I am new to ionic 2,How can we use multiple tabs in my app,

My ion-tabs code:-

<ion-tabs>
   <ion-tab tabIcon="apps" [root]="tab3Root"></ion-tab>
</ion-tabs>

<ion-tabs>
  <ion-tab [root]="tab1Root" tabTitle="Tab 1" tabIcon="pulse"></ion-tab>
  <ion-tab [root]="tab2Root" tabTitle="Tab 2" tabIcon="pulse"></ion-tab>
</ion-tabs>

In plunker this below ion-tab is not displaying:-

<ion-tabs>
    <ion-tab tabIcon="apps" [root]="tab3Root"></ion-tab>
</ion-tabs>

Upvotes: 2

Views: 2149

Answers (1)

Rohit Vinay
Rohit Vinay

Reputation: 663

It Can done by using CSS and making the visible. Follow below code and plunker link

HTML

<ion-tabs tabs-only>
 <ion-tab tabIcon="apps" [root]="tab3Root"></ion-tab>
</ion-tabs>

<ion-tabs tabs-only2 >
 <ion-tab [root]="tab1Root" tabTitle="Tab 1" tabIcon="pulse"></ion-tab>
 <ion-tab [root]="tab2Root" tabTitle="Tab 2" tabIcon="pulse"></ion-tab>
</ion-tabs>

CSS

ion-tabs[tabs-only] .tabbar {
    position: fixed;
    bottom: 0;
    height: auto;
    visibility: visible;
    opacity: 1;
    z-index: 111;
    height: 85px;
}

ion-tabs[tabs-only] {
    margin-bottom: 20px;
    contain: none;
    top: 85%;
}

Upvotes: 1

Related Questions