mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +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
69 lines
1.5 KiB
HTML
69 lines
1.5 KiB
HTML
<ion-header>
|
|
|
|
<ion-navbar>
|
|
<ion-title>Button</ion-title>
|
|
</ion-navbar>
|
|
|
|
</ion-header>
|
|
|
|
|
|
<ion-content text-center>
|
|
|
|
<h4>Colors</h4>
|
|
|
|
<button ion-button>Default</button>
|
|
|
|
<button ion-button color="secondary">Secondary</button>
|
|
|
|
<button ion-button color="danger">Danger</button>
|
|
|
|
<button ion-button color="light">Light</button>
|
|
|
|
<button ion-button color="dark">Dark</button>
|
|
|
|
<h4>Shapes</h4>
|
|
|
|
<button ion-button full>Full Button</button>
|
|
|
|
<button ion-button block>Block Button</button>
|
|
|
|
<button ion-button round>Round Button</button>
|
|
|
|
<button ion-button fab style="position: relative;">FAB</button>
|
|
|
|
<h4>Outlines</h4>
|
|
|
|
<button ion-button color="secondary" full outline>Outline + Full</button>
|
|
|
|
<button ion-button color="secondary" block outline>Outline + Block</button>
|
|
|
|
<button ion-button color="secondary" round outline>Outline + Round</button>
|
|
|
|
<button ion-button color="secondary" fab outline style="position: relative;">FAB</button>
|
|
|
|
<h4>Icons</h4>
|
|
|
|
<button ion-button icon-left color="dark">
|
|
<ion-icon name="star"></ion-icon>
|
|
Left Icon
|
|
</button>
|
|
|
|
<button ion-button icon-right color="dark">
|
|
Right Icon
|
|
<ion-icon name="star"></ion-icon>
|
|
</button>
|
|
|
|
<button ion-button icon-only color="dark">
|
|
<ion-icon name="star"></ion-icon>
|
|
</button>
|
|
|
|
<h4>Sizes</h4>
|
|
|
|
<button ion-button color="light" large>Large</button>
|
|
|
|
<button ion-button color="light">Default</button>
|
|
|
|
<button ion-button color="light" small>Small</button>
|
|
|
|
</ion-content>
|