Skip to content

Commit cee398a

Browse files
committed
refactor(material/chips): updating chips dev-app to add disabled input chips
Updates previous chips dev-app demo to include disabled input chips to mimic the XAP demo for a11y testing purposes.
1 parent a11bcb5 commit cee398a

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

src/dev-app/chips/chips-demo.html

+68
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,74 @@ <h4>Options</h4>
225225
</mat-card-content>
226226
</mat-card>
227227

228+
<mat-card>
229+
<mat-toolbar color="primary">Disabled Input Chips</mat-toolbar>
230+
231+
<mat-card-content>
232+
<p>
233+
The <code>&lt;mat-chip-grid&gt;</code> component pairs with the <code>matChipInputFor</code> directive
234+
to convert user input text into chips.
235+
They can be used inside a <code>&lt;mat-form-field&gt;</code>.
236+
</p>
237+
238+
<h4>Input is last child of chip grid</h4>
239+
240+
<mat-form-field class="demo-has-chip-list">
241+
<mat-label>New Contributor...</mat-label>
242+
<mat-chip-grid #chipGrid1 [(ngModel)]="selectedPeople" required>
243+
@for (person of people; track person) {
244+
<mat-chip-row
245+
[disabled]="true"
246+
[editable]="editable"
247+
(removed)="remove(person)"
248+
(edited)="edit(person, $event)">
249+
{{person.name}}
250+
<button matChipRemove aria-label="Remove contributor">
251+
<mat-icon>close</mat-icon>
252+
</button>
253+
</mat-chip-row>
254+
}
255+
<input
256+
[matChipInputFor]="chipGrid1"
257+
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
258+
[matChipInputAddOnBlur]="addOnBlur"
259+
(matChipInputTokenEnd)="add($event)" />
260+
</mat-chip-grid>
261+
</mat-form-field>
262+
263+
<h4>Input is next sibling child of chip grid</h4>
264+
265+
<mat-form-field>
266+
<mat-label>New Contributor...</mat-label>
267+
<mat-chip-grid #chipGrid2 [(ngModel)]="selectedPeople" required>
268+
@for (person of people; track person) {
269+
<mat-chip-row disabled (removed)="remove(person)">
270+
{{person.name}}
271+
<button matChipRemove aria-label="Remove contributor">
272+
<mat-icon>close</mat-icon>
273+
</button>
274+
</mat-chip-row>
275+
}
276+
</mat-chip-grid>
277+
<input [matChipInputFor]="chipGrid2"
278+
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
279+
[matChipInputAddOnBlur]="addOnBlur"
280+
(matChipInputTokenEnd)="add($event)" />
281+
</mat-form-field>
282+
283+
<p>
284+
The example above has overridden the <code>[separatorKeys]</code> input to allow for
285+
<code>ENTER</code>, <code>COMMA</code> and <code>SEMICOLON</code> keys.
286+
</p>
287+
288+
<h4>Options</h4>
289+
<p>
290+
<mat-checkbox name="addOnBlur" [(ngModel)]="addOnBlur">Add on Blur</mat-checkbox>
291+
</p>
292+
293+
</mat-card-content>
294+
</mat-card>
295+
228296
<mat-card>
229297
<mat-toolbar color="primary">Miscellaneous</mat-toolbar>
230298
<mat-card-content>

0 commit comments

Comments
 (0)