-
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.
Add basic focus/keyboard support for chips. - Up/down arrows navigate chips. - Clicking a chip properly focuses it for subsequent keyboard navigation. - More demos. Confirmed AoT compatibility. References #120.
- Loading branch information
1 parent
0a9ba8b
commit 4041670
Showing
13 changed files
with
522 additions
and
49 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
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,2 +1,10 @@ | ||
.chips-demo { | ||
.md-chip-list-stacked { | ||
display: block; | ||
max-width: 200px; | ||
} | ||
|
||
md-basic-chip { | ||
margin: auto 10px; | ||
} | ||
} |
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,10 +1,40 @@ | ||
import {Component} from '@angular/core'; | ||
|
||
export interface Person { | ||
name: string; | ||
} | ||
|
||
@Component({ | ||
moduleId: module.id, | ||
selector: 'chips-demo', | ||
templateUrl: 'chips-demo.html', | ||
styleUrls: ['chips-demo.css'] | ||
}) | ||
export class ChipsDemo { | ||
visible: boolean = true; | ||
color: string = ''; | ||
|
||
people: Person[] = [ | ||
{ name: 'Kara' }, | ||
{ name: 'Jeremy' }, | ||
{ name: 'Topher' }, | ||
{ name: 'Elad' }, | ||
{ name: 'Kristiyan' }, | ||
{ name: 'Paul' } | ||
]; | ||
|
||
alert(message: string): void { | ||
alert(message); | ||
} | ||
|
||
add(input: HTMLInputElement): void { | ||
if (input.value && input.value.trim() != '') { | ||
this.people.push({ name: input.value.trim() }); | ||
input.value = ''; | ||
} | ||
} | ||
|
||
toggleVisible(): void { | ||
this.visible = false; | ||
} | ||
} |
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.