mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 05:58:26 +08:00

BREAKING CHANGES: Colors should be passed in the `color` input on components, not added individually as an attribute on the component. For example: ``` <ion-tabs primary> ``` Becomes ``` <ion-tabs color=”primary”> ``` Or to bind an expression to color: ``` <ion-navbar [color]="barColor"> ... </ion-navbar> ``` ```ts @Component({ templateUrl: 'build/pages/about/about.html' }) export class AboutPage { barColor: string; constructor(private nav: NavController, platform: Platform) { this.barColor = platform.is('android') ? 'primary' : 'light'; } } ``` Reason for this change: It was difficult to dynamically add colors to components, especially if the name of the color attribute was unknown in the template. This change keeps the css flat since we aren’t chaining color attributes on components and instead we assign a class to the component which includes the color’s name. This allows you to easily toggle a component between multiple colors. Speeds up performance because we are no longer reading through all of the attributes to grab the color ones. references #7467 closes #7087 closes #7401 closes #7523
75 lines
2.7 KiB
HTML
75 lines
2.7 KiB
HTML
<ion-header>
|
|
|
|
<ion-navbar>
|
|
<ion-title>Tabs</ion-title>
|
|
</ion-navbar>
|
|
|
|
</ion-header>
|
|
|
|
|
|
<ion-content>
|
|
<!-- Text -->
|
|
<ion-tabs>
|
|
<ion-tab tabTitle="Recents" [root]="root"></ion-tab>
|
|
<ion-tab tabTitle="Favorites" [root]="root" tabBadge="23"></ion-tab>
|
|
<ion-tab tabTitle="Settings" [root]="root"></ion-tab>
|
|
</ion-tabs>
|
|
|
|
|
|
<!-- Icons -->
|
|
<ion-tabs selectedIndex="1" color="primary">
|
|
<ion-tab tabIcon="call" [root]="root"></ion-tab>
|
|
<ion-tab tabIcon="heart" [root]="root"></ion-tab>
|
|
<ion-tab tabIcon="settings" [root]="root" tabBadge="2" tabBadgeStyle="danger"></ion-tab>
|
|
</ion-tabs>
|
|
|
|
|
|
<!-- Icons on top of text -->
|
|
<ion-tabs selectedIndex="2" color="secondary">
|
|
<ion-tab tabTitle="Location" tabIcon="navigate" [root]="root"></ion-tab>
|
|
<ion-tab tabTitle="Favorites" tabIcon="star" [root]="root" tabBadge="12" tabBadgeStyle="dark"></ion-tab>
|
|
<ion-tab tabTitle="Radio" tabIcon="musical-notes" [root]="root"></ion-tab>
|
|
</ion-tabs>
|
|
|
|
|
|
<!-- Icons below text -->
|
|
<ion-tabs tabsLayout="icon-bottom" selectedIndex="1" color="danger">
|
|
<ion-tab tabTitle="Recents" tabIcon="call" [root]="root" tabBadge="47" tabBadgeStyle="light"></ion-tab>
|
|
<ion-tab tabTitle="Favorites" tabIcon="heart" [root]="root"></ion-tab>
|
|
<ion-tab tabTitle="Settings" tabIcon="settings" [root]="root"></ion-tab>
|
|
</ion-tabs>
|
|
|
|
|
|
<!-- Icons right of text -->
|
|
<ion-tabs tabsLayout="icon-right" selectedIndex="0" color="light">
|
|
<ion-tab tabTitle="Recents" tabIcon="call" [root]="root"></ion-tab>
|
|
<ion-tab tabTitle="Favorites" tabIcon="heart" [root]="root"></ion-tab>
|
|
<ion-tab tabTitle="Settings" tabIcon="settings" [root]="root" tabBadge="4" tabBadgeStyle="secondary"></ion-tab>
|
|
</ion-tabs>
|
|
|
|
|
|
<!-- Icons left of text -->
|
|
<ion-tabs tabsLayout="icon-left" color="dark">
|
|
<ion-tab tabTitle="Recents" tabIcon="call" [root]="root" tabBadge="1" tabBadgeStyle="danger"></ion-tab>
|
|
<ion-tab tabTitle="Favorites" tabIcon="heart" [root]="root"></ion-tab>
|
|
<ion-tab tabTitle="Settings" tabIcon="settings" [root]="root"></ion-tab>
|
|
</ion-tabs>
|
|
|
|
|
|
<!-- No icons -->
|
|
<ion-tabs tabsLayout="icon-hide">
|
|
<ion-tab tabTitle="Recents" tabIcon="call" [root]="root"></ion-tab>
|
|
<ion-tab tabTitle="Favorites" tabIcon="heart" [root]="root" tabBadge="61" tabBadgeStyle="dark"></ion-tab>
|
|
<ion-tab tabTitle="Settings" tabIcon="settings" [root]="root"></ion-tab>
|
|
</ion-tabs>
|
|
|
|
|
|
<!-- No overflow text -->
|
|
<ion-tabs color="primary">
|
|
<ion-tab tabTitle="Indiana Jones and the Raiders of the Lost Ark" [root]="root"></ion-tab>
|
|
<ion-tab tabTitle="Indiana Jones and the Temple of Doom" [root]="root"></ion-tab>
|
|
<ion-tab tabTitle="Indiana Jones and the Last Crusade" [root]="root"></ion-tab>
|
|
</ion-tabs>
|
|
|
|
</ion-content>
|