Skip to content

Commit 2ca0068

Browse files
committed
docs(demos): add tabs demo with scenarios
references ionic-team/ionic-site#397
1 parent ae76486 commit 2ca0068

File tree

4 files changed

+101
-0
lines changed

4 files changed

+101
-0
lines changed

demos/tabs/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import {App} from 'ionic/ionic';
2+
3+
@App({
4+
templateUrl: 'main.html',
5+
})
6+
class ApiDemoApp {}

demos/tabs/main.html

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<ion-content>
2+
<!-- Text -->
3+
<ion-tabs no-navbar>
4+
<ion-tab tabTitle="Recents" [root]="root"></ion-tab>
5+
<ion-tab tabTitle="Favorites" [root]="root"></ion-tab>
6+
<ion-tab tabTitle="Settings" [root]="root"></ion-tab>
7+
</ion-tabs>
8+
9+
10+
<!-- Icons -->
11+
<ion-tabs no-navbar selectedIndex="1">
12+
<ion-tab tabIcon="call" [root]="root"></ion-tab>
13+
<ion-tab tabIcon="heart" [root]="root"></ion-tab>
14+
<ion-tab tabIcon="settings" [root]="root"></ion-tab>
15+
</ion-tabs>
16+
17+
18+
<!-- Icons on top of text -->
19+
<ion-tabs no-navbar selectedIndex="2">
20+
<ion-tab tabTitle="Location" tabIcon="navigate" [root]="root"></ion-tab>
21+
<ion-tab tabTitle="Favorites" tabIcon="star" [root]="root"></ion-tab>
22+
<ion-tab tabTitle="Radio" tabIcon="musical-notes" [root]="root"></ion-tab>
23+
</ion-tabs>
24+
25+
26+
<!-- Icons below text -->
27+
<ion-tabs tabbarIcons="bottom" no-navbar selectedIndex="1">
28+
<ion-tab tabTitle="Recents" tabIcon="call" [root]="root"></ion-tab>
29+
<ion-tab tabTitle="Favorites" tabIcon="heart" [root]="root"></ion-tab>
30+
<ion-tab tabTitle="Settings" tabIcon="settings" [root]="root"></ion-tab>
31+
</ion-tabs>
32+
33+
34+
<!-- Icons right of text -->
35+
<ion-tabs tabbarIcons="right" no-navbar selectedIndex="0">
36+
<ion-tab tabTitle="Recents" tabIcon="call" [root]="root"></ion-tab>
37+
<ion-tab tabTitle="Favorites" tabIcon="heart" [root]="root"></ion-tab>
38+
<ion-tab tabTitle="Settings" tabIcon="settings" [root]="root"></ion-tab>
39+
</ion-tabs>
40+
41+
42+
<!-- Icons left of text -->
43+
<ion-tabs tabbarIcons="left" no-navbar>
44+
<ion-tab tabTitle="Recents" tabIcon="call" [root]="root"></ion-tab>
45+
<ion-tab tabTitle="Favorites" tabIcon="heart" [root]="root"></ion-tab>
46+
<ion-tab tabTitle="Settings" tabIcon="settings" [root]="root"></ion-tab>
47+
</ion-tabs>
48+
49+
50+
<!-- No icons -->
51+
<ion-tabs tabbarIcons="hide" no-navbar>
52+
<ion-tab tabTitle="Recents" tabIcon="call" [root]="root"></ion-tab>
53+
<ion-tab tabTitle="Favorites" tabIcon="heart" [root]="root"></ion-tab>
54+
<ion-tab tabTitle="Settings" tabIcon="settings" [root]="root"></ion-tab>
55+
</ion-tabs>
56+
57+
58+
<!-- No overflow text -->
59+
<ion-tabs no-navbar>
60+
<ion-tab tabTitle="Indiana Jones and the Raiders of the Lost Ark" [root]="root"></ion-tab>
61+
<ion-tab tabTitle="Indiana Jones and the Temple of Doom" [root]="root"></ion-tab>
62+
<ion-tab tabTitle="Indiana Jones and the Last Crusade" [root]="root"></ion-tab>
63+
</ion-tabs>
64+
65+
66+
<!-- primary color tabbar -->
67+
<ion-tabs no-navbar primary>
68+
<ion-tab tabIcon="call" [root]="root"></ion-tab>
69+
<ion-tab tabIcon="heart" [root]="root"></ion-tab>
70+
<ion-tab tabIcon="settings" [root]="root"></ion-tab>
71+
</ion-tabs>
72+
73+
<!-- primary color tabbar with a badge -->
74+
<ion-tabs no-navbar primary>
75+
<ion-tab tabIcon="call" [root]="root"></ion-tab>
76+
<ion-tab tabIcon="heart" [root]="root" tabBadge="23" tabBadgeStyle="danger"></ion-tab>
77+
<ion-tab tabIcon="settings" [root]="root"></ion-tab>
78+
</ion-tabs>
79+
</ion-content>
80+
81+
<style>
82+
ion-tabs[no-navbar] {
83+
position: relative;
84+
top: auto;
85+
height: auto;
86+
margin-bottom: 20px;
87+
}
88+
89+
ion-tabs[no-navbar] > ion-navbar-section,
90+
ion-tabs[no-navbar] > ion-content-section {
91+
display: none !important;
92+
}
93+
</style>

ionic/components/tabs/tab.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ import {TabButton} from './tab-button';
7676
* @property {String} [tabBadgeStyle] - set the badge color for this tab
7777
* @property {Any} (select) - method to call when the current tab is selected
7878
*
79+
* @demo /docs/v2/demos/tabs/
7980
*/
8081
@Component({
8182
selector: 'ion-tab',

ionic/components/tabs/tabs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {isUndefined, isTrueProperty} from '../../util/util';
3636
* individual Tab components. On iOS, the TabBar is placed on the bottom of
3737
* the screen, while on Android it is at the top.
3838
*
39+
* @demo /docs/v2/demos/tabs/
3940
* @see {@link /docs/v2/components#tabs Tabs Component Docs}
4041
* @see {@link ../Tab Tab API Docs}
4142
*/

0 commit comments

Comments
 (0)