-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(chips): add (select), [color] and dark theme to chips. (#2242)
Add new functionality/options to chips for managing selection/color. *MdChipList Options* - `[selectable]` - Programmatically control whether or not the chips in the list are capable of being selected. - The SPACE key will automatically select the currently focused chip. *MdChip Options* - `[color]` - Programmatically control the selected color of the chip. - `[selected]` - Programmatically control whether or not the chip is selected. - `(select)` - Event emitted when the chip is selected. - `(deselect)` - Event emitted when the chip is deselected. Additionally, adds basic support for dark themeed chips using existing colors from other components in the spec and cleanup demos by using cards and toolbars like other demos. References #120.
- Loading branch information
1 parent
e4d2bef
commit f45c315
Showing
9 changed files
with
392 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,65 @@ | ||
<div class="chips-demo"> | ||
<section> | ||
<h3>Static Chips</h3> | ||
|
||
<h5>Simple</h5> | ||
|
||
<md-chip-list> | ||
<md-chip>Chip 1</md-chip> | ||
<md-chip>Chip 2</md-chip> | ||
<md-chip>Chip 3</md-chip> | ||
</md-chip-list> | ||
|
||
<h5>Advanced</h5> | ||
|
||
<md-chip-list> | ||
<md-chip class="md-accent selected">Selected/Colored</md-chip> | ||
<md-chip class="md-warn" *ngIf="visible" | ||
(destroy)="alert('chip destroyed')" (click)="toggleVisible()"> | ||
With Events | ||
</md-chip> | ||
</md-chip-list> | ||
|
||
<h5>Unstyled</h5> | ||
|
||
<md-chip-list> | ||
<md-basic-chip>Basic Chip 1</md-basic-chip> | ||
<md-basic-chip>Basic Chip 2</md-basic-chip> | ||
<md-basic-chip>Basic Chip 3</md-basic-chip> | ||
</md-chip-list> | ||
|
||
<h3>Material Contributors</h3> | ||
|
||
<md-chip-list> | ||
<md-chip *ngFor="let person of people; let even = even" [ngClass]="[color, even ? 'selected' : '' ]"> | ||
{{person.name}} | ||
</md-chip> | ||
</md-chip-list> | ||
|
||
<br /> | ||
|
||
<md-input #input (keyup.enter)="add(input)" (blur)="add(input)" placeholder="New Contributor..."> | ||
</md-input> | ||
|
||
<h3>Stacked Chips</h3> | ||
|
||
<p> | ||
You can also stack the chips if you want them on top of each other. | ||
</p> | ||
|
||
<md-chip-list class="md-chip-list-stacked"> | ||
<md-chip (focus)="color = ''" class="selected"> | ||
None | ||
</md-chip> | ||
|
||
<md-chip (focus)="color = 'md-primary'" class="selected md-primary"> | ||
Primary | ||
</md-chip> | ||
|
||
<md-chip (focus)="color = 'md-accent'" class="selected md-accent"> | ||
Accent | ||
</md-chip> | ||
|
||
<md-chip (focus)="color = 'md-warn'" class="selected md-warn"> | ||
Warn | ||
</md-chip> | ||
</md-chip-list> | ||
</section> | ||
<md-card> | ||
<md-toolbar color="primary">Static Chips</md-toolbar> | ||
|
||
<md-card-content> | ||
<h4>Simple</h4> | ||
|
||
<md-chip-list> | ||
<md-chip>Chip 1</md-chip> | ||
<md-chip>Chip 2</md-chip> | ||
<md-chip>Chip 3</md-chip> | ||
</md-chip-list> | ||
|
||
<h4>Unstyled</h4> | ||
|
||
<md-chip-list> | ||
<md-basic-chip>Basic Chip 1</md-basic-chip> | ||
<md-basic-chip>Basic Chip 2</md-basic-chip> | ||
<md-basic-chip>Basic Chip 3</md-basic-chip> | ||
</md-chip-list> | ||
|
||
<h4>Advanced</h4> | ||
|
||
<md-chip-list selectable="false"> | ||
<md-chip color="accent" selected="true">Selected/Colored</md-chip> | ||
<md-chip color="warn" selected="true" *ngIf="visible" | ||
(destroy)="alert('chip destroyed')" (click)="toggleVisible()"> | ||
With Events | ||
</md-chip> | ||
</md-chip-list> | ||
</md-card-content> | ||
</md-card> | ||
|
||
<md-card> | ||
<md-toolbar color="primary">Dynamic Chips</md-toolbar> | ||
|
||
<md-card-content> | ||
<h4>Input Container</h4> | ||
|
||
<md-chip-list> | ||
<md-chip *ngFor="let person of people" [color]="color"> | ||
{{person.name}} | ||
</md-chip> | ||
</md-chip-list> | ||
|
||
<md-input-container> | ||
<input md-input #input (keyup.enter)="add(input)" placeholder="New Contributor..."/> | ||
</md-input-container> | ||
|
||
<h4>Stacked Chips</h4> | ||
|
||
<p> | ||
You can also stack the chips if you want them on top of each other and/or use the | ||
<code>(focus)</code> event to run custom code. | ||
</p> | ||
|
||
<md-chip-list class="md-chip-list-stacked"> | ||
<md-chip *ngFor="let aColor of availableColors" | ||
(focus)="color = aColor.color" color="{{aColor.color}}" selected="true"> | ||
{{aColor.name}} | ||
</md-chip> | ||
</md-chip-list> | ||
</md-card-content> | ||
</md-card> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.