1
1
< div class ="demo-chips ">
2
2
< mat-card >
3
- < mat-toolbar color =" primary " > Static Chips</ mat-toolbar >
3
+ < mat-card-header > Static Chips</ mat-card-header >
4
4
5
5
< mat-card-content >
6
6
< h4 > Simple</ h4 >
@@ -111,26 +111,24 @@ <h4>With Events</h4>
111
111
</ mat-card >
112
112
113
113
< mat-card >
114
- < mat-toolbar color =" primary " > Selectable Chips </ mat-toolbar >
114
+ < mat-card-header > Chip Listbox </ mat-card-header >
115
115
116
116
< mat-card-content >
117
- < button matButton (click) ="disabledListboxes = !disabledListboxes ">
118
- {{disabledListboxes ? "Enable" : "Disable"}}
119
- </ button >
120
- < button matButton (click) ="listboxesWithAvatar = !listboxesWithAvatar ">
121
- {{listboxesWithAvatar ? "Hide Avatar" : "Show Avatar"}}
122
- </ button >
117
+ < p > Chip list utilizing the listbox pattern. Should be used for selectable chips.</ p >
118
+
119
+ < mat-checkbox [(ngModel)] ="disabledListboxes "> Disabled</ mat-checkbox >
120
+ < mat-checkbox [(ngModel)] ="listboxesWithAvatar "> Show avatar</ mat-checkbox >
123
121
124
122
< h4 > Single selection</ h4 >
125
123
126
124
< mat-chip-listbox multiple ="false " [disabled] ="disabledListboxes ">
127
125
@for (shirtSize of shirtSizes; track shirtSize) {
128
- < mat-chip-option [disabled] ="shirtSize.disabled ">
129
- {{shirtSize.label}}
130
- @if (listboxesWithAvatar) {
131
- < mat-chip-avatar > {{shirtSize.avatar}}</ mat-chip-avatar >
132
- }
133
- </ mat-chip-option >
126
+ < mat-chip-option [disabled] ="shirtSize.disabled ">
127
+ {{shirtSize.label}}
128
+ @if (listboxesWithAvatar) {
129
+ < mat-chip-avatar > {{shirtSize.avatar}}</ mat-chip-avatar >
130
+ }
131
+ </ mat-chip-option >
134
132
}
135
133
</ mat-chip-listbox >
136
134
@@ -151,7 +149,7 @@ <h4>Multi selection</h4>
151
149
</ mat-card >
152
150
153
151
< mat-card >
154
- < mat-toolbar color =" primary " > Input Chips </ mat-toolbar >
152
+ < mat-card-header > Chip Grid </ mat-card-header >
155
153
156
154
< mat-card-content >
157
155
< p >
@@ -160,13 +158,9 @@ <h4>Multi selection</h4>
160
158
They can be used inside a < code > <mat-form-field></ code > .
161
159
</ p >
162
160
163
- < button matButton (click) ="disableInputs = !disableInputs ">
164
- {{disableInputs ? "Enable" : "Disable"}}
165
- </ button >
166
-
167
- < button matButton (click) ="editable = !editable ">
168
- {{editable ? "Disable editing" : "Enable editing"}}
169
- </ button >
161
+ < mat-checkbox [(ngModel)] ="disableInputs "> Disabled</ mat-checkbox >
162
+ < mat-checkbox [(ngModel)] ="editable "> Editable</ mat-checkbox >
163
+ < mat-checkbox [(ngModel)] ="disabledInteractive "> Disabled Interactive</ mat-checkbox >
170
164
171
165
< h4 > Input is last child of chip grid</ h4 >
172
166
@@ -188,19 +182,15 @@ <h4>Input is last child of chip grid</h4>
188
182
[matChipInputFor] ="chipGrid1 "
189
183
[matChipInputSeparatorKeyCodes] ="separatorKeysCodes "
190
184
[matChipInputAddOnBlur] ="addOnBlur "
185
+ [matChipInputDisabledInteractive] ="disabledInteractive "
191
186
(matChipInputTokenEnd) ="add($event) "
192
- aria-label =" New contributor input... " />
187
+ placeholder =" Add a contributor " />
193
188
</ mat-chip-grid >
194
- < input [disabled] ="disableInputs "
195
- [matChipInputFor] ="chipGrid1 "
196
- [matChipInputSeparatorKeyCodes] ="separatorKeysCodes "
197
- [matChipInputAddOnBlur] ="addOnBlur "
198
- (matChipInputTokenEnd) ="add($event) " />
199
189
</ mat-form-field >
200
190
201
191
< h4 > Input is next sibling child of chip grid</ h4 >
202
192
203
- < mat-form-field >
193
+ < mat-form-field class =" demo-has-chip-list " >
204
194
< mat-label > New Contributor...</ mat-label >
205
195
< mat-chip-grid #chipGrid2 [(ngModel)] ="selectedPeople " required [disabled] ="disableInputs ">
206
196
@for (person of people; track person) {
@@ -215,7 +205,9 @@ <h4>Input is next sibling child of chip grid</h4>
215
205
< input [matChipInputFor] ="chipGrid2 "
216
206
[matChipInputSeparatorKeyCodes] ="separatorKeysCodes "
217
207
[matChipInputAddOnBlur] ="addOnBlur "
218
- (matChipInputTokenEnd) ="add($event) "/>
208
+ [matChipInputDisabledInteractive] ="disabledInteractive "
209
+ (matChipInputTokenEnd) ="add($event) "
210
+ placeholder ="Add a contributor "/>
219
211
</ mat-form-field >
220
212
221
213
< p >
@@ -232,7 +224,7 @@ <h4>Options</h4>
232
224
</ mat-card >
233
225
234
226
< mat-card >
235
- < mat-toolbar color =" primary " > Miscellaneous</ mat-toolbar >
227
+ < mat-card-header > Miscellaneous</ mat-card-header >
236
228
< mat-card-content >
237
229
< h4 > Stacked</ h4 >
238
230
0 commit comments