Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(material/chips): adds default placeholder for chips input #30452

Merged
merged 12 commits into from
Mar 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/dev-app/chips/chips-demo.html
Original file line number Diff line number Diff line change
@@ -29,8 +29,8 @@ <h4>Unstyled</h4>
<mat-basic-chip-row>Basic Chip Row 1</mat-basic-chip-row>
<mat-basic-chip-row>Basic Chip Row 2</mat-basic-chip-row>
<mat-basic-chip-row>Basic Chip Row 3</mat-basic-chip-row>
<input [matChipInputFor]="basicGrid" readonly>
</mat-chip-grid>
<input [matChipInputFor]="basicGrid" readonly>

<h4>With avatar, icons, and color</h4>

@@ -185,11 +185,17 @@ <h4>Input is last child of chip grid</h4>
</mat-chip-row>
}
<input [disabled]="disableInputs"
[matChipInputFor]="chipGrid1"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
[matChipInputAddOnBlur]="addOnBlur"
(matChipInputTokenEnd)="add($event)" />
[matChipInputFor]="chipGrid1"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
[matChipInputAddOnBlur]="addOnBlur"
(matChipInputTokenEnd)="add($event)"
aria-label="New contributor input..." />
</mat-chip-grid>
<input [disabled]="disableInputs"
[matChipInputFor]="chipGrid1"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
[matChipInputAddOnBlur]="addOnBlur"
(matChipInputTokenEnd)="add($event)" />
</mat-form-field>

<h4>Input is next sibling child of chip grid</h4>
@@ -209,7 +215,7 @@ <h4>Input is next sibling child of chip grid</h4>
<input [matChipInputFor]="chipGrid2"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
[matChipInputAddOnBlur]="addOnBlur"
(matChipInputTokenEnd)="add($event)" />
(matChipInputTokenEnd)="add($event)"/>
</mat-form-field>

<p>
9 changes: 6 additions & 3 deletions src/material/chips/chips.md
Original file line number Diff line number Diff line change
@@ -141,6 +141,8 @@ The chips components support 3 user interaction patterns, each with its own cont

`<mat-chip-grid>` and `<mat-chip-row>` : These elements implement a grid accessibility pattern. Use them as part of a free form input that allows users to enter text to add chips.

Note : be sure to have the input element be a sibling of mat-chip-grid to ensure accessibility of the input element by accessibility devices such as Voice Control. It is also recommended to apply an appropriate `aria-label` to the input to optimize accessibility of the input.

```html
<mat-form-field>
<mat-chip-grid #myChipGrid [(ngModel)]="mySelection"
@@ -153,10 +155,11 @@ The chips components support 3 user interaction patterns, each with its own cont
</button>
</mat-chip-row>
}
<input [matChipInputFor]="myChipGrid"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
(matChipInputTokenEnd)="add($event)" />
</mat-chip-grid>
<input [matChipInputFor]="myChipGrid"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
(matChipInputTokenEnd)="add($event)"
aria-label="Add sandwich fillings..." />
</mat-form-field>
```

Loading
Oops, something went wrong.