Files
Brandy Carney 55a0257dbc refactor(colors): color should be added as an input instead of directly adding the color to the component
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
2016-08-23 17:16:55 -04:00

76 lines
1.9 KiB
HTML

<ion-header>
<ion-navbar>
<ion-title>Label</ion-title>
</ion-navbar>
</ion-header>
<ion-content class="label-demo">
<ion-list>
<ion-item no-lines>
<ion-avatar item-left>
<img src="ionic.svg">
</ion-avatar>
<ion-label>Ionic</ion-label>
</ion-item>
<!-- TODO the styling of the icons can be removed when #5319 is done -->
<ion-item>
<ion-label stacked color="primary">Mobile</ion-label>
<ion-input type="tel" value="+1 (555) 123-1234"></ion-input>
<ion-icon color="primary" item-right ios="ios-chatbubbles-outline" md="md-chatbubbles" class="mobile1"></ion-icon>
<ion-icon color="primary" item-right ios="ios-call-outline" md="md-call" class="mobile2"></ion-icon>
</ion-item>
<ion-item>
<ion-label stacked color="primary">Email</ion-label>
<ion-input type="email" value="hi@ionic.io"></ion-input>
</ion-item>
<ion-item>
<ion-label stacked color="primary">Birthday</ion-label>
<ion-input type="text" value="November 21, 2013"></ion-input>
</ion-item>
<ion-item>
<ion-label stacked color="primary">Address</ion-label>
<ion-textarea
value="121 S Pinckney St
Madison WI 53703
United States">
</ion-textarea>
</ion-item>
<ion-item>
<ion-label stacked color="dark">Notes</ion-label>
<ion-textarea></ion-textarea>
</ion-item>
<button ion-item detail-none>
<ion-label color="primary">Send Message</ion-label>
</button>
<button ion-item detail-none>
<ion-label color="primary">Share Contact</ion-label>
</button>
<button ion-item detail-none>
<ion-label color="primary">Add to Favorites</ion-label>
</button>
</ion-list>
</ion-content>
<style>
.label-demo .mobile1, .label-demo .mobile2 {
position: absolute;
right: 5px;
bottom: 5px;
}
.label-demo .mobile1 {
right: 35px;
}
</style>